# yimam-skyward/mcp_agent_tutorial architecture

> Architecture diagram of the GitHub repository yimam-skyward/mcp_agent_tutorial, 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/yimam-skyward/mcp_agent_tutorial
- Repository: https://github.com/yimam-skyward/mcp_agent_tutorial

## Overview

##### Project type and purpose
- This is a small distributed AI‐assistant demo using the Model Context Protocol (MCP) and Server-Sent Events (SSE).
- Its goal is to show how an AI client (LLM) can dynamically call out to external “tools” via an MCP server when it needs extra data.

##### File structure
- At top-level you have:
- sse_server.py – the MCP Server implementing SSE endpoints and tool handlers
- sse_client.py – the client interface that accepts user input, forwards it to the LLM, and streams responses
- requirements.txt + .env.example – dependency list and environment variable template for AWS Bedrock keys
- No separate “frontend” or “backend” folders—both roles live as standalone Python scripts.

##### README for additional insights
- Describes three parties:
1. User (via the sse_client CLI)
2. The Language Model (Claude/Bedrock)
3. The MCP Server (sse_server.py)
- Shows the flow: user → LLM → (optional) MCP Server → LLM → user.

##### Essential elements without overcomplication
- Both the normal LLM chat path and the “tool invocation” detour
- Don’t forget environment config (.env) as a minor call-out for API keys

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Process
    subgraph "Client Process"
        direction TB
        User["User"]:::external
        CLI["User CLI (sse_client.py)"]:::internal
    end

    %% Server Process
    subgraph "Server Process"
        direction TB
        Server["MCP Server (sse_server.py)"]:::internal
    end

    %% External Services
    subgraph "External Services"
        direction TB
        LLM["LLM API (Claude/Bedrock)"]:::external
        AWS["AWS Bedrock"]:::external
    end

    %% Project Files
    subgraph "Project Files"
        direction TB
        Env[".env.example"]:::internal
        Req["requirements.txt"]:::internal
        Readme["README.md"]:::internal
    end

    %% Flows
    User -->|"types input"| CLI
    CLI -->|"POST /stream"| LLM
    LLM -->|"SSE stream"| CLI
    CLI -.->|"tool_request"| Server
    Server -->|"API call"| AWS
    AWS -->|"response"| Server
    Server -->|"SSE tool_response"| CLI
    CLI -->|"final output"| User

    %% Click Events
    click CLI "https://github.com/yimam-skyward/mcp_agent_tutorial/blob/main/sse_client.py"
    click Server "https://github.com/yimam-skyward/mcp_agent_tutorial/blob/main/sse_server.py"
    click Env "https://github.com/yimam-skyward/mcp_agent_tutorial/blob/main/.env.example"
    click Req "https://github.com/yimam-skyward/mcp_agent_tutorial/blob/main/requirements.txt"
    click Readme "https://github.com/yimam-skyward/mcp_agent_tutorial/blob/main/README.md"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef external fill:#90EE90,stroke:#333,stroke-width:1px
```
