# bruceblay/mcp-2000 architecture

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

- Interactive diagram: https://gitdiagram.com/bruceblay/mcp-2000
- Repository: https://github.com/bruceblay/mcp-2000

## Overview

#### Purpose and entry points
MCP 2000 is a browser-based MPC-style sampler: users generate or load audio, assign it to a 4×4 pad grid, perform, edit, sequence, mix, and apply effects. The React/Vite client enters through `index.html`, `src/main.tsx`, and `src/App.tsx`. Server functionality is exposed as Vercel-style API handlers under `api/`.

#### Client composition and workspace model
`src/App.tsx` is the application shell coordinating distinct production workspaces rather than separate pages:
- generation and prompt-driven asset intake: `src/components/GenerationPanel.tsx`
- pad/performance and sequencing: `src/components/SequenceWorkspace.tsx`
- mixing and effect control: `src/components/MixerWorkspace.tsx`, `src/components/EffectsWorkspace.tsx`
- conversational generation/control interface: `src/components/ChatPanel.tsx`

Shared client state, pad/sample domain types, and initial project setup are centralized in `src/types.ts`, `src/state-init.ts`, and `src/constants.ts`.

#### Audio asset and playback pipeline
The browser owns interactive audio behavior and sample editing utilities. Audio-oriented transformations and kit construction are represented by `src/audio-utils.ts`, `src/chromatic-utils.ts`, and `src/kit-generation.ts`. Bundled local kits and mock audio make the client usable without generated assets, including `public/acoustic-guitar/`, `public/ice-kit/`, and `public/mock-samples/`.

This creates a boundary between low-latency Web Audio/client playback and remote generation/storage: generated files are received from APIs, then become client-side pad/project assets.

#### Sequencing, snapshots, and sharing
Performance/project state is structured for persistence or transport through `src/project-snapshot.ts` and `src/use-share.ts`. The sharing API surface includes creation and retrieval-oriented endpoints at `api/share.ts`, `api/shares/prompts.ts`, and `api/shares/recent.ts`. These routes form the boundary between an in-memory browser project and durable/shared project metadata.

A scheduled retention path, `api/cron/cleanup-shares.ts`, indicates shares are lifecycle-managed rather than permanent by default.

#### Effects architecture and routing
Effects are modular audio processors under `src/effects/`, with a common public surface in `src/effects/index.ts` and contracts in `src/effects/types.ts`. Routing/control logic is separated in `src/effects-routing.ts`. The available processors span core production needs—e.g., `src/effects/delay.ts`, `src/effects/compressor.ts`, and `src/effects/loopchop.ts`—allowing workspace UI to configure chains without embedding processor implementations.

#### Generation and external-service boundary
Prompt generation is served by `api/generate-kit.ts`; chat-oriented requests use `api/chat.ts`. ElevenLabs integration/availability is explicitly represented by `api/elevenlabs-status.ts` and documented in `docs/elevenlabs-feature-notes.md`. The client should treat these APIs as asynchronous asset-generation boundaries, not as part of its realtime playback path.

#### Infrastructure and operational concerns
The repository targets Vercel deployment, configured by `vercel.json`, with environment requirements indicated by `.env.example`. Backend shared infrastructure covers database access, Google Cloud Storage asset handling, and request throttling in `api/_shared/db.ts`, `api/_shared/gcs.ts`, and `api/_shared/rate-limit.ts`. GCS setup and browser-access concerns are documented in `docs/gcp-setup.md` and `docs/gcs-cors.json`; generated audio storage should therefore be considered external and URL/object based rather than bundled with the frontend.

