How bruceblay/mcp-2000 works
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: App.tsx Application shell · SequenceWorkspace.tsx Production workspaces · generate-kit.ts Kit generation API · types.ts Pad and project state
Components 20
Browser client
React/Vite sampler and realtime audio runtime.
- Vite entry
index.html - React bootstrap
src/main.tsx - Application shell · Coordinates the production workspaces and browser project state.
src/App.tsx - Production workspaces · Generation, sequencing, mixing, effects, and chat interfaces.
src/components/SequenceWorkspace.tsx - Generation panel
src/components/GenerationPanel.tsx - Pad and project state · Pad/sample types and initial project setup.
src/types.ts - Project snapshot and share · Serializes browser project state for persistence and sharing.
src/project-snapshot.ts - Bundled kits · 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 · Transforms audio and constructs kits in the browser.
src/audio-utils.ts - Web Audio playback · Owns low-latency pad performance and playback.
- Effects routing
src/effects-routing.ts - Effects processors · Modular delay, compression, loopchop, and related processors.
src/effects/index.ts
Vercel API
Generation, sharing, and operational handlers.
- Kit generation API · Asynchronous prompt-driven generated-audio boundary.
api/generate-kit.ts - Chat API
api/chat.ts - Share API · Creates and retrieves shared project metadata.
api/share.ts - Share retention cleanup · Removes lifecycle-managed shares.
api/cron/cleanup-shares.ts - Request throttling
api/_shared/rate-limit.ts
External infrastructure
Durable metadata and generated-audio storage.
- Share metadata database
api/_shared/db.ts - Generated audio storage · GCS-hosted generated audio is accessed by URL or object reference.
api/_shared/gcs.ts - Vercel deployment
vercel.json
Connections 23
- 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