Skip to content

feat(mcp): add Audius MCP server package - #14816

Open
dylanjeffers wants to merge 2 commits into
mainfrom
feat/audius-mcp-server
Open

dylanjeffers wants to merge 2 commits into
mainfrom
feat/audius-mcp-server

Conversation

@dylanjeffers

@dylanjeffers dylanjeffers commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds packages/audius-mcp (@audius/mcp), a remote MCP server that lets Claude act for an Audius user as a listener and as an artist. Streamable HTTP, TypeScript, built on @audius/sdk and @modelcontextprotocol/sdk.

Do not merge yet — see "Not verified" below.

What is in it

  • 20 tools. Listener: search_tracks, search_users, search_playlists, get_trending_tracks, get_track, get_user, get_playlist, get_my_favorites, get_my_reposts, create_playlist, add_track_to_playlist, remove_track_from_playlist, favorite_track, repost_track. Artist: get_my_tracks, get_track_play_count, get_my_followers, get_top_fans, update_track_metadata, upload_track.
  • Annotations. Every tool has a title. The 13 read tools set readOnlyHint: true. Write tools set readOnlyHint: false and an explicit destructiveHint, which is true for remove_track_from_playlist and update_track_metadata.
  • Auth. Claude cannot use Audius OAuth directly, because Audius validates redirect URIs against the developer app and has no dynamic client registration. So the server is an OAuth 2.1 authorization server for MCP clients (discovery, DCR, PKCE, rotating refresh tokens, revocation) and an OAuth client of Audius through sdk.oauth.login() / handleRedirect(). /auth starts the Audius flow and /callback completes it. MCP clients never see Audius tokens.
  • Consent page. /authorize shows which client is asking and where it will redirect before handing off to Audius. Without it, anyone could register a client and reuse a user's existing Audius approval.
  • Sessions. Each grant owns one SDK instance with that user's Audius tokens in memory. Each MCP session is bound to the grant that opened it, and a different user's token is refused for that session.
  • Uploads. upload_track takes a public https audio URL. The fetch refuses private, loopback and link-local hosts, re-checks on each redirect, and enforces a size cap.

Things reviewers should look at

  • patches/zod-to-json-schema+3.25.2.patch. The MCP SDK depends on zod-to-json-schema, which npm hoists to the root next to zod@3.21.4. It imports zod/v3, which that version does not have, so the MCP SDK fails to load. The patch points those imports at zod. The alternative is raising the zod pin in sdk, common and libs, which seemed too wide for this PR.
  • package-lock.json. Besides the new packages, root qs moves 6.16.0 → 6.17.1 and json-schema-typed 8.0.1 → 8.0.2, and tinybench / why-is-node-running are hoisted.
  • get_top_fans ranks listeners by plays. The SDK only exposes top listeners per track, and its generated TopListener type drops the user and count fields, so the tool reads the raw response. With no track_id it totals plays across the artist's 25 most-played tracks (top 100 listeners each), so it is an approximation for large catalogs.
  • add_track_to_playlist / remove_track_from_playlist read the playlist and write back the whole playlistContents through updatePlaylist, since there is no per-track endpoint. Two concurrent edits to one playlist can overwrite each other.

Test plan

  • npm run verify -w @audius/mcp (lint + typecheck)
  • npm run test -w @audius/mcp — 42 tests. They drive registration, consent, callback, token exchange, refresh rotation, revocation and tool calls over real HTTP with the MCP SDK client, against a fake Audius session.
  • Compiled server started locally; discovery metadata, the 401 challenge and the redirect to api.audius.co/v1/oauth/authorize checked with curl.
  • The nine public read tools run against the live Audius API and return correctly shaped results.
  • node scripts/comment-ratchet.cjs

Not verified

  • A real Audius sign-in, and every tool that needs one. This needs an Audius developer app API key with <PUBLIC_URL>/callback registered, which I do not have. That covers all write tools, the get_my_* tools and upload_track.
  • Adding it in Claude with claude mcp add, for the same reason.
  • The Dockerfile. It follows packages/sdk/Dockerfile but has not been built; Docker was not running.
  • Deployment. Nothing is deployed.

Known limits

  • State is in memory. A restart signs everyone out and only one instance can run.
  • CI: .github/workflows/mcp.yml runs lint, typecheck, tests and build for this package.

🤖 Generated with Claude Code

Adds packages/audius-mcp, a remote MCP server (streamable HTTP) built on
@audius/sdk that lets Claude act for an Audius user as a listener and as
an artist.

- 20 tools: search, trending, track/user/playlist lookups, favorites,
  reposts, playlist editing, artist stats, followers, top fans, track
  metadata updates and uploads. Every tool has a title and
  readOnlyHint/destructiveHint annotations.
- Auth: the server is an OAuth 2.1 authorization server for MCP clients
  (discovery, dynamic client registration, PKCE, rotating refresh
  tokens) and signs users in through Audius OAuth via sdk.oauth. A
  consent page at /authorize names the registering client before the
  hand-off to Audius; /auth starts the Audius flow and /callback
  completes it.
- Each grant holds its own SDK instance and Audius tokens in memory, and
  each MCP session is bound to the grant that opened it.
- upload_track fetches audio from a public https URL and refuses
  private, loopback and link-local hosts.

Patches zod-to-json-schema to import from "zod" instead of "zod/v3". It
is hoisted next to the root zod 3.21.4, which has no "/v3" subpath, so
the MCP SDK failed to load without it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 17e5dfa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@socket-security

socket-security Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Dependency limit exceeded — report not shown.

This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report.

Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard.

Socket is always free for open source. If this is a public open source project under an OSI-approved license, contact us to request a free Business plan upgrade.

get_top_fans now ranks listeners by plays (per track, or totalled across the
artist's 25 most-played tracks) instead of $AUDIO tipped. Adds an MCP CI
workflow running lint, typecheck, tests and build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant