# yinglianchun/voice-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/yinglianchun/voice-mcp
- Repository: https://github.com/yinglianchun/voice-mcp

## Overview

voice-mcp is a Cloudflare Worker offering MCP text-to-speech plus HTTP synthesis and playback interfaces. Its main workflow is an assistant calling speak, provider-specific synthesis producing audio, and the MCP result being made available to the visualizer as the latest voice event. The README documents additional direct-speech, status, history, caption, and player capabilities. The implementation is concentrated in src/index.ts; excerpts are partial, so links rely on the README where code-level call ownership is not visible.

Main entry points: [`src/index.ts`](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts) (TTS dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Client interfaces"]
  node_mcp["MCP speak tool<br/>[index.ts]"]
  node_http["HTTP speak routes<br/>[index.ts]"]
  node_inline["Inline audio player<br/>[index.ts]"]
end

subgraph group_speech["Speech synthesis"]
  node_synth["TTS dispatch<br/>[index.ts]"]
  node_dashscope["DashScope TTS<br/>[index.ts]"]
  node_elevenlabs["ElevenLabs TTS<br/>[index.ts]"]
  node_style["Style and tag handling<br/>[index.ts]"]
end

subgraph group_panel["Playback and events"]
  node_latest[("Latest voice event<br/>[index.ts]")]
  node_events["Latest event route<br/>[index.ts]"]
  node_panelui["Visualizer panel<br/>[index.ts]"]
  node_captions["Captions and download<br/>[index.ts]"]
end

subgraph group_support["Status and history"]
  node_status["Status endpoint<br/>[index.ts]"]
  node_history["History endpoint<br/>[index.ts]"]
  node_elevenhistory["ElevenLabs history"]
end

node_assistant(("AI assistant"))

node_assistant -->|"calls"| node_mcp
node_mcp -->|"requests speech"| node_synth
node_http -->|"requests speech"| node_synth
node_synth -->|"dispatches to"| node_dashscope
node_synth -->|"dispatches to"| node_elevenlabs
node_synth -->|"processes tags"| node_style
node_dashscope -->|"returns audio"| node_inline
node_elevenlabs -->|"returns audio"| node_inline
node_mcp -->|"stores event"| node_latest
node_panelui -->|"polls"| node_events
node_events -->|"reads event"| node_latest
node_panelui -->|"loads status"| node_status
node_panelui -->|"shows and downloads"| node_captions
node_panelui -->|"loads history"| node_history
node_history -->|"fetches item"| node_elevenhistory

click node_mcp "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_http "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_inline "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_synth "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_dashscope "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_elevenlabs "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_style "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_latest "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_events "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_panelui "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_captions "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_status "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts"
click node_history "https://github.com/yinglianchun/voice-mcp/blob/main/src/index.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_mcp,node_http,node_inline toneBlue
class node_synth,node_dashscope,node_elevenlabs,node_style toneAmber
class node_latest,node_events,node_panelui,node_captions toneMint
class node_status,node_history,node_elevenhistory toneRose
class node_assistant toneIndigo
```

## Components

### Client interfaces

- [MCP speak tool](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [HTTP speak routes](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [Inline audio player](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`

### Speech synthesis

- [TTS dispatch](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [DashScope TTS](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [ElevenLabs TTS](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [Style and tag handling](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`

### Playback and events

- [Latest voice event](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [Latest event route](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [Visualizer panel](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [Captions and download](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`

### Status and history

- [Status endpoint](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- [History endpoint](https://github.com/yinglianchun/voice-mcp/blob/main/src/index.ts): `src/index.ts`
- **ElevenLabs history**

### Other components

- **AI assistant**

## Connections

- AI assistant → MCP speak tool: calls (evidence: `README.md`)
- MCP speak tool → TTS dispatch: requests speech (evidence: `README.md`)
- HTTP speak routes → TTS dispatch: requests speech (evidence: `README.md`)
- TTS dispatch → DashScope TTS: dispatches to (evidence: `README.md`)
- TTS dispatch → ElevenLabs TTS: dispatches to (evidence: `README.md`)
- TTS dispatch → Style and tag handling: processes tags (evidence: `README.md`)
- DashScope TTS → Inline audio player: returns audio (evidence: `README.md`)
- ElevenLabs TTS → Inline audio player: returns audio (evidence: `README.md`)
- MCP speak tool → Latest voice event: stores event (evidence: `README.md`)
- Visualizer panel → Latest event route: polls (evidence: `src/index.ts`)
- Latest event route → Latest voice event: reads event (evidence: `src/index.ts`)
- Visualizer panel → Status endpoint: loads status (evidence: `src/index.ts`)
- Visualizer panel → Captions and download: shows and downloads (evidence: `README.md`)
- Visualizer panel → History endpoint: loads history (evidence: `README.md`)
- History endpoint → ElevenLabs history: fetches item (evidence: `README.md`)
