# mondweep/youtube-music-mcp-server architecture

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

- Interactive diagram: https://gitdiagram.com/mondweep/youtube-music-mcp-server
- Repository: https://github.com/mondweep/youtube-music-mcp-server

## Overview

1. This repository is intentionally small: it is a single TypeScript MCP server implemented in `src/index.ts`, with only build/runtime scaffolding around it (`package.json`, `tsconfig.json`).

2. The primary architectural role is to act as an AI-tool bridge. An MCP client (for example, Claude Desktop) talks to this server over standard input/output, and the server exposes actions that let the model control YouTube Music playback.

3. The main boundary is the MCP protocol boundary. Everything outside the repo is treated as a client of the server; everything inside the repo translates MCP requests into playback/search actions and returns structured results or errors.

4. The external application boundary is Google Chrome and YouTube Music. The server does not appear to host a web app or a backend API; instead, it automates an already-running browser session to search for and play music in YouTube Music.

5. The feature set described in the README centers on song search and playback by song name and artist name. That suggests the core workflow is: receive a tool request, search YouTube Music, open or focus a result in Chrome, and trigger playback.

6. State is likely minimal and process-local. The repo does not show a database, queue, or persistent storage layer, so the server is best understood as an orchestration layer rather than a data system.

7. Error handling and logging are called out as first-class concerns because MCP servers communicate over stdio and are usually embedded inside another host process. That means failures must be surfaced cleanly back to the MCP client rather than via a separate UI.

8. The runtime stack is TypeScript on Node.js. `tsconfig.json` and the package scripts imply a compile/build step, and the server is run as a Node executable after build, which is how MCP servers are typically integrated with desktop clients.

9. Tooling is centered on development and inspection rather than infrastructure. The README references `npm run build`, `npm run watch`, and the MCP Inspector, indicating a local development workflow with protocol-level debugging.

10. Deployment is client-configured rather than server-hosted. The README shows a Claude Desktop config entry that points directly to the built server binary, so the “deployment” model is launching a local command from the MCP host.

11. One important repo-specific nuance: the README contains two different descriptions, one for a YouTube Music controller and one for a generic notes MCP server. The file tree only shows the YouTube Music server shape, so the generic notes architecture text appears to be stale template content rather than the actual system design.

12. For an architecture diagram, the key boxes are: MCP client, this TypeScript MCP server, Chrome/YouTube Music, and optional local dev/inspection tooling. The data flow is request/response over stdio, with browser automation as the only substantive external action path.

