# microsoft/copilot-studio-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/microsoft/copilot-studio-mcp
- Repository: https://github.com/microsoft/copilot-studio-mcp

## Overview

##### Project type and purpose
- This is a samples repository (“Microsoft Copilot Studio & Model Context Protocol (MCP) Samples”) demonstrating how to build small HTTP- or SSE-based services that integrate with Microsoft Copilot Studio via the MCP protocol.
- Each sample (in TypeScript or C#) shows a standalone microservice exposing either a streaming (SSE) endpoint or an HTTP endpoint, implementing simple domain logic (e.g., calculator, employee vacations, joke service) and calling the Copilot Studio API.

##### File structure
- Top-level:
– Solution file (.sln) for the C# sample.
– samples/ directory grouping independent subfolders by scenario and language.
- In each sample folder:
– Dockerfile and/or Azure infra definitions (jokesmcp-http-typescript/infra/*.bicep) for containerization and deployment.
– package.json, tsconfig.json for TypeScript projects; .csproj, appsettings.json for C#.
– src/: request handler (index.ts or server.ts / Program.cs), domain services under src/services or Services/, domain entities under Entities/.
- This consistent pattern signals a layered architecture in each sample: Presentation (HTTP/SSE), Application (Controller/Router), Domain (Services + Entities), External Integration (MCP client connector).

##### README for additional insights
- The README confirms this is not a monolithic app but a collection of usage samples for the MCP interface.

##### Final recommendations
- Be detailed: capture every layer from network boundary to domain logic to external API.
- Avoid overcrowding: collapse repeated patterns under a “common architecture” container and annotate specifics for each scenario.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Swimlanes and Layers
    subgraph "Client"
        direction TB
        Client["Client\n(curl/Browser)"]:::external
    end

    subgraph "Sample Service"
        direction TB
        subgraph "Listeners (HTTP/SSE)"
            direction TB
            Li1["Calculator SSE Listener"]:::module
            Li2["Employee Vacations HTTP Listener"]:::module
            Li3["Jokes HTTP Listener"]:::module
            Li4["Jokes SSE Listener"]:::module
            Li5["Employee Vacations HTTP Listener (C#)"]:::module
        end

        subgraph "Router / Controller"
            direction TB
            Ctr1["HTTP Router (TS)"]:::module
            Ctr2["ASP.NET Core Controllers"]:::module
        end

        subgraph "Domain Services"
            direction TB
            Ds1["EmployeeVacationService (TS)"]:::module
            Ds2["IEmployeeVacationService (C#)"]:::module
            Ds3["EmployeeVacationService (C#)"]:::module
        end

        subgraph "Domain Entities (C#)"
            direction TB
            E1["Employee.cs"]:::module
            E2["EmployeeVacationEntity.cs"]:::module
        end

        subgraph "MCP Connector"
            direction TB
            M1["Connector Config (Jokes SSE)"]:::infra
            M2["Generic MCP Client"]:::module
        end
    end

    subgraph "External Services"
        direction TB
        CopilotStudio["Microsoft Copilot Studio\n(MCP API)"]:::external
    end

    subgraph "Deployment / Infra"
        direction TB
        Developer["Developer/CI"]:::infra
        B1["Bicep main.bicep"]:::infra
        Dk["Dockerfile"]:::infra
        AS["Azure Resources\n(ACI, ACR)"]:::external
    end

    %% Connections
    Client -->|"HTTP/SSE Request"| Li1
    Client -->|"HTTP Request"| Li2
    Client -->|"HTTP Request"| Li3
    Client -->|"SSE Request"| Li4
    Client -->|"HTTP Request"| Li5

    Li1 --> Ctr1
    Li2 --> Ctr1
    Li3 --> Ctr1
    Li4 --> Ctr1
    Li5 --> Ctr2

    Ctr1 --> Ds1
    Ctr2 --> Ds3

    Ds1 --> M2
    Ds3 --> M2

    M2 -->|"HTTPS"| CopilotStudio
    CopilotStudio -->|"HTTPS Response"| M2

    Developer --> B1
    Developer --> Dk
    B1 --> AS
    Dk --> AS
    AS -->|"Deploy Container"| Li3

    %% Click Events
    click Li1 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/calculator-sse-typescript/src/index.ts"
    click Ds1 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-typescript/src/services/employeeVacationService.ts"
    click Li2 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-typescript/src/app.ts"
    click Li3 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/jokesmcp-http-typescript/src/server.ts"
    click B1 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/jokesmcp-http-typescript/infra/main.bicep"
    click Dk "https://github.com/microsoft/copilot-studio-mcp/tree/main/samples/jokesmcp-http-typescript/Dockerfile"
    click M1 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/jokesmcp-sse-typescript/assets/connector.yml"
    click Li4 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/jokesmcp-sse-typescript/src/index.ts"
    click Li5 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/Program.cs"
    click E1 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/Entities/Employee.cs"
    click E2 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/Entities/EmployeeVacationEntity.cs"
    click Ds2 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/Services/IEmployeeVacationService.cs"
    click Ds3 "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/Services/EmployeeVacationService.cs"
    click Developer "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/mcp-http-server.csproj"
    click Developer "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/appsettings.json"
    click Developer "https://github.com/microsoft/copilot-studio-mcp/blob/main/samples/employeevacations-http-csharp/appsettings.Development.json"

    %% Styles
    classDef module fill:#D0E8FF,stroke:#3399FF,stroke-width:1px
    classDef external fill:#D0FFD0,stroke:#00AA00,stroke-width:1px
    classDef infra fill:#FFE8B0,stroke:#FFAA00,stroke-width:1px
```
