# microsoft/mcsmcp architecture

> Architecture diagram of the GitHub repository microsoft/mcsmcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/mcsmcp
- Repository: https://github.com/microsoft/mcsmcp

## Overview

##### Project type and purpose
- This is a single-service, backend Node.js application (“MCP Server”) written in TypeScript.
- Its purpose is to implement the Model Context Protocol (MCP) endpoint (`/mcp`) for use by Microsoft Copilot Studio, VS Code, or other LLM-powered clients.
- It ships with infrastructure as code (IaC) to deploy the service to Azure (Azure Container Apps) via Bicep templates, and can also run locally behind a dev tunnel.

##### File structure
- Top-level files:
- Dockerfile – builds a container from the compiled TypeScript server.
- azure.yaml – Azure Developer CLI configuration.
- infra/ – Bicep definitions:
– main.bicep + main.parameters.json – defines resource group, Container App, Container Registry, etc.
– modules/fetch-container-image.bicep – pulls the image.
- src/server.ts – the only application code, exposing an HTTP JSON-RPC endpoint (`/mcp`).
- package.json, tsconfig.json – Node/TS build configuration.
- No frontend code; no database; purely stateless HTTP service.
- README contains instructions for local run (dev tunnel / port forwarding) and Azure deploy (`azd up` / `azd down`).

##### README for additional insights
- Confirms the flow: client → HTTP/SSE connection to `/mcp` → JSON-RPC over HTTP.
- Emphasizes two deployment modes: local dev tunnel or Azure Container Apps.
- No mention of external data sources or databases.

##### Final advice
- Every moving part: clients, network endpoint, container runtime, IaC.
- Two deployment paths side by side (local vs cloud).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients" 
        direction TB
        VSCode["VS Code Dev Tunnel"]:::client
        Copilot["Copilot Studio Connector"]:::client
    end

    %% Network Endpoints
    subgraph "Network & Connectivity"
        direction TB
        DevTunnelEP["Dev Tunnel Endpoint"]:::network
        PublicEP["Public HTTPS Endpoint (/mcp)"]:::network
    end

    %% Compute & Hosting
    subgraph "Compute & Hosting"
        direction TB
        LocalNode["Local Node Server\n(src/server.ts)"]:::compute
        ContainerApp["Azure Container App\n(src/server.ts)"]:::compute
    end

    %% Registry
    ACR["Azure Container Registry"]:::registry

    %% Deployment / IaC
    subgraph "IaC & Deployment"
        direction TB
        AZD["Azure Developer CLI\n(azure.yaml)"]:::iac
        BicepRoot["Bicep Template\n(main.bicep)"]:::iac
        BicepParams["Bicep Parameters\n(main.parameters.json)"]:::iac
        ResourcesMod["Resources Module\n(resources.bicep)"]:::iac
        FetchMod["Fetch Container Image Module\n(fetch-container-image.bicep)"]:::iac
        Abbrev["Abbreviations Ref\n(abbreviations.json)"]:::iac
    end

    %% Connections
    VSCode -->|"\u2192 HTTP/SSE /mcp"| DevTunnelEP
    Copilot -->|"\u2192 HTTPS /mcp"| PublicEP

    DevTunnelEP -->|"\u2192 listens on PORT"| LocalNode
    PublicEP -->|"\u2192 routes to"| ContainerApp

    ContainerApp -->|"\u2192 pulls image"| ACR
    ACR -->|"\u2192 provides image"| ContainerApp

    AZD -->|"\u2192 deploys"| BicepRoot
    BicepRoot --> BicepParams
    BicepRoot --> ResourcesMod
    BicepRoot --> FetchMod
    BicepRoot --> Abbrev

    BicepRoot -->|"\u2192 provisions"| ACR
    BicepRoot -->|"\u2192 provisions"| ContainerApp

    %% Click Events
    click LocalNode "https://github.com/microsoft/mcsmcp/blob/main/src/server.ts"
    click ContainerApp "https://github.com/microsoft/mcsmcp/blob/main/src/server.ts"
    click VSCode "https://github.com/microsoft/mcsmcp/blob/main/.gitignore"
    click Copilot "https://github.com/microsoft/mcsmcp/blob/main/.gitignore"
    click AZD "https://github.com/microsoft/mcsmcp/blob/main/azure.yaml"
    click BicepRoot "https://github.com/microsoft/mcsmcp/blob/main/infra/main.bicep"
    click BicepParams "https://github.com/microsoft/mcsmcp/blob/main/infra/main.parameters.json"
    click ResourcesMod "https://github.com/microsoft/mcsmcp/blob/main/infra/resources.bicep"
    click FetchMod "https://github.com/microsoft/mcsmcp/blob/main/infra/modules/fetch-container-image.bicep"
    click Abbrev "https://github.com/microsoft/mcsmcp/blob/main/infra/abbreviations.json"
    click ACR "https://github.com/microsoft/mcsmcp/blob/main/infra/main.bicep"
    click LocalNode "https://github.com/microsoft/mcsmcp/blob/main/package.json"
    click LocalNode "https://github.com/microsoft/mcsmcp/blob/main/package-lock.json"
    click LocalNode "https://github.com/microsoft/mcsmcp/blob/main/tsconfig.json"

    %% Styles
    classDef client fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef network fill:#ECEFF1,stroke:#607D8B,stroke-width:2px,stroke-dasharray: 5 5;
    classDef compute fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px;
    classDef registry fill:#FFF3E0,stroke:#F57C00,stroke-width:2px,stroke-dasharray: 2 2;
    classDef iac fill:#FFF8E1,stroke:#FF8F00,stroke-width:2px,stroke-dasharray: 4 2;
```
