# 71ashu/mcp-agent-orchestrator architecture

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

- Interactive diagram: https://gitdiagram.com/71ashu/mcp-agent-orchestrator
- Repository: https://github.com/71ashu/mcp-agent-orchestrator

## Overview

Switchboard is a multi-server MCP agent orchestrator: a user submits a goal, live server tools are discovered, Claude plans a validated dependency graph, and the executor runs it with data passing, write approval, and failure recovery before producing a cited answer and run metrics. Separate branches provide evaluation, task memory, an optional web interface, and optional tracing. The README documents these capabilities; unsampled modules are represented only where it identifies their role, so some internal links are omitted.

Main entry points: [`src/orchestrator/orchestrator.py`](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/orchestrator.py) (Run orchestrator), [`src/orchestrator/mcp_client.py`](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/mcp_client.py) (MCP client pool), [`src/orchestrator/executor.py`](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/executor.py) (Step executor), [`src/orchestrator/planner.py`](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/planner.py) (DAG planner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_orchestrator["Run orchestrator<br/>[orchestrator.py]"]
  node_planner["DAG planner<br/>[planner.py]"]
  node_llm["Anthropic client<br/>[llm.py]"]
  node_executor["Step executor<br/>[executor.py]"]
  node_templates["Step templating<br/>[templating.py]"]
  node_recovery["Failure recovery<br/>[recovery.py]"]
  node_models["Plan and run models<br/>[models.py]"]
end

subgraph group_capabilities["Tool capabilities"]
  node_config["Server configuration<br/>[config.py]"]
  node_mcp["MCP client pool<br/>[mcp_client.py]"]
  node_registry["Tool registry<br/>[registry.py]"]
  node_deployment["Deployment MCP server"]
end

subgraph group_operations["Run operations"]
  node_approval["Write approval<br/>[approval.py]"]
  node_memory[("Task memory<br/>[memory.py]")]
  node_evaluation["Evaluation metrics<br/>[evaluation.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["Command-line interface<br/>[cli.py]"]
  node_web_api["Web run API<br/>[web.py]"]
  node_web_ui["Run and replay UI<br/>[App.tsx]"]
end

subgraph group_trace["Tracing"]
  node_trace_seam["Tracing seam<br/>[tracing.py]"]
  node_tracer["Trace recorder<br/>[tracer.py]"]
  node_sanitizer["Trace sanitizer<br/>[sanitize.py]"]
  node_transport["Trace transport<br/>[transport.py]"]
end

node_user(("Goal submitter"))
node_mcp_servers["Configured MCP servers"]
node_collector["Trace collector"]
node_answer(("Cited answer and metrics"))

node_user -->|"submits goal"| node_orchestrator
node_orchestrator -->|"starts discovery"| node_mcp
node_config -->|"configures servers"| node_mcp
node_mcp_servers -->|"serves tools"| node_mcp
node_deployment -->|"serves tools"| node_mcp
node_mcp -->|"provides discovered tools"| node_registry
node_orchestrator -->|"requests plan"| node_planner
node_registry -->|"supplies catalog"| node_planner
node_planner -->|"requests planning"| node_llm
node_orchestrator -->|"runs plan"| node_executor
node_executor -->|"resolves step data"| node_templates
node_executor -->|"dispatches tool calls"| node_mcp
node_executor -->|"gates write steps"| node_approval
node_executor -->|"recovers failures"| node_recovery
node_recovery -->|"repairs arguments"| node_llm
node_recovery -->|"requests replan"| node_planner
node_orchestrator -->|"synthesizes answer"| node_llm
node_orchestrator -->|"uses task hints"| node_memory
node_orchestrator -->|"records run metrics"| node_evaluation
node_orchestrator -->|"returns result"| node_answer
node_cli -->|"starts runs"| node_orchestrator
node_web_ui -->|"starts and replays runs"| node_web_api
node_web_api -->|"runs goals"| node_orchestrator
node_cli -->|"configures optional tracing"| node_trace_seam
node_trace_seam -.->|"records spans"| node_tracer
node_tracer -->|"sanitizes payloads"| node_sanitizer
node_tracer -->|"sends trace events"| node_transport
node_transport -.->|"ships traces"| node_collector

click node_orchestrator "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/orchestrator.py"
click node_planner "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/planner.py"
click node_llm "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/llm.py"
click node_executor "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/executor.py"
click node_templates "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/templating.py"
click node_recovery "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/recovery.py"
click node_models "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/models.py"
click node_config "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/config.py"
click node_mcp "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/mcp_client.py"
click node_registry "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/registry.py"
click node_deployment "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/servers/deployment_server.py"
click node_approval "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/approval.py"
click node_memory "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/memory.py"
click node_evaluation "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/evaluation.py"
click node_cli "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/cli.py"
click node_web_api "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/web.py"
click node_web_ui "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/web/src/App.tsx"
click node_trace_seam "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/tracing.py"
click node_tracer "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/tracer.py"
click node_sanitizer "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/sanitize.py"
click node_transport "https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/transport.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_orchestrator,node_planner,node_llm,node_executor,node_templates,node_recovery,node_models toneBlue
class node_config,node_mcp,node_registry,node_deployment toneAmber
class node_approval,node_memory,node_evaluation,node_mcp_servers toneMint
class node_cli,node_web_api,node_web_ui toneRose
class node_trace_seam,node_tracer,node_sanitizer,node_transport,node_user,node_collector,node_answer toneIndigo
```

## Components

### Agent runtime

- [Run orchestrator](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/orchestrator.py): `src/orchestrator/orchestrator.py`
- [DAG planner](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/planner.py): `src/orchestrator/planner.py`
- [Anthropic client](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/llm.py): `src/orchestrator/llm.py`
- [Step executor](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/executor.py): `src/orchestrator/executor.py`
- [Step templating](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/templating.py): `src/orchestrator/templating.py`
- [Failure recovery](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/recovery.py): `src/orchestrator/recovery.py`
- [Plan and run models](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/models.py): `src/orchestrator/models.py`

### Tool capabilities

- [Server configuration](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/config.py): `src/orchestrator/config.py`
- [MCP client pool](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/mcp_client.py): `src/orchestrator/mcp_client.py`
- [Tool registry](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/registry.py): `src/orchestrator/registry.py`
- [Deployment MCP server](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/servers/deployment_server.py): `servers/deployment_server.py`

### Run operations

- [Write approval](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/approval.py): `src/orchestrator/approval.py`
- [Task memory](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/memory.py): `src/orchestrator/memory.py`
- [Evaluation metrics](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/evaluation.py): `src/orchestrator/evaluation.py`

### User interfaces

- [Command-line interface](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/cli.py): `src/orchestrator/cli.py`
- [Web run API](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/web.py): `src/orchestrator/web.py`
- [Run and replay UI](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/web/src/App.tsx): `web/src/App.tsx`

### Tracing

- [Tracing seam](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/src/orchestrator/tracing.py): `src/orchestrator/tracing.py`
- [Trace recorder](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/tracer.py): `switchboard-trace/src/switchboard_trace/tracer.py`
- [Trace sanitizer](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/sanitize.py): `switchboard-trace/src/switchboard_trace/sanitize.py`
- [Trace transport](https://github.com/71ashu/mcp-agent-orchestrator/blob/master/switchboard-trace/src/switchboard_trace/transport.py): `switchboard-trace/src/switchboard_trace/transport.py`

### Other components

- **Goal submitter**
- **Configured MCP servers**
- **Trace collector**
- **Cited answer and metrics**

## Connections

- Goal submitter → Run orchestrator: submits goal (evidence: `README.md`)
- Run orchestrator → MCP client pool: starts discovery (evidence: `README.md`)
- Server configuration → MCP client pool: configures servers (evidence: `src/orchestrator/mcp_client.py`)
- Configured MCP servers → MCP client pool: serves tools (evidence: `README.md`)
- Deployment MCP server → MCP client pool: serves tools (evidence: `README.md`)
- MCP client pool → Tool registry: provides discovered tools (evidence: `README.md`)
- Run orchestrator → DAG planner: requests plan (evidence: `README.md`)
- Tool registry → DAG planner: supplies catalog (evidence: `README.md`)
- DAG planner → Anthropic client: requests planning (evidence: `src/orchestrator/planner.py`)
- Run orchestrator → Step executor: runs plan (evidence: `README.md`)
- Step executor → Step templating: resolves step data (evidence: `README.md`)
- Step executor → MCP client pool: dispatches tool calls (evidence: `src/orchestrator/executor.py`)
- Step executor → Write approval: gates write steps (evidence: `README.md`)
- Step executor → Failure recovery: recovers failures (evidence: `README.md`)
- Failure recovery → Anthropic client: repairs arguments (evidence: `src/orchestrator/recovery.py`)
- Failure recovery → DAG planner: requests replan (evidence: `README.md`)
- Run orchestrator → Anthropic client: synthesizes answer (evidence: `README.md`)
- Run orchestrator → Task memory: uses task hints (evidence: `README.md`)
- Run orchestrator → Evaluation metrics: records run metrics (evidence: `README.md`)
- Run orchestrator → Cited answer and metrics: returns result (evidence: `README.md`)
- Command-line interface → Run orchestrator: starts runs (evidence: `src/orchestrator/cli.py`)
- Run and replay UI → Web run API: starts and replays runs (evidence: `web/src/App.tsx`)
- Web run API → Run orchestrator: runs goals (evidence: `README.md`)
- Command-line interface → Tracing seam: configures optional tracing (evidence: `src/orchestrator/cli.py`)
- Tracing seam → Trace recorder: records spans (evidence: `README.md`)
- Trace recorder → Trace sanitizer: sanitizes payloads (evidence: `switchboard-trace/src/switchboard_trace/tracer.py`)
- Trace recorder → Trace transport: sends trace events (evidence: `switchboard-trace/src/switchboard_trace/tracer.py`)
- Trace transport → Trace collector: ships traces (evidence: `README.md`)