Main entry points: [`src/App.tsx`](https://github.com/bruceblay/mcp-2000/blob/main/src/App.tsx) (Application shell), [`src/components/SequenceWorkspace.tsx`](https://github.com/bruceblay/mcp-2000/blob/main/src/components/SequenceWorkspace.tsx) (Production workspaces), [`api/generate-kit.ts`](https://github.com/bruceblay/mcp-2000/blob/main/api/generate-kit.ts) (Kit generation API), [`src/types.ts`](https://github.com/bruceblay/mcp-2000/blob/main/src/types.ts) (Pad and project state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_entry["Vite entry<br/>client entry<br/>[index.html]"]
  node_main["React bootstrap<br/>client bootstrap<br/>[main.tsx]"]
  node_app["Application shell<br/>workspace coordinator<br/>[App.tsx]"]
  node_workspaces["Production workspaces<br/>workspace UI"]
  node_generation["Generation panel<br/>asset intake UI"]
  node_project_state["Pad and project state<br/>client domain state<br/>[types.ts]"]
  node_snapshot_share["Project snapshot and share<br/>project transport"]
  node_local_kits["Bundled kits<br/>static sample assets<br/>[eigth.wav]"]
end

subgraph group_audio["Audio engine"]
  node_audio_tools["Sample and kit tools<br/>audio utilities<br/>[audio-utils.ts]"]
  node_playback["Web Audio playback<br/>realtime audio runtime"]
  node_effects_routing["Effects routing<br/>audio routing<br/>[effects-routing.ts]"]
  node_effects["Effects processors<br/>processor modules<br/>[index.ts]"]
end

subgraph group_api["Vercel API"]
  node_generate_api{{"Kit generation API<br/>API handler<br/>[generate-kit.ts]"}}
  node_chat_api{{"Chat API<br/>API handler<br/>[chat.ts]"}}
  node_share_api{{"Share API<br/>API handler<br/>[share.ts]"}}
  node_cleanup["Share retention cleanup<br/>scheduled handler<br/>[cleanup-shares.ts]"]
  node_rate_limit["Request throttling<br/>API guard<br/>[rate-limit.ts]"]
end

subgraph group_infra["External infrastructure"]
  node_db[("Share metadata database<br/>database access<br/>[db.ts]")]
  node_gcs[("Generated audio storage<br/>object storage access<br/>[gcs.ts]")]
  node_deployment["Vercel deployment<br/>hosting configuration<br/>[vercel.json]"]
end

node_entry --> node_main
node_main --> node_app
node_app -->|"renders"| node_workspaces
node_app -->|"renders"| node_generation
node_app -->|"coordinates"| node_project_state
node_workspaces -->|"performs and sequences"| node_playback
node_workspaces -->|"configures"| node_effects_routing
node_effects_routing -->|"builds chains from"| node_effects
node_effects -->|"processes audio"| node_playback
node_generation -->|"requests kit generation"| node_generate_api
node_workspaces -->|"chat requests"| node_chat_api
node_generate_api -->|"stores generated audio"| node_gcs
node_gcs -->|"audio URLs become assets"| node_audio_tools
node_audio_tools -->|"creates pad assets"| node_project_state
node_local_kits -->|"loads local samples"| node_audio_tools
node_project_state -->|"serializes"| node_snapshot_share
node_snapshot_share -->|"creates or retrieves shares"| node_share_api
node_share_api -->|"persists metadata"| node_db
node_cleanup -->|"expires shares"| node_db
node_generate_api -.->|"throttled by"| node_rate_limit
node_chat_api -.->|"throttled by"| node_rate_limit
node_deployment -.->|"hosts"| node_generate_api
node_deployment -.->|"hosts"| node_share_api

click node_entry "https://github.com/bruceblay/mcp-2000/blob/main/index.html"
click node_main "https://github.com/bruceblay/mcp-2000/blob/main/src/main.tsx"
click node_app "https://github.com/bruceblay/mcp-2000/blob/main/src/App.tsx"
click node_workspaces "https://github.com/bruceblay/mcp-2000/blob/main/src/components/SequenceWorkspace.tsx"
click node_generation "https://github.com/bruceblay/mcp-2000/blob/main/src/components/GenerationPanel.tsx"
click node_project_state "https://github.com/bruceblay/mcp-2000/blob/main/src/types.ts"
click node_audio_tools "https://github.com/bruceblay/mcp-2000/blob/main/src/audio-utils.ts"
click node_effects_routing "https://github.com/bruceblay/mcp-2000/blob/main/src/effects-routing.ts"
click node_effects "https://github.com/bruceblay/mcp-2000/blob/main/src/effects/index.ts"
click node_snapshot_share "https://github.com/bruceblay/mcp-2000/blob/main/src/project-snapshot.ts"
click node_local_kits "https://github.com/bruceblay/mcp-2000/blob/main/public/acoustic-guitar/eigth.wav"
click node_generate_api "https://github.com/bruceblay/mcp-2000/blob/main/api/generate-kit.ts"
click node_chat_api "https://github.com/bruceblay/mcp-2000/blob/main/api/chat.ts"
click node_share_api "https://github.com/bruceblay/mcp-2000/blob/main/api/share.ts"
click node_cleanup "https://github.com/bruceblay/mcp-2000/blob/main/api/cron/cleanup-shares.ts"
click node_db "https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/db.ts"
click node_gcs "https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/gcs.ts"
click node_rate_limit "https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/rate-limit.ts"
click node_deployment "https://github.com/bruceblay/mcp-2000/blob/main/vercel.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_entry,node_main,node_app,node_workspaces,node_generation,node_project_state,node_snapshot_share,node_local_kits toneBlue
class node_audio_tools,node_playback,node_effects_routing,node_effects toneAmber
class node_generate_api,node_chat_api,node_share_api,node_cleanup,node_rate_limit toneMint
class node_db,node_gcs,node_deployment toneRose
```

## Components

### Browser client

React/Vite sampler and realtime audio runtime.

- [Vite entry](https://github.com/bruceblay/mcp-2000/blob/main/index.html): client entry · `index.html`
- [React bootstrap](https://github.com/bruceblay/mcp-2000/blob/main/src/main.tsx): client bootstrap · `src/main.tsx`
- [Application shell](https://github.com/bruceblay/mcp-2000/blob/main/src/App.tsx): workspace coordinator · Coordinates the production workspaces and browser project state. · `src/App.tsx`
- [Production workspaces](https://github.com/bruceblay/mcp-2000/blob/main/src/components/SequenceWorkspace.tsx): workspace UI · Generation, sequencing, mixing, effects, and chat interfaces. · `src/components/SequenceWorkspace.tsx`
- [Generation panel](https://github.com/bruceblay/mcp-2000/blob/main/src/components/GenerationPanel.tsx): asset intake UI · `src/components/GenerationPanel.tsx`
- [Pad and project state](https://github.com/bruceblay/mcp-2000/blob/main/src/types.ts): client domain state · Pad/sample types and initial project setup. · `src/types.ts`
- [Project snapshot and share](https://github.com/bruceblay/mcp-2000/blob/main/src/project-snapshot.ts): project transport · Serializes browser project state for persistence and sharing. · `src/project-snapshot.ts`
- [Bundled kits](https://github.com/bruceblay/mcp-2000/blob/main/public/acoustic-guitar/eigth.wav): static sample assets · Local kits and mock samples keep the client usable offline. · `public/acoustic-guitar/eigth.wav`

### Audio engine

Client-side sample, playback, and effects pipeline.

- [Sample and kit tools](https://github.com/bruceblay/mcp-2000/blob/main/src/audio-utils.ts): audio utilities · Transforms audio and constructs kits in the browser. · `src/audio-utils.ts`
- **Web Audio playback**: realtime audio runtime · Owns low-latency pad performance and playback.
- [Effects routing](https://github.com/bruceblay/mcp-2000/blob/main/src/effects-routing.ts): audio routing · `src/effects-routing.ts`
- [Effects processors](https://github.com/bruceblay/mcp-2000/blob/main/src/effects/index.ts): processor modules · Modular delay, compression, loopchop, and related processors. · `src/effects/index.ts`

### Vercel API

Generation, sharing, and operational handlers.

- [Kit generation API](https://github.com/bruceblay/mcp-2000/blob/main/api/generate-kit.ts): API handler · Asynchronous prompt-driven generated-audio boundary. · `api/generate-kit.ts`
- [Chat API](https://github.com/bruceblay/mcp-2000/blob/main/api/chat.ts): API handler · `api/chat.ts`
- [Share API](https://github.com/bruceblay/mcp-2000/blob/main/api/share.ts): API handler · Creates and retrieves shared project metadata. · `api/share.ts`
- [Share retention cleanup](https://github.com/bruceblay/mcp-2000/blob/main/api/cron/cleanup-shares.ts): scheduled handler · Removes lifecycle-managed shares. · `api/cron/cleanup-shares.ts`
- [Request throttling](https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/rate-limit.ts): API guard · `api/_shared/rate-limit.ts`

### External infrastructure

Durable metadata and generated-audio storage.

- [Share metadata database](https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/db.ts): database access · `api/_shared/db.ts`
- [Generated audio storage](https://github.com/bruceblay/mcp-2000/blob/main/api/_shared/gcs.ts): object storage access · GCS-hosted generated audio is accessed by URL or object reference. · `api/_shared/gcs.ts`
- [Vercel deployment](https://github.com/bruceblay/mcp-2000/blob/main/vercel.json): hosting configuration · `vercel.json`

## Connections

- Vite entry → React bootstrap
- React bootstrap → Application shell
- Application shell → Production workspaces: renders
- Application shell → Generation panel: renders
- Application shell → Pad and project state: coordinates
- Production workspaces → Web Audio playback: performs and sequences
- Production workspaces → Effects routing: configures
- Effects routing → Effects processors: builds chains from
- Effects processors → Web Audio playback: processes audio
- Generation panel → Kit generation API: requests kit generation
- Production workspaces → Chat API: chat requests
- Kit generation API → Generated audio storage: stores generated audio
- Generated audio storage → Sample and kit tools: audio URLs become assets
- Sample and kit tools → Pad and project state: creates pad assets
- Bundled kits → Sample and kit tools: loads local samples
- Pad and project state → Project snapshot and share: serializes
- Project snapshot and share → Share API: creates or retrieves shares
- Share API → Share metadata database: persists metadata
- Share retention cleanup → Share metadata database: expires shares
- Kit generation API → Request throttling: throttled by
- Chat API → Request throttling: throttled by
- Vercel deployment → Kit generation API: hosts
- Vercel deployment → Share API: hosts
