Inspiration
Most AI music tools have the same shape: prompt a remote model, wait, pay for a generation, receive an opaque waveform.
Chiptunes has no model and no server.
Its deterministic Game Boy composer already runs entirely inside the browser. A song takes about 1.6 milliseconds to generate. Nothing is uploaded. There is no API key, account, quota, or per-generation cost.
WebMCP turns that implementation detail into an agent capability: if an agent can open the page, it can compose music.
What it does
Chiptunes exposes 15 WebMCP tools for composing music and controlling the live instrument.
Ask for “a gloomy 40-second dungeon theme with no drums” and the agent can:
- compose it locally in the tab
- generate 12 complete alternatives in ~70 ms
- analyze their harmony, melodic direction, density, and resolution
- choose between them
- play them through the interface you're watching
- make the current song happier, darker, faster, or slower
- export the result as a share link, MIDI, or a 32 KB
.gbROM that boots on a real Game Boy
The agent doesn't need to hear the music to reason about it. chiptunes_analyse measures musical properties such as consonance, phrase direction, chord agreement, activity, and tonic resolution.
And because WebMCP calls the same functions as the UI, the agent and human are operating the same instrument. When the agent changes something, the user hears it immediately and sees the action announced on screen.
How I built it
The WebMCP layer lives in src/webmcp.js and registers 15 tools against the available model-context surfaces.
The hardest problem was timing. Some agents enumerate tools before the application bundle runs, so Chiptunes registers tool descriptors before hydration, reconnects them when the application loads, and handles model contexts injected later.
The page also adapts when an agent is present. The explainer gets out of the way and leaves the instrument front and center because the agent browser already provides the conversation.
Automated tests inject a spec-shaped model context before any page JavaScript executes, invoke every tool, and verify the real application responds.
Challenges
The most dangerous bugs were cases where the implementation and its test shared the same wrong assumption.
I initially registered against the wrong model-context surface. My test used the same surface, so everything passed while a real WebMCP agent would have discovered zero tools.
The same thing happened musically. My composer and analyzer shared an incorrect definition of consonance, so each confidently verified the other.
Both are now tested against something external: the WebMCP API shape for integration, and measurable musical behavior for composition.
Accomplishments I'm proud of
12 songs in ~70 ms. WebMCP lets an agent explore a possibility space instead of spending a costly generation on one answer.
The music is measurable. Across test songs, happy vs. sad compositions separate strongly on pitch material, tempo, phrase direction, and consonance. A classifier using the writing itself — excluding the easy signals of mode and tempo — identifies the intended mood 93% of the time.
The output can become a real cartridge. The same browser session can produce a 32 KB ROM that boots on original Game Boy hardware.
It fails explicitly. Ask for vocals, reverb, a waltz, or an unsupported mode and the tool explains the limitation rather than pretending it succeeded.
What I learned
WebMCP isn't just “an API without HTTP.”
Its more interesting property is that the capability, agent, and human can inhabit the same place.
Here, the agent isn't requesting music from a service and describing the result afterward. It's operating an instrument the user is listening to — generating, measuring, comparing, changing, and handing control back in real time.
And because the computation was already in the webpage, WebMCP gives the agent all of that without adding a backend at all.
What's next
Next is live adaptive composition: an agent changing a cue while it plays, so a game developer can hear a boss theme escalate instead of generating separate takes.
After that: agent-controlled loop points and adaptive game-music structures built from the composer's existing knowledge of bars and phrases.
Log in or sign up for Devpost to join the conversation.