# dem108/mcp-foundry architecture

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

- Interactive diagram: https://gitdiagram.com/dem108/mcp-foundry
- Repository: https://github.com/dem108/mcp-foundry

## Overview

##### Project type and purpose
- This is an open-source, polyglot MCP (“Modular Chat Protocol”) server project.
- Purpose: provide interchangeable servers (in Python and TypeScript) that speak the MCP protocol, forwarding requests to Azure AI Foundry agent services and returning responses to any MCP-compatible client.

##### File structure
- Top-level: GitHub metadata, docs, CHANGELOG, LICENSE, README.
- docs/: Markdown describing each MCP server variant.
- src/python/:
- pyproject.toml (build config)
- azure_agent_mcp_server/ (package) with __main__.py entrypoint
- requirements.txt
- src/typescript/:
- package.json + package-lock.json (npm config)
- tsconfig.json (ESM + TS compiler settings)
- src/index.ts (server entrypoint)
- uv.lock (lockfile)

##### README for additional insights
- Confirms two server implementations (Azure AI Agent Service MCP Server).
- Describes polyglot structure and developer workflows for each language.
- States the servers adhere to the MCP protocol spec so any MCP client can connect.

##### Essential architectural elements
- Clearly separate the two implementations but group them under “MCP Server”
- Standard development flow for each (install → build → run).
- Round-trip data flow: Client → Server → Azure AI → Server → Client.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Protocol & Clients Layer
    Client["MCP Client(s)"]:::protocolBlue
    Protocol["MCP Protocol Layer"]:::protocolBlue

    %% Server Implementations
    subgraph "MCP Server Implementations"
        direction TB
        subgraph "Python Implementation" 
            direction TB
            PyServer["Python MCP Server"]:::serverGreen
            PyMain["__main__.py"]:::serverGreen
            PyInit["__init__.py"]:::serverGreen
        end
        subgraph "TypeScript Implementation"
            direction TB
            TsServer["TypeScript MCP Server"]:::serverGreen
            TsIndex["index.ts"]:::serverGreen
        end
    end

    %% External Service
    Azure["Azure AI Foundry Agent Service"]:::externalOrange

    %% Build & Configuration
    subgraph "Build & Configuration"
        direction TB
        PyProject["pyproject.toml"]:::configGray
        ReqTxt["requirements.txt"]:::configGray
        PkgJson["package.json"]:::configGray
        TsConfig["tsconfig.json"]:::configGray
        LockFile["package-lock.json"]:::configGray
    end

    %% Documentation & Metadata
    subgraph "Docs & Metadata"
        direction TB
        DocAzure["docs/azure-ai-agent-service-mcp-server.md"]:::configGray
        Readme["README.md"]:::configGray
    end

    %% Data Flows
    Client -->|"MCP request"| Protocol
    Protocol -->|"route to Python"| PyServer
    Protocol -->|"route to TypeScript"| TsServer

    PyServer -->|"HTTP/REST call"| Azure
    TsServer -->|"HTTP/REST call"| Azure

    Azure -->|"AI response"| PyServer
    Azure -->|"AI response"| TsServer

    PyServer -->|"MCP response"| Protocol
    TsServer -->|"MCP response"| Protocol

    Protocol -->|"send response"| Client

    %% Build Relationships
    PyProject --> PyServer
    ReqTxt --> PyServer
    PkgJson --> TsServer
    TsConfig --> TsServer
    LockFile --> TsServer

    %% Click Events
    click PyServer "https://github.com/dem108/mcp-foundry/tree/main/src/python/azure_agent_mcp_server/"
    click PyMain "https://github.com/dem108/mcp-foundry/blob/main/src/python/azure_agent_mcp_server/__main__.py"
    click PyInit "https://github.com/dem108/mcp-foundry/blob/main/src/python/azure_agent_mcp_server/__init__.py"
    click PyProject "https://github.com/dem108/mcp-foundry/blob/main/pyproject.toml"
    click ReqTxt "https://github.com/dem108/mcp-foundry/blob/main/src/python/requirements.txt"
    click TsServer "https://github.com/dem108/mcp-foundry/blob/main/src/typescript/src/index.ts"
    click PkgJson "https://github.com/dem108/mcp-foundry/blob/main/src/typescript/package.json"
    click TsConfig "https://github.com/dem108/mcp-foundry/blob/main/src/typescript/tsconfig.json"
    click LockFile "https://github.com/dem108/mcp-foundry/blob/main/src/typescript/package-lock.json"
    click DocAzure "https://github.com/dem108/mcp-foundry/blob/main/docs/azure-ai-agent-service-mcp-server.md"
    click Readme "https://github.com/dem108/mcp-foundry/blob/main/README.md"

    %% Styles
    classDef protocolBlue fill:#D0E6F8,stroke:#0366d6,color:#0366d6;
    classDef serverGreen fill:#D8F5E1,stroke:#22863A,color:#22863A;
    classDef externalOrange fill:#FFE7D0,stroke:#D15704,color:#D15704;
    classDef configGray fill:#F0F0F0,stroke:#6A737D,color:#6A737D;
```
