# udacity/cd14712-exercises architecture

> Architecture diagram of the GitHub repository udacity/cd14712-exercises, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/udacity/cd14712-exercises
- Repository: https://github.com/udacity/cd14712-exercises

## Overview

The repository is the Python MCP SDK: it provides client and server APIs for exchanging protocol messages, exposing tools, resources, and prompts, and supporting authentication and multiple transports. A typical workflow is a client using a transport to connect to a server, whose protocol layer dispatches requests to registered capabilities and returns results. The graph includes major client, server, auth, and shared-protocol subsystems. Evidence is limited to the supplied excerpts and source index; some transport wiring and unsampled capability implementations are represented only at their enclosing directory paths.

Main entry points: [`python-sdk-main/src/mcp/server/fastmcp/server.py`](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/fastmcp/server.py) (FastMCP Server), [`python-sdk-main/src/mcp/server/session.py`](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/session.py) (Server Session), [`python-sdk-main/src/mcp/shared/session.py`](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/session.py) (Session Engine), [`python-sdk-main/src/mcp/server/lowlevel/server.py`](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/lowlevel/server.py) (Request Dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SDK"]
  node_client_session["Client Session<br/>[session.py]"]
  node_client_group["Session Group<br/>[session_group.py]"]
  node_client_http["HTTP Client<br/>[streamable_http.py]"]
  node_client_transports["Other Transports"]
end

subgraph group_server["Server SDK"]
  node_server_api["FastMCP Server<br/>[server.py]"]
  node_tools["Tool Registry"]
  node_resources["Resource Registry"]
  node_prompts["Prompt Registry"]
  node_lowlevel["Request Dispatch<br/>[server.py]"]
  node_server_session["Server Session<br/>[session.py]"]
  node_server_transports["Server Transports"]
  node_transport_security["Transport Security"]
  node_logging["FastMCP Logging<br/>[logging.py]"]
end

subgraph group_auth["Authentication"]
  node_auth_routes["OAuth Routes<br/>[routes.py]"]
  node_auth_provider["Auth Provider<br/>[provider.py]"]
  node_oauth_client["OAuth Client<br/>[oauth2.py]"]
  node_auth_models["Auth Models<br/>[auth.py]"]
end

subgraph group_shared["Protocol Core"]
  node_protocol_types["Protocol Types<br/>[types.py]"]
  node_shared_session["Session Engine<br/>[session.py]"]
  node_message_envelope["Message Envelope<br/>[message.py]"]
  node_request_context["Request Context<br/>[context.py]"]
  node_shared_support["Shared Support"]
end

node_caller(("MCP Client"))

node_caller -.->|"uses"| node_client_session
node_client_group -->|"selects"| node_client_transports
node_client_session -->|"uses session core"| node_shared_session
node_shared_session -->|"exchanges"| node_message_envelope
node_shared_session -->|"validates messages"| node_protocol_types
node_server_api -->|"uses protocol server"| node_lowlevel
node_lowlevel -->|"dispatches requests"| node_server_session
node_server_session -->|"extends session core"| node_shared_session
node_server_session -->|"handles messages"| node_message_envelope
node_server_session -->|"handles protocol types"| node_protocol_types
node_lowlevel -->|"sets request context"| node_request_context
node_auth_routes -->|"routes authorization"| node_auth_provider
node_auth_routes -->|"builds metadata"| node_auth_models
node_auth_provider -->|"uses auth models"| node_auth_models
node_oauth_client -->|"authenticates requests"| node_client_http
node_server_api -.->|"registers tools"| node_tools
node_server_api -.->|"registers resources"| node_resources
node_server_api -.->|"registers prompts"| node_prompts
node_server_api -->|"runs over transport"| node_server_transports
node_server_transports -.->|"checks requests"| node_transport_security

click node_client_session "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/session.py"
click node_client_group "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/session_group.py"
click node_client_http "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/streamable_http.py"
click node_client_transports "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/client"
click node_server_api "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/fastmcp/server.py"
click node_tools "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/tools"
click node_resources "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/resources"
click node_prompts "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/prompts"
click node_lowlevel "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/lowlevel/server.py"
click node_server_session "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/session.py"
click node_server_transports "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server"
click node_transport_security "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/transport_security.py"
click node_auth_routes "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/auth/routes.py"
click node_auth_provider "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/auth/provider.py"
click node_oauth_client "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/auth/oauth2.py"
click node_auth_models "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/auth.py"
click node_protocol_types "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/types.py"
click node_shared_session "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/session.py"
click node_message_envelope "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/message.py"
click node_request_context "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/context.py"
click node_shared_support "https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/shared"
click node_logging "https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/fastmcp/utilities/logging.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_session,node_client_group,node_client_http,node_client_transports,node_caller toneBlue
class node_server_api,node_tools,node_resources,node_prompts,node_lowlevel,node_server_session,node_server_transports,node_transport_security,node_logging toneAmber
class node_auth_routes,node_auth_provider,node_oauth_client,node_auth_models toneMint
class node_protocol_types,node_shared_session,node_message_envelope,node_request_context,node_shared_support toneRose
```

## Components

### Client SDK

- [Client Session](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/session.py): `python-sdk-main/src/mcp/client/session.py`
- [Session Group](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/session_group.py): `python-sdk-main/src/mcp/client/session_group.py`
- [HTTP Client](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/streamable_http.py): `python-sdk-main/src/mcp/client/streamable_http.py`
- [Other Transports](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/client): `python-sdk-main/src/mcp/client`

### Server SDK

- [FastMCP Server](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/fastmcp/server.py): `python-sdk-main/src/mcp/server/fastmcp/server.py`
- [Tool Registry](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/tools): `python-sdk-main/src/mcp/server/fastmcp/tools`
- [Resource Registry](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/resources): `python-sdk-main/src/mcp/server/fastmcp/resources`
- [Prompt Registry](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server/fastmcp/prompts): `python-sdk-main/src/mcp/server/fastmcp/prompts`
- [Request Dispatch](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/lowlevel/server.py): `python-sdk-main/src/mcp/server/lowlevel/server.py`
- [Server Session](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/session.py): `python-sdk-main/src/mcp/server/session.py`
- [Server Transports](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/server): `python-sdk-main/src/mcp/server`
- [Transport Security](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/transport_security.py): `python-sdk-main/src/mcp/server/transport_security.py`
- [FastMCP Logging](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/fastmcp/utilities/logging.py): `python-sdk-main/src/mcp/server/fastmcp/utilities/logging.py`

### Authentication

- [OAuth Routes](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/auth/routes.py): `python-sdk-main/src/mcp/server/auth/routes.py`
- [Auth Provider](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/server/auth/provider.py): `python-sdk-main/src/mcp/server/auth/provider.py`
- [OAuth Client](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/client/auth/oauth2.py): `python-sdk-main/src/mcp/client/auth/oauth2.py`
- [Auth Models](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/auth.py): `python-sdk-main/src/mcp/shared/auth.py`

### Protocol Core

- [Protocol Types](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/types.py): `python-sdk-main/src/mcp/types.py`
- [Session Engine](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/session.py): `python-sdk-main/src/mcp/shared/session.py`
- [Message Envelope](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/message.py): `python-sdk-main/src/mcp/shared/message.py`
- [Request Context](https://github.com/udacity/cd14712-exercises/blob/main/python-sdk-main/src/mcp/shared/context.py): `python-sdk-main/src/mcp/shared/context.py`
- [Shared Support](https://github.com/udacity/cd14712-exercises/tree/main/python-sdk-main/src/mcp/shared): `python-sdk-main/src/mcp/shared`

### Other components

- **MCP Client**

## Connections

- MCP Client → Client Session: uses
- Session Group → Other Transports: selects (evidence: `python-sdk-main/src/mcp/client/session_group.py`)
- Client Session → Session Engine: uses session core (evidence: `python-sdk-main/src/mcp/client/session.py`)
- Session Engine → Message Envelope: exchanges (evidence: `python-sdk-main/src/mcp/shared/session.py`)
- Session Engine → Protocol Types: validates messages (evidence: `python-sdk-main/src/mcp/shared/session.py`)
- FastMCP Server → Request Dispatch: uses protocol server (evidence: `python-sdk-main/src/mcp/server/fastmcp/server.py`)
- Request Dispatch → Server Session: dispatches requests (evidence: `python-sdk-main/src/mcp/server/lowlevel/server.py`)
- Server Session → Session Engine: extends session core (evidence: `python-sdk-main/src/mcp/server/session.py`)
- Server Session → Message Envelope: handles messages (evidence: `python-sdk-main/src/mcp/server/session.py`)
- Server Session → Protocol Types: handles protocol types (evidence: `python-sdk-main/src/mcp/server/session.py`)
- Request Dispatch → Request Context: sets request context (evidence: `python-sdk-main/src/mcp/server/lowlevel/server.py`)
- OAuth Routes → Auth Provider: routes authorization (evidence: `python-sdk-main/src/mcp/server/auth/routes.py`)
- OAuth Routes → Auth Models: builds metadata (evidence: `python-sdk-main/src/mcp/server/auth/routes.py`)
- Auth Provider → Auth Models: uses auth models (evidence: `python-sdk-main/src/mcp/server/auth/provider.py`)
- OAuth Client → HTTP Client: authenticates requests (evidence: `python-sdk-main/src/mcp/client/auth/oauth2.py`)
- FastMCP Server → Tool Registry: registers tools (evidence: `python-sdk-main/src/mcp/server/fastmcp/server.py`)
- FastMCP Server → Resource Registry: registers resources (evidence: `python-sdk-main/src/mcp/server/fastmcp/server.py`)
- FastMCP Server → Prompt Registry: registers prompts (evidence: `python-sdk-main/src/mcp/server/fastmcp/server.py`)
- FastMCP Server → Server Transports: runs over transport (evidence: `python-sdk-main/src/mcp/server/fastmcp/server.py`)
- Server Transports → Transport Security: checks requests (evidence: `python-sdk-main/src/mcp/server/streamable_http_manager.py`)
