Skip to main content

plainsong-mcp

Agents composing — the MCP seam between notation and sound

A Model Context Protocol server for Plainsong, so any agent can read, write and compile music notation — and so several agents can work on one score at the same time without overwriting each other.

plainsong-mcp                 # JSON-RPC over stdio, what most clients expect
plainsong-mcp --http          # loopback HTTP, for remote and multi-agent setups
plainsong-mcp --list-tools    # what it exposes

Install

pip install git+https://github.com/SuperInstance/plainsong-mcp

That brings in the compiler as well. Neither has any other dependency: the protocol, both transports, the session store and the compiler itself are written against the standard library. Python 3.10 or newer.

The compiler comes from PyPI as plainsong>=1.4.0. 1.1.0 is the first release carrying plainsong.features, the per-bar analysis this package re-exports rather than duplicating; 1.4.0 is the first carrying plainsong.runtime.localhost, the loopback check behind the same re-export, so 1.4.0 is now the binding floor. Either way the requirement is real: below it the install succeeds and the import fails.

Point a client at it

For a client that launches servers over stdio, the usual shape is:

{
  "mcpServers": {
    "plainsong": {
      "command": "plainsong-mcp"
    }
  }
}

Then ask it for music. The server exposes 27 tools, which is everything the plainsong CLI can do — write and validate notation, compile to MIDI and audio, transpose, search a library of several thousand pieces, analyse what each listener on a stage actually hears, and probe what the host machine can render.

Many agents, one score

The reason this exists. A session gives every agent a voice of its own:

ensemble_open    name a session, set key, tempo and metre
ensemble_join    claim a voice -- one owner at a time
ensemble_read    the whole current state, in one call
ensemble_write_part   write your voice, against the version you read
ensemble_render  merge the parts and compile
ensemble_log     what everyone has done

Because the parts are disjoint, the common case never conflicts — two agents writing two voices both succeed. When two do collide, the later write is refused and handed the current state to rebase onto, rather than silently overwriting somebody's work. Locks are held only around a read-modify-write of the manifest, never across a call to a model, because a model call takes seconds and a lock held that long is a lock nobody else can get.

Notation is parsed before a part is accepted, so invalid notation never lands. Writes are atomic, the merge is deterministic, and every change appends to a log a joining agent can read to find out what has happened so far.

See docs/ensemble.md for the whole protocol and docs/mcp.md for the tool and resource surface.

Reading a score as features

analyze_features computes sixteen per-bar features — note density, harmonic tension, syncopation, contour direction, register spread and so on — matching the vocabulary fleet-jepa-midi perceives. That lets a bandleader read a written score, and makes a corpus of notation usable as labelled training data.

Where this came from

This began inside the compiler's repository and was extracted once it was clear it had become its own thing rather than a feature of the compiler. Two names had also collided along the way: the analysis of who hears what on a physical stage, and a session shared by several agents, were both called "ensemble". The first is now plainsong stage and lives with the compiler; the second is what this repository means by the word.

The compiler still ships a copy of this server, which is what its plainsong mcp command runs. That copy is being retired — install from here.

Status

The protocol is exercised by a test suite that drives the server with real JSON-RPC: the initialize handshake, tools/list, tools/call, malformed input, unknown methods, notifications, and a tool that raises. Concurrency is tested with threads racing for the same voice, and merge determinism is checked by writing the same parts in three different orders and comparing bytes rather than assuming.

CI runs the suite on Python 3.10 through 3.13 across Linux, macOS and Windows, and then speaks the protocol to the built server over a pipe, so a handshake that regresses fails the build rather than a mock of one.

No third-party MCP client has connected to it yet. The protocol behaviour is verified against the specification rather than against a particular client — strong evidence, and not the same thing. Doing that is the most useful thing anyone could contribute.

90 tests.

Licence

MIT. See LICENSE.

Metadata

Release files for plainsong-mcp 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plainsong-mcp 1.0.1
File Size Uploaded Provenance
plainsong_mcp-1.0.1.tar.gz 50.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for plainsong-mcp 1.0.1
File Interpreter ABI Platform
plainsong_mcp-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.8 kB

Release files / plainsong_mcp-1.0.1.tar.gz

Download URL plainsong_mcp-1.0.1.tar.gz
Size 50.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e5003ab9d967bc93147bb6c224e163974bb8c5272cec9fbc20cc0ad35c1e9a81
BLAKE2b-256 checksum
How to use checksums
c5ee3d3b763483243a195e65680c10997e90e027b179fd883165938d92c55d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / plainsong_mcp-1.0.1-py3-none-any.whl

Download URL plainsong_mcp-1.0.1-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fac6cda1ae79aa79a437e0f79bc48324d0e36f3ec2915efa4607fbd8d3c664e
BLAKE2b-256 checksum
How to use checksums
d50c10d20ef2c8500acd4453de5a5870b02e1c0cd12cdf989e0d1e8e4a15dc68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for plainsong-mcp 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plainsong_mcp-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page