Labsco
abhishekjairath logo

Sonic Pi MCP

β˜… 14

from abhishekjairath

Interact with Sonic Pi, the live coding music synth, using OSC messages.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

Sonic Pi MCP

Model Context Protocol (MCP) server for Sonic Pi. Describe music in natural language in your LLM client; the model generates Sonic Pi code and this server sends it over OSC. Use the included queue runner in Sonic Pi for crossfades between segments.

Features

  • queue_segment β€” send the next full musical segment (named live_loops, use_bpm, etc.).
  • run_code β€” same as queue_segment (compatibility).
  • stop_all β€” hard stop via OSC (/stop-all-jobs), like Sonic Pi’s Stop.
  • play_note β€” quick test note.
  • Resource β€” DJ session craft, vocabulary, and tool usage (read from the MCP client).
  • Prompt next_performance_segment β€” help frame the next block for longer sets.
  • Env β€” OSC_HOST, OSC_PORT, OSC_CODE_PATH, OSC_STOP_ALL_PATH.

Environment variables

VariableDefaultMeaning
OSC_HOST127.0.0.1Sonic Pi host
OSC_PORT4560Sonic Pi OSC port
OSC_CODE_PATH/run-codeOSC path for code (must match your Sonic Pi buffer)
OSC_STOP_ALL_PATH/stop-all-jobsHard stop path

Allow incoming OSC in Sonic Pi if you connect from another machine; set OSC_HOST accordingly.

Development

git clone https://github.com/abhishekjairath/sonic-pi-mcp.git
cd sonic-pi-mcp
bun install   # or npm install
bun run build
bun run dev

OSC smoke test (Sonic Pi + runner running):

bun run test

MCP Inspector

npx @modelcontextprotocol/inspector

Use node with argument bin/cli.mjs and this directory as the working directory (after bun run build).