Claude steers live music by writing Strudel code played in a browser page
Runs on your machine from its package; the steps are below.
Not assessed yet.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y moontide-mcp
MCP client config
{
"mcpServers": {
"moontide": {
"command": "npx",
"args": [
"-y",
"moontide-mcp"
]
}
}
}The moon guides the tide.
A hobby project: Claude plays live music for you. Describe a mood, a theme or an idea, and Claude writes Strudel code that plays in your browser and changes without ever stopping.
Moontide is a personal project. Most of the code, research and documentation was written by an AI coding assistant working under my direction. I set the goals, listened to every change, tried it on my own instruments, judged the results by ear, and made the decisions. I am responsible for what is here, errors included.
Curiosity. I wanted to see how far an AI assistant can go at making real music, not a technical demo, when it is given a good instrument. Strudel is that instrument: a live-coding language where a change lands on the next cycle, with no cut, and where the music is plain text that both of us can read.
So Claude writes the code, and the code stays on screen while it plays. You can watch it, edit it by hand, go back to any earlier version, or point at something in the page and ask for a change.
Moontide does not start from scratch. The music engine is Strudel, the JavaScript port of TidalCycles by Felix Roos, Alex McLean and the Strudel contributors. Moontide is the bridge between Claude and a Strudel page.
you ──talk──► Claude ──MCP (stdio)──► Moontide ──WebSocket (localhost)──► browser page
│ Strudel plays
└─ history file on your disk the code, sound
and Web MIDI out
The short version, for someone who already has Node 22 or later and Claude Code:
claude mcp add --scope user moontide -- npx -y moontide-mcp
Then start a new Claude session and ask for music. The steps below explain each part.
In a terminal, run:
node --version
It must print v22 or higher. If Node is missing or older, install the LTS version from
nodejs.org. On macOS with Homebrew, brew install node works too. Open a
new terminal afterwards and check again.
Install Claude Code or Claude Desktop from claude.com and sign in once. Moontide works with either; Claude Code is the one tried most.
In a terminal, run:
claude mcp add --scope user moontide -- npx -y moontide-mcp
With --scope user, Moontide is available in every folder. The default scope (local) works
only in the folder where you ran the command, and the scope project shares it through a
.mcp.json file.
Keep the name moontide. The page-request commands below use it.
Check the install with:
claude mcp get moontide
The same line is meant for Linux. It is untested there.
Open Settings, then Developer, then Edit Config. The file is:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonAdd Moontide to it:
{
"mcpServers": {
"moontide": {
"command": "npx",
"args": ["-y", "moontide-mcp"]
}
}
}
If the file already has an mcpServers block, add the moontide entry inside it. Quit Claude
Desktop fully and start it again. Claude Desktop has no Linux version.
From PowerShell or Command Prompt (not Git Bash), run:
claude mcp add --scope user moontide -- cmd /c npx -y moontide-mcp
Check it with claude mcp get moontide. The command must read cmd with /c npx -y moontide-mcp. If it shows C:/ instead of /c, edit the moontide entry in the .claude.json file of your user folder so it reads "command": "cmd", "args": ["/c", "npx", "-y", "moontide-mcp"].
This form comes from community reports. It has not been tried here.
To run Moontide from a copy of this repository instead of npm:
git clone https://github.com/konni-arcadia/moontide.git
cd moontide
npm ci
npm run build
Then add it with the full path of dist/index.js, written here as <folder>:
claude mcp add --scope user moontide -- node <folder>/dist/index.js
npm test runs the test suite. The real-browser checks (npm run probe:page) need Chrome.
/mcp__moontide__start does the same.Set MOONTIDE_NO_BROWSER=1 in the environment and starting Moontide opens no tab. Open the
address from Claude's reply yourself.
To see the version that runs, run npx -y moontide-mcp --version. Releases are listed in
CHANGELOG.md. npx can keep
using a copy it already downloaded; to move to the newest release, add Moontide again with
@latest:
claude mcp remove moontide --scope user
claude mcp add --scope user moontide -- npx -y moontide-mcp@latest
claude mcp remove moontide --scope user
In Claude Desktop, remove the moontide entry from the config file and restart it. Moontide
keeps its history and settings in your data folder (see History); delete that folder if you
want them gone too.
Moontide can play MIDI instruments from the code through Web MIDI. It ships ready models for the Roland MT-32 and SC-55. You can describe your own instruments and models, add sound catalogs and send MIDI clock. The setup is in docs/midi.md.
In the Code tab of the Claude app, ask Claude to turn page requests on or off. Claude calls
Moontide's set_page_requests tool. In Claude Code in a terminal, type
/mcp__moontide__page-requests-on to make them live or /mcp__moontide__page-requests-off to
make them wait. Live, Claude starts a monitor, which lasts at most 30 minutes and is started
again when a tool reply asks. Waiting, tool replies stop offering to start it until page
requests are turned on again. Page requests need an open page, so start Moontide first. These
names assume the server was added as moontide.
Claude Code asks permission before it starts the monitor for page requests, because it runs a
command. You can approve it each time. If you want a narrower permission rule instead, see the
permissions section of the Claude Code documentation. Do not allow broad node commands.
Claude gets a factual reference of the exact Strudel version the page runs, through the
get_strudel_reference tool (also offered as MCP resources), covering eight topics: Strudel
vs TidalCycles, mini-notation, pattern functions, effects and sound controls, the sound
palette, music theory in Strudel, transitions, and MIDI output. It holds facts only: what
exists and how to write it. Moontide ships no mood vocabulary, no style material and no model
pieces; Claude translates your words with its own knowledge of music theory, then tells you in
one line what it chose. Ask for a surprise in your own words: there is no menu command for it.
Set a frame for the session, for example gradual changes, and Claude follows it for every
change until you lift it. Say what matters to you (a melody, a rhythm) and Claude keeps it,
and asks before a full rewrite.
Claude can change a few lines of a long piece without sending it again, through the
edit_code tool; a change that waits for its bar is edited, and your hand edits are kept.
The code can say which harmony it means with one top-level line, for example
const harmony = 'C:minor', placed above the patterns. It plays nothing and is never a
track. The Jam view then shows two lines, "Declared:" and "Heard:", side by side.
Every version that plays is kept: Claude's own changes and your Ctrl+Enter edits, each with its time, who made it and a short label. Failed code and stops are not versions.
Ask Claude things like "go back to the previous version", "the one from 3 changes ago", "the
one with the bass", or "keep this one, call it Take two", and "list my favorites". The
Session drawer shows the number of the version that is playing, in its Last change card, for
example v42.
The history file lives in your OS's per-user data folder:
~/Library/Application Support/moontide/history.jsonl$XDG_DATA_HOME/moontide/history.jsonl, or ~/.local/share/moontide/history.jsonl%APPDATA%\moontide\history.jsonlSet MOONTIDE_DATA_DIR to use another folder. The history is one text file with one entry
per line, and survives the end of the Claude session.
The history keeps the last 1000 versions; older ones are dropped in batches and Claude is told. Favorites are never dropped.
If a line of the file cannot be read, Claude is told which lines; they stay in the file untouched. If the file cannot be read or written at all, the music keeps working and Claude is told.
Run one Moontide at a time with the same history file. Two at once can give two versions the same number.
"Failed to connect" right after installing. The first start downloads the package, and Claude Code gives up after 30 seconds. Wait a little and check again with claude mcp list. If it keeps failing, start Claude Code with a longer limit: MCP_TIMEOUT=60000 claude. In PowerShell, use $env:MCP_TIMEOUT = "60000"; claude.
Moontide is missing in another folder. It was added without --scope user. Add it again with the Install line.
The page did not open. Claude's replies name its address. Open it yourself, or ask Claude to start Moontide again: it gives the address and opens a new tab when no page is connected.
Several Moontide tabs. Each Claude session that started Moontide has its own page and port. The tab title says "Moontide · · ", with the folder that session runs in, and the Session drawer shows the same. Ask Claude which tab is its own: it answers with the address, the port and the tab title.
No sound. Click once in the page. Check that the browser tab is not muted, and keep the page open.
Claude Desktop does not find npx. Put the full path in "command": the path printed by which npx on macOS or where npx on Windows, written here as <full path printed by which npx>. This is common advice and has not been tried here. The Claude Desktop logs are in ~/Library/Logs/Claude on macOS and %APPDATA%\Claude\logs on Windows.
MIDI says to use Chrome or Edge. Web MIDI is missing in that browser.
Early and personal. It runs on one setup: a Mac, Chrome, Claude Code and Claude Desktop, and, for MIDI, a Roland SC-55, the Munt MT-32 emulator and a Roland JUPITER-Xm. It has not been tried anywhere else. The test suite runs on Windows, Linux and macOS in CI, but nobody has played music on Windows or Linux yet. There are known bugs. Feedback is welcome, but support is not something I can promise.
Known limits:
@strudel/repl 1.3.0 and acorn 8.18.0 from unpkg, pinned to exact versions with integrity hashes.Bug reports and ideas are welcome as issues (use the bug form). How pull requests are handled is in CONTRIBUTING.md.
Security problems go through a private report, never a public issue. See https://github.com/konni-arcadia/moontide/security/policy.
This builds on other people's work:
Moontide plays Strudel, which is under AGPL-3.0-or-later. Moontide uses the same license. It loads Strudel from unpkg at run time and does not ship it. The license text is in LICENSE. Moontide is not affiliated with, or endorsed by, the Strudel or TidalCycles projects, or Anthropic.
Konni — built with an AI coding assistant.