Sonic Pi MCP logo

Sonic Pi MCP

by abhishekjairath

Sonic Pi MCP is a Model Context Protocol (MCP) server that enables AI assistants to interact with Sonic Pi via OSC messages. This allows AI tools to programmatically create music and control Sonic Pi.

View on GitHub

Last updated: N/A

What is Sonic Pi MCP?

Sonic Pi MCP is a server that acts as a bridge between AI assistants and Sonic Pi, a live coding music environment. It uses the Model Context Protocol (MCP) to allow AI tools to send commands to Sonic Pi, enabling them to generate music, control synths, and execute code.

How to use Sonic Pi MCP?

To use Sonic Pi MCP, you need to have Bun, Sonic Pi, and an MCP-compatible client installed. First, configure Sonic Pi with the provided OSC handler code. Then, configure your MCP client (like Cursor or Claude) to connect to the Sonic Pi MCP server. Finally, use the available tools (play_note, run_code) to send commands from your AI assistant to Sonic Pi.

Key features of Sonic Pi MCP

  • Play individual notes with customizable synth parameters

  • Execute arbitrary Sonic Pi code

  • Works with any MCP-compatible client

  • Enables AI-driven music creation

Use cases of Sonic Pi MCP

  • AI-assisted music composition

  • Programmatic control of Sonic Pi

  • Integration of Sonic Pi with AI workflows

  • Automated music generation

FAQ from Sonic Pi MCP

Why is there no sound?

Ensure Sonic Pi is running, the OSC handler code is active, and Sonic Pi is listening on port 4560.

What should I do if I get connection errors?

Check if another instance of the server is running, restart Sonic Pi, and ensure no other applications are using port 4560.

What can I do if I get code execution errors?

Check the Sonic Pi log window for error messages, verify the syntax of your Sonic Pi code, and ensure all required synths and samples are available.

How do I install Bun?

Use the command curl -fsSL https://bun.sh/install | bash to install Bun.

How do I test the server during development?

Use the MCP Inspector to send commands to the server and verify its functionality.