# calvinchan999/mcp-toon-wrapper architecture

> Architecture diagram of the GitHub repository calvinchan999/mcp-toon-wrapper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/calvinchan999/mcp-toon-wrapper
- Repository: https://github.com/calvinchan999/mcp-toon-wrapper

## Overview

This small runtime is an stdio MCP proxy: it starts a configured upstream server, forwards tool discovery and calls, and converts JSON-shaped results to TOON text. Tool inputs and ordinary/non-text content pass through; upstream resources and prompts are not proxied. All implementation is in src/main.ts, so the graph shows its distinct runtime responsibilities without build or test machinery.

Main entry points: [`src/main.ts`](https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts) (Proxy server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_proxy["MCP proxy"]
  node_wrapper["Proxy server<br/>[main.ts]"]
  node_tool_dispatch["Tool dispatch<br/>[main.ts]"]
  node_result_conversion["Result conversion<br/>[main.ts]"]
end

node_consumer(("MCP client"))
node_upstream["Upstream MCP server"]
node_toon_encoder["TOON encoder"]

node_consumer -->|"sends stdio requests"| node_wrapper
node_wrapper -->|"connects stdio"| node_upstream
node_wrapper -->|"registers handlers"| node_tool_dispatch
node_tool_dispatch -->|"lists tools"| node_upstream
node_tool_dispatch -->|"calls tools"| node_upstream
node_tool_dispatch -->|"converts results"| node_result_conversion
node_result_conversion -->|"encodes JSON"| node_toon_encoder
node_wrapper -->|"returns tool results"| node_consumer

click node_wrapper "https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts"
click node_tool_dispatch "https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts"
click node_result_conversion "https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts"

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_wrapper,node_tool_dispatch,node_result_conversion,node_consumer toneBlue
class node_upstream toneMint
class node_toon_encoder toneIndigo
```

## Components

### MCP proxy

- [Proxy server](https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts): `src/main.ts`
- [Tool dispatch](https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts): `src/main.ts`
- [Result conversion](https://github.com/calvinchan999/mcp-toon-wrapper/blob/main/src/main.ts): `src/main.ts`

### Other components

- **MCP client**
- **Upstream MCP server**
- **TOON encoder**

## Connections

- MCP client → Proxy server: sends stdio requests (evidence: `src/main.ts`)
- Proxy server → Upstream MCP server: connects stdio (evidence: `src/main.ts`)
- Proxy server → Tool dispatch: registers handlers (evidence: `src/main.ts`)
- Tool dispatch → Upstream MCP server: lists tools (evidence: `src/main.ts`)
- Tool dispatch → Upstream MCP server: calls tools (evidence: `src/main.ts`)
- Tool dispatch → Result conversion: converts results (evidence: `src/main.ts`)
- Result conversion → TOON encoder: encodes JSON (evidence: `src/main.ts`)
- Proxy server → MCP client: returns tool results (evidence: `src/main.ts`)
