# a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo architecture

> Architecture diagram of the GitHub repository a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo
- Repository: https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo

## Overview

##### Project type and purpose
- This is a toy demo of an AI-driven delegation workflow: a small “full-stack” microservice setup that shows how an OAuth server delegates access to an AI agent (the CalendarAgent) via the Model Context Protocol (MCP).
- It also contains an alternative “vc_based” subdirectory demonstrating a Verifiable-Credential–based variant of the same pattern.

##### File structure
- Top level:
- oauth_server.py – a Flask OAuth server that issues access tokens
- mcp_server.py – the CalendarAgent acting as an MCP server
- client_with_callback.py – an MCP client script that drives the flow and handles the OAuth callback
- servers_config.json – configuration of server endpoints/ports
- requirements.txt, Makefile – build/run scripts
- vc_based/ – a parallel demo using Verifiable Credentials:
- vc_issuer.py, vc_agent.py, vc_client.py, vc_verifier.py
- vc_based/README.md explaining the VC workflow

##### README for architecture hints
- Two parallel servers: Flask OAuth server & MCP CalendarAgent
User → OAuth server → MCP client → MCP server → OAuth server (calendar data) → MCP client
- Key endpoints:
- OAuth “/token” and “/authorize” for user login → token
- MCP Agent “find_slot” API requiring the token

##### Main components & relationships
a. Components:
– User (Browser or CLI)
– OAuth Server (Flask app)
– MCP Client (client_with_callback.py)
– CalendarAgent (MCP Server, mcp_server.py)
– (Optional) Calendar Data store or simulated data
– (Optional VC components under vc_based/)
b. Interactions:
1. User → OAuth Server: authorize agent (login → obtain access token)
2. User/Client → MCP Client: trigger “call_agent”
3. MCP Client → CalendarAgent.find_slot(token)
4. CalendarAgent → OAuth Server: fetch calendar data using token
5. CalendarAgent → MCP Client: return available time slots
c. Architectural patterns:
– Microservice separation: auth service vs. agent service
– Token-based delegation (OAuth 2.0)
– Agent API via MCP (Model Context Protocol)
– (In vc_based/) Verifiable-Credentials issuance, presentation, and verification
d. Key technologies:
– Flask for OAuth server
– FastAPI/uvicorn for MCP server (mcp_server.py uses uvicorn)
– Standard Python HTTP client libraries for MCP client
– JSON config for service discovery (servers_config.json)
– Optional VC library in vc_based folder

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors and Services
    User["User"]:::user
    subgraph "Auth Service"
        OAuth["OAuth Server"]:::auth
        DB["Calendar Data Store"]:::db
    end
    subgraph "Client Service"
        Client["MCP Client"]:::client
    end
    subgraph "Agent Service"
        Agent["CalendarAgent (MCP Server)"]:::agent
    end

    %% Interactions
    User -->|"1. GET /authorize"| OAuth
    OAuth -->|"2. Return access token"| Client
    Client -->|"3. POST find_slot(token)"| Agent
    Agent -->|"4. GET /calendar?token=…"| OAuth
    OAuth -->|"5. Return calendar data"| Agent
    Agent -->|"6. Return available slots"| Client

    %% VC-Based Alternative Flow
    subgraph "VC-based Alternative Flow"  
        direction TB
        VCIssuer["VC Issuer Service"]:::vc
        VCAgent["VC Agent Service"]:::vc
        VCMCP["VC MCP Server"]:::vc
        VCClient["VC Client"]:::vc
        VCVerifier["VC Verifier"]:::vc
    end

    %% Development Tools
    subgraph "Development Artifacts"
        direction TB
        Config["Service Discovery Config"]:::util
        MakefileNode["Makefile"]:::util
        Req["requirements.txt"]:::util
        Readme["Project README"]:::util
        VCReadme["VC-based README"]:::util
    end

    %% Click Events
    click OAuth "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/oauth_server.py"
    click Agent "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/mcp_server.py"
    click Client "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/client_with_callback.py"
    click Config "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/servers_config.json"
    click MakefileNode "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/tree/main/Makefile"
    click Req "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/requirements.txt"
    click Readme "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/README.md"
    click VCReadme "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/README.md"
    click VCIssuer "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/vc_issuer.py"
    click VCAgent "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/vc_agent.py"
    click VCMCP "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/vc_mcp_server.py"
    click VCClient "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/vc_client.py"
    click VCVerifier "https://github.com/a2aoverlay/arxiv-2501.09674v1-agentic-delegation-demo/blob/main/vc_based/vc_verifier.py"

    %% Styles
    classDef auth fill:#cce5ff,stroke:#3399ff,color:#000
    classDef agent fill:#d4edda,stroke:#28a745,color:#000
    classDef client fill:#fff3cd,stroke:#ffc107,color:#000
    classDef user fill:#f8d7da,stroke:#dc3545,color:#000
    classDef db fill:#e2e3e5,stroke:#6c757d,color:#000
    classDef util fill:#d1ecf1,stroke:#17a2b8,color:#000
    classDef vc fill:#f5c6cb,stroke:#e83e8c,color:#000
```
