# shdhumale/fastmcp-adk-server-client architecture

> Architecture diagram of the GitHub repository shdhumale/fastmcp-adk-server-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shdhumale/fastmcp-adk-server-client
- Repository: https://github.com/shdhumale/fastmcp-adk-server-client

## Overview

##### Project type and purpose
- This is a minimal full-stack Python client-server demo.
- Purpose: Expose “tools” (ADK agents) via a FastMCP server (server.py) and interact with them via a FastMCP client (client.py).

##### File structure
- Top-level files:
- server.py – MCP server wrapping ADK agents
- client.py – MCP client to consume server tools
- requirements.txt – Python dependencies (FastMCP, ADK, etc.)
- .env – optional environment configuration (API keys, endpoints)
- No separate “src,” tests, or frontend; it’s a single-service architecture with a client script.

##### README for additional insights
- FastMCP provides a decorator-based interface to declare tools (endpoints).
- ADK agents supply the intelligent tool logic.
- Interaction flow: client connects → lists tools → invokes tool → server dispatches to ADK agent → returns result.

##### Main components and interactions
a. Components
1. FastMCP Server (server.py)
– Decorator-defined endpoints/tools
– ADK Agent module/plugin
– HTTP/MCP transport layer (uvicorn or builtin FastMCP server)
– Configuration loader (.env)
2. ADK Agent
– Implements tool logic, session state, event handling
– May call external APIs (e.g., Google services)
3. FastMCP Client (client.py)
– Connects to server over TCP/HTTP
– Discovers available tools
– Sends MCP requests and receives responses
4. Dependency Management
– requirements.txt (FastMCP, ADK, python-dotenv)
– .env for secret/config injection

b. Relationships & Data Flow
1. Client → Server: MCP request (e.g., “invoke tool X”)
2. Server → ADK Agent: Dispatch event to agent
3. ADK Agent → External Services (optional): API calls, data fetch
4. ADK Agent → Server: Return processed result
5. Server → Client: Send MCP response

c. Architectural patterns & design principles
- Separation of concerns: transport (FastMCP) vs. business logic (ADK agent) vs. client interface
- Decorator-based routing for tool registration
- Environment-based configuration for secrets/endpoints
- Single-process minimal footprint

d. Key technologies
- Python 3.10+
- FastMCP (MCP framework)
- Google ADK (agent toolkit)
- python-dotenv (optional)
- uv (optional package manager)

##### Elements
- Clear labels: “FastMCP Client,” “FastMCP Server,” “ADK Agent,” “External APIs”
- Client → Server (MCP requests)
- Server → Agent (tool invocation)
- Agent → External (optional API calls)
- Agent → Server → Client (response)
- Blue rectangles for code components (client.py, server.py)
- Green for agent logic
- Grey for infrastructure (requirements.txt, .env)

##### Step-by-step creation
1. Sketch the client on the left: label “FastMCP Client (client.py).”
– Transport Layer (FastMCP HTTP/TCP)
– Tool Registry (decorators in server.py)
– Config (.env loader)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Zone"
        client["FastMCP Client\n(client.py)"]:::client
    end

    subgraph "Server Zone"
        transport["Transport Layer\n(FastMCP HTTP/TCP)"]:::server
        tools["Tool Registry\n(Decorators in server.py)"]:::server
        config["Config Loader\n(.env)"]:::infra
        deps["Dependencies\n(requirements.txt)"]:::infra
        subgraph "ADK Agent"
            agent["ADK Agent Module"]:::agent
        end
    end

    external["External APIs"]:::external

    client -->|"MCP request"| transport
    transport --> tools
    tools --> agent
    agent -->|"optional API calls"| external
    external -->|"API response"| agent
    agent -->|"processed result"| tools
    tools -->|"MCP response"| transport
    transport -->|"MCP response"| client

    click client "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/client.py"
    click transport "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/server.py"
    click tools "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/server.py"
    click agent "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/server.py"
    click config "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/.env"
    click deps "https://github.com/shdhumale/fastmcp-adk-server-client/blob/main/requirements.txt"

    classDef client fill:#E0F7FA,stroke:#006064,stroke-width:1px
    classDef server fill:#BBDEFB,stroke:#0D47A1,stroke-width:1px
    classDef agent fill:#C8E6C9,stroke:#1B5E20,stroke-width:1px
    classDef infra fill:#ECEFF1,stroke:#455A64,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#E65100,stroke-width:1px,stroke-dasharray:5 5
```
