musescore-mcp

v1.3.1
io.github.chrischall/musescore-mcp Checked 10 hours ago Published 24 days ago

MuseScore for Claude — search sheet music and read score metadata via your signed-in browser

MCP server for MuseScore — search sheet music and read score metadata from Claude. MuseScore has no public API and sits behind Cloudflare, so every request rides your signed-in musescore.com browser tab via the ContextMint Bridge browser extension (built on fetchproxy) — Cloudflare sees a real browser session, not a Node process. The server-rendered HTML has no result cards — MuseScore hydrates them client-side from an entity-encoded JSON store embedded in the page (its analogue of Next.js NEXT_DATA). The parsers recover that JSON and read the score objects directly.

Summary extracted from the README.

musescore-mcp

CI npm license

MCP server for MuseScore — search sheet music and read score metadata from Claude. MuseScore has no public API and sits behind Cloudflare, so every request rides your signed-in musescore.com browser tab via the ContextMint Bridge browser extension (built on fetchproxy) — Cloudflare sees a real browser session, not a Node process.

Personal-use server, published to npm as @chrischall/musescore-mcp. Developed and maintained by AI (Claude). Use at your own discretion.

Tools

Tool What it does
musescore_search Search scores. Defaults to the "Free to view, play & download" facet (free_only=true). Returns id, title, uploader, composer, instrumentation, difficulty, page/part counts, view/save/download counts, and downloadability flags.
musescore_get_score One score's metadata — title, license, measures, key, parts, duration, upload/update dates — by URL or user_id + score_id.
musescore_download Get the official file (pdf/mid/mscz/mxl) for a free or entitled score. Without output_path it returns the official download URL to open in your signed-in browser; with output_path it writes the file to disk — your browser downloads it (via the bridge's download capability) and the MCP validates and moves it into MUSESCORE_OUTPUT_DIR, never overwriting. A purchase-gated score returns a structured gated result; fallback_svg=true renders page 1 instead.
musescore_score_to_pdf Write the best available file for a score to output_path: the official PDF when entitled, else the page-1 SVG stitched into a PDF (pure JS — no system deps), else the page-1 PNG render; mode picks a single tier. Leads with status (complete / partial — page 1 only / gated — purchase required / open_in_browser) and reports which tier won (via). Hosted, the PDF comes back as a download link (fileUrl).
musescore_fetch_svgs Download a score's page-1 render SVG into a local directory, for use with musescore_svg_to_pdf. Hosted, each page comes back as a download link plus a blobKey.
musescore_healthcheck Round-trip a public MuseScore URL through ContextMint Bridge and report which hop failed.
musescore_register_session / _set_active_session / _get_session_context Session registry bookkeeping.
musescore_svg_to_pdf Convert .svg / .svgz pages into a PDF, one file per page: local svg_paths, the svg_blob_keys musescore_fetch_svgs returned on a hosted server, or inline base64 svg_files. Pure JS (pdfkit + svg-to-pdfkit) — no system dependencies.

How it works

The server-rendered HTML has no result cards — MuseScore hydrates them client-side from an entity-encoded JSON store embedded in the page (its analogue of Next.js __NEXT_DATA__). The parsers recover that JSON and read the score objects directly. See docs/MUSESCORE-API.md.

Downloads

Download links live in the store's type_download_list ({type, url} for pdf / mid / mscz / mxl / mp3 …). Free scores (is_free) download fine — and they almost all report hasAccess: false, which is an entitlement flag (purchased / PRO), not the free-download signal. So the gate is is_free === true or hasAccess === true; paid scores you haven't bought are refused.

musescore_download without output_path is a resolver: it returns the official download_url for you to open in your signed-in browser. With output_path it writes the file: the download endpoint is Cloudflare-walled and 302-redirects cross-origin to presigned S3, which neither a server-side fetch nor a page-level fetch can follow — so the bridge hands the URL to the browser's own downloader (chrome.downloads), the MCP checks the saved file's magic bytes match the requested format (a gated score's HTML "Forbidden" page is rejected, not saved as a .pdf), and moves it to output_path inside MUSESCORE_OUTPUT_DIR without overwriting anything. Full verified mechanism: docs/MUSESCORE-API.md.

Use musescore_score_to_pdf when you want the best available file for a score. In the default auto mode it walks a fallback chain: the official PDF (same browser-download path as musescore_download, entitled scores only) → the page-1 render SVG (/static/musescore/scoredata/g/<hash>/score_0.svg) stitched into a PDF with pdfkit + svg-to-pdfkit (pure JS, no external binary) → the page-1 PNG render (written as .png) → a structured gated result. Render tiers cover page 1 only; pages 2+ sit behind MuseScore's protected page API.

Setup

  1. Install ContextMint Bridge from its releases page — Chrome: download the chrome zip, unzip it, and load it unpacked at chrome://extensions (Developer mode on); Safari is not available yet (it will ship inside the ContextMint app, which has no public download), so use Chrome for now. Then open musescore.com signed in, with the Cloudflare check cleared.

    Where the extension comes from. ContextMint Bridge is the fetchproxy browser extension under its new name, from the same maintainer — fetchproxy's own README (#extension) points to it. Its source is public at nullnet-app/contextmint-bridge: build it yourself (npm run build), or check a release zip against the .sha256 file published beside it (shasum -a 256 -c contextmint-bridge-chrome-<version>.zip.sha256).

  2. Point your MCP host at the built bundle:

    {
      "mcpServers": {
        "musescore": {
          "command": "node",
          "args": ["/absolute/path/to/musescore-mcp/dist/bundle.js"]
        }
      }
    }
    

Development

npm install
npm run build      # tsc --noEmit + esbuild → dist/bundle.js
npm test           # vitest, mocked client, no network

No env vars required. Optional: MUSESCORE_WS_PORT (default 37149), MUSESCORE_OUTPUT_DIR (default ~/Downloads), MUSESCORE_DELIVERY (auto | file | inline, default auto) and MUSESCORE_INLINE_MAX_BYTES (default 4 MiB).

Remote bridge (e.g. hosted on mcp-host, called from claude.ai). The MCP then shares no disk with you or the browser, so it switches to inline delivery and never writes a file: rendered PDFs and fetched SVGs come back as a signed, expiring download link (fileUrl / files[].url) from mcp-host's blob store — claude.ai rejects a PDF or SVG embedded in the tool result — and output_path / output_dir are ignored. With no blob store they are embedded in the result instead, up to MUSESCORE_INLINE_MAX_BYTES. musescore_fetch_svgs also returns a blobKey per page; pass those to musescore_svg_to_pdf as svg_blob_keys (or send your own SVGs as base64 svg_files). The browser download the official files need is local-only, so those come back as status: "open_in_browser" with the downloadUrl to open in your signed-in browser. Remote is detected from mcp-host's MCP_DATA_DIR / MCP_BLOB_BASE_URL, a non-loopback bridge address, or the extension's first local-only refusal; MUSESCORE_DELIVERY overrides it.

Every file-writing tool (musescore_download, musescore_score_to_pdf, musescore_fetch_svgs, musescore_svg_to_pdf) is confined to MUSESCORE_OUTPUT_DIR: an output_path/output_dir outside it (checked through symlinks) is refused, a relative path is resolved against it, and musescore_svg_to_pdf only reads svg_paths from inside it. An existing file is never overwritten — a numbered sibling (score-2.pdf) is written instead and returned as outputPath.

SVG→PDF conversion is pure JavaScript (pdfkit + svg-to-pdfkit) — no system binary or native dependency to install.

Upgrading

next release

Hosted (inline-delivery) results changed shape; local installs are unchanged.

  • musescore_score_to_pdf / musescore_download (fallback_svg): with a blob store, the PDF is no longer an embedded resource. delivered is now "link" (was "inline"), and the result adds fileUrl, fileUrlExpiresAt and deliveryNote. Over MUSESCORE_INLINE_MAX_BYTES a link is returned instead of inlineOmitted; inlineOmitted remains only when there is no blob store.
  • musescore_fetch_svgs: output_dir is now optional (still required on a local install, ignored hosted). Hosted results carry delivered ("link"/"inline"), outputDirIgnored and files[] ({page, fileName, url, expiresAt, blobKey, bytes} with a blob store, {page, fileName, bytes} + an embedded resource without), and no paths.
  • musescore_svg_to_pdf: svg_paths and output_path are now optional; pass exactly one of svg_paths, svg_blob_keys or svg_files. svg_paths is refused on a hosted server. A hosted result is {delivered, filename, fileUrl, fileUrlExpiresAt, deliveryNote, outputPathIgnored, pages, bytes, converter} instead of {outputPath, pages, bytes, converter}.

License

MIT