Sonic Pi MCP logo

Sonic Pi MCP

Community
abhishekjairath

Model Context Protocol (MCP) server for controlling Sonic Pi through AI assistants

Publisherabhishekjairath
Repositorysonic-pi-mcp
LanguageTypeScript
Forks
5
Stars
18
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Sonic Pi MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    18 stars and 5 forks from the linked repository.

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.

Prerequisites

  • Sonic Pi v4.x
  • Node.js 18+ (npx / node)
  • An MCP-capable client (Cursor, Claude Desktop, VS Code with MCP, etc.)

Optional: Bun for local development (bun run dev).

One-time Sonic Pi setup (queue runner)

  1. Open Sonic Pi.
  2. Copy sonic-pi-queue.rb into a buffer.
  3. Press Run and leave it running.

The buffer listens on the default OSC port and crossfades between segments sent by the MCP.

Install the MCP server

bash
npx -y sonic-pi-mcp

Point your client at this command over stdio (see below).

Cursor

Use ~/.cursor/mcp.json and/or .cursor/mcp.json in a project:

json
{
  "mcpServers": {
    "sonic_pi_mcp": {
      "command": "npx",
      "args": ["-y", "sonic-pi-mcp"]
    }
  }
}

Local clone (after npm install or bun install and bun run build):

json
{
  "mcpServers": {
    "sonic_pi_mcp": {
      "command": "node",
      "args": ["/absolute/path/to/sonic-pi-mcp/bin/cli.mjs"]
    }
  }
}

Bun without building — some clients ignore cwd; use an absolute path to src/server.ts, or use the launcher:

json
{
  "mcpServers": {
    "sonic_pi_mcp": {
      "command": "/absolute/path/to/sonic-pi-mcp/bin/mcp-dev.sh",
      "args": []
    }
  }
}

Run chmod +x bin/mcp-dev.sh once. The script changes into the repo and runs bun run src/server.ts.

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json (paths differ on Windows):

json
{
  "mcpServers": {
    "sonic_pi_mcp": {
      "command": "npx",
      "args": ["-y", "sonic-pi-mcp"]
    }
  }
}

For a local clone, prefer bin/mcp-dev.sh (see above) if you see Module not found "src/server.ts" or spawn bunx ENOENT. Remove and re-add the MCP in the app if an old definition is cached.

VS Code

Configure your MCP extension to run npx with -y and sonic-pi-mcp, stdio transport, per the extension’s docs.

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

bash
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):

bash
bun run test

MCP Inspector

bash
npx @modelcontextprotocol/inspector

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

Troubleshooting

  • No sound — Sonic Pi open? Queue buffer running? Port 4560 reachable?
  • Nothing happens — OSC enabled in Sonic Pi; OSC_HOST / OSC_PORT match.
  • Layers pile up — Use queue_segment with named live_loops; use stop_all only for a full reset.
  • Module not found "src/server.ts" (Claude) — Use bin/mcp-dev.sh as command with empty args, or absolute paths; don’t rely on cwd alone.
  • resources/list / prompts/list → Method not found — You’re on an older build that only exposed tools. Reinstall/restart the MCP from this repo or npm so resources and prompts are registered.
  • Ruby errors in Sonic Pi log — The generated code failed to parse or run; fix the snippet (brackets, samples, syntax) and send again. The queue runner prints a code snippet on failure.

License

MIT — see LICENSE.

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "abhishekjairath-sonic-pi-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use Sonic Pi MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Sonic Pi MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Sonic Pi MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Sonic Pi MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "abhishekjairath-sonic-pi-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "sonic-pi-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Sonic Pi MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Sonic Pi MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Sonic Pi MCP to help me with this task?
Sonic Pi MCP
Sure. I read it.
Here is what I found using Sonic Pi MCP.

Frequently asked questions

What is the Sonic Pi MCP MCP server used for?

Sonic Pi MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Sonic Pi MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Sonic Pi MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Sonic Pi MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Sonic Pi MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Sonic Pi MCP MCP to TypingMind?

Sonic Pi MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Sonic Pi MCP MCP provide in TypingMind?

Sonic Pi MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Sonic Pi MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Sonic Pi MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