Repository navigation
feat(mcp): add Audius MCP server package - #14816
dylanjeffers wants to merge 3 commits into
Conversation
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 detectedLatest commit: 19ecd90 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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>
…account - sdk: token refresh middleware no longer holds an unread clone of non-401 responses. Under node-fetch that stalled any response body over ~16KB when an API key was set, which hung every larger MCP tool result. - get_my_favorites uses the library endpoint; the favorites/tracks route 404s. - update_track_metadata checks ownership first instead of reporting success for a write the network then rejects. - Tool errors now report the real Audius status and are logged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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/sdkand@modelcontextprotocol/sdk.Do not merge yet — see "Not verified" below.
What is in it
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.title. The 13 read tools setreadOnlyHint: true. Write tools setreadOnlyHint: falseand an explicitdestructiveHint, which istrueforremove_track_from_playlistandupdate_track_metadata.sdk.oauth.login()/handleRedirect()./authstarts the Audius flow and/callbackcompletes it. MCP clients never see Audius tokens./authorizeshows 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.upload_tracktakes a publichttpsaudio 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 onzod-to-json-schema, which npm hoists to the root next tozod@3.21.4. It importszod/v3, which that version does not have, so the MCP SDK fails to load. The patch points those imports atzod. The alternative is raising thezodpin insdk,commonandlibs, which seemed too wide for this PR.package-lock.json. Besides the new packages, rootqsmoves 6.16.0 → 6.17.1 andjson-schema-typed8.0.1 → 8.0.2, andtinybench/why-is-node-runningare hoisted.get_top_fansranks listeners by plays. The SDK only exposes top listeners per track, and its generatedTopListenertype drops theuserandcountfields, so the tool reads the raw response. With notrack_idit 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_playlistread the playlist and write back the wholeplaylistContentsthroughupdatePlaylist, since there is no per-track endpoint. Two concurrent edits to one playlist can overwrite each other.SDK change.
addTokenRefreshMiddlewarereturned the cloned response for every non-401. Undernode-fetch(whatcross-fetchuses in Node) an unread clone stalls the body once it passes about 16KB, so with an API key set any larger response hung forever. It now releases the clone and lets the runtime use the original. This affects every Node consumer of the SDK that setsapiKey; a patch changeset is included.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.401challenge and the redirect toapi.audius.co/v1/oauth/authorizechecked with curl.node scripts/comment-ratchet.cjsNot verified
create_playlist,add_track_to_playlist,remove_track_from_playlist,favorite_track,repost_track,update_track_metadata,upload_trackwith cover art, unlisted), including their not-owner, not-found, bad-ID, non-https and wrong-file-type errors.claude mcp addand sign-in through/mcpin Claude Code worked; tool calls from Claude Code then exposed the bugs fixed in the last commit and have not been re-run from Claude Code since.Dockerfile. It followspackages/sdk/Dockerfilebut has not been built; Docker was not running.Known limits
.github/workflows/mcp.ymlruns lint, typecheck, tests and build for this package.🤖 Generated with Claude Code