Main entry points: [`src/index.ts`](https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts) (MCP Server), [`package.json`](https://github.com/mondweep/youtube-music-mcp-server/blob/main/package.json) (Build Scripts), [`tsconfig.json`](https://github.com/mondweep/youtube-music-mcp-server/blob/main/tsconfig.json) (TS Config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_stdio_boundary{{"Stdio Boundary<br/>protocol"}}
  node_mcp_server["MCP Server<br/>typescript service<br/>[index.ts]"]
  node_tool_router["Tool Router<br/>request dispatch<br/>[index.ts]"]
  node_music_flow["Search & Play<br/>automation flow<br/>[index.ts]"]
  node_results_errors["Results & Errors<br/>structured output<br/>[index.ts]"]
end

subgraph group_external["External"]
  node_mcp_client["MCP Client<br/>host"]
  node_chrome["Chrome<br/>browser session"]
  node_youtube_music["YouTube Music<br/>web app"]
end

subgraph group_dev["Dev Tooling"]
  node_npm_scripts["Build Scripts<br/>package scripts<br/>[package.json]"]
  node_tsconfig["TS Config<br/>compiler config<br/>[tsconfig.json]"]
  node_inspector["MCP Inspector<br/>debug tool"]
end

node_mcp_client -->|"tool calls"| node_stdio_boundary
node_stdio_boundary -->|"requests"| node_mcp_server
node_mcp_server -->|"dispatch"| node_tool_router
node_tool_router -->|"control"| node_music_flow
node_music_flow -->|"open/focus"| node_chrome
node_chrome -->|"site access"| node_youtube_music
node_music_flow -->|"return"| node_results_errors
node_results_errors -->|"responses"| node_stdio_boundary
node_stdio_boundary -->|"reply"| node_mcp_client
node_npm_scripts -->|"build/run"| node_mcp_server
node_tsconfig -->|"compile"| node_npm_scripts
node_inspector -.->|"debug"| node_stdio_boundary
node_mcp_server -.->|"observe"| node_inspector

click node_mcp_server "https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts"
click node_tool_router "https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts"
click node_music_flow "https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts"
click node_results_errors "https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts"
click node_npm_scripts "https://github.com/mondweep/youtube-music-mcp-server/blob/main/package.json"
click node_tsconfig "https://github.com/mondweep/youtube-music-mcp-server/blob/main/tsconfig.json"

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_stdio_boundary,node_mcp_server,node_tool_router,node_music_flow,node_results_errors toneBlue
class node_mcp_client,node_chrome,node_youtube_music toneAmber
class node_npm_scripts,node_tsconfig,node_inspector toneMint
```

## Components

### Runtime

TypeScript MCP server process and its request handling flow.

- **Stdio Boundary**: protocol · Standard input/output channel carrying MCP requests and responses.
- [MCP Server](https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts): typescript service · Single TypeScript entrypoint that implements the MCP server. · `src/index.ts`
- [Tool Router](https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts): request dispatch · Maps incoming MCP tool calls to music-control actions. · `src/index.ts`
- [Search & Play](https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts): automation flow · Finds tracks by song and artist, then triggers playback in the browser session. · `src/index.ts`
- [Results & Errors](https://github.com/mondweep/youtube-music-mcp-server/blob/main/src/index.ts): structured output · Returns structured tool results and surfaces failures back to the MCP host. · `src/index.ts`

### External

Client host and the browser-based music service it automates.

- **MCP Client**: host · Claude Desktop or another MCP host that sends tool requests over stdio.
- **Chrome**: browser session · Already-running browser session used for automation.
- **YouTube Music**: web app · Target music service searched and controlled by the server.

### Dev Tooling

Local build and inspection setup used during development.

- [Build Scripts](https://github.com/mondweep/youtube-music-mcp-server/blob/main/package.json): package scripts · Build, watch, and run commands defined for the Node.js workflow. · `package.json`
- [TS Config](https://github.com/mondweep/youtube-music-mcp-server/blob/main/tsconfig.json): compiler config · TypeScript compiler settings for the server build. · `tsconfig.json`
- **MCP Inspector**: debug tool · Local protocol inspector used to exercise and debug the server.

## Connections

- MCP Client → Stdio Boundary: tool calls · Client sends MCP requests to the server process.
- Stdio Boundary → MCP Server: requests · The server receives MCP messages from stdio.
- MCP Server → Tool Router: dispatch · Entrypoint routes each request to the appropriate tool handler.
- Tool Router → Search & Play: control · Tool handlers execute the search-and-play workflow.
- Search & Play → Chrome: open/focus · Automation uses Chrome as the execution surface.
- Chrome → YouTube Music: site access · Browser session interacts with YouTube Music.
- Search & Play → Results & Errors: return · Workflow produces structured success or failure output.
- Results & Errors → Stdio Boundary: responses · Responses are written back over the MCP stdio channel.
- Stdio Boundary → MCP Client: reply · Client receives the tool result or error.
- Build Scripts → MCP Server: build/run · Package scripts compile and launch the server.
- TS Config → Build Scripts: compile · TypeScript settings shape the build process.
- MCP Inspector → Stdio Boundary: debug · Inspector exercises the protocol boundary during development.
- MCP Server → MCP Inspector: observe · Server is inspected and tested through MCP tooling.
