astra-mcp
Allows interaction with the Astra desktop music player via its Companion API, providing tools to view current playback, search the library, play/enqueue music, manage favorites and playlists, and control playback.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@astra-mcp Play some lo-fi hip hop"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
astra-mcp
An MCP server for Astra's Companion API v2. It lets Claude and other MCP clients see and drive a running Astra desktop music player — what's playing, search the library, start and queue music, manage favorites and playlists.
Read-only by default: Astra ships the API disabled, and each capability is a separate switch the user controls. This server adapts to whatever is granted and hides the tools that aren't.
Setup
1. Turn on Astra's Local API
In Astra: Settings → Integrations → Local API.
Switch | Grants | Tools it unlocks |
Local Integration API |
|
|
External Playback Controls |
|
|
Library Search |
|
|
Favorites & Playlist Changes |
|
|
Copy the Local API Key from that panel. The token only works over 127.0.0.1.
2. Build
npm install
npm run build3. Register the server
Claude Code:
claude mcp add astra --env ASTRA_API_TOKEN=<your-token> -- node /absolute/path/to/astra-mcp/dist/index.jsClaude Desktop (claude_desktop_config.json) and other clients:
{
"mcpServers": {
"astra": {
"command": "node",
"args": ["/absolute/path/to/astra-mcp/dist/index.js"],
"env": { "ASTRA_API_TOKEN": "your-token" }
}
}
}4. Browser-based clients (llama.cpp WebUI, and similar)
Clients that run in a browser cannot spawn a subprocess, so stdio is not an option for them. Start the server in HTTP mode instead:
$env:ASTRA_API_TOKEN = 'your-token'
node dist/index.js --http # http://127.0.0.1:38500/mcp
node dist/index.js --http=9000 # or pick a portThen in llama.cpp: launch llama-server with --webui-mcp-proxy (spelled
--ui-mcp-proxy on some builds) so the WebUI can reach it past CORS, and add
http://127.0.0.1:38500/mcp as an MCP server in the WebUI settings.
GET /health reports whether the Astra link is up and which scopes are granted
— the quickest way to tell a broken token from a stopped app.
The HTTP transport is stateless: it never issues an Mcp-Session-Id.
That is deliberate. llama.cpp's WebUI does not echo that header back
(ggml-org/llama.cpp#20471),
so a stateful server would reject every call after initialize. The trade-off
is that HTTP clients get no server-initiated messages: no tools/list_changed
when you flip a scope switch in Astra, and no resource-update notifications.
Tool calls are unaffected. Both work normally over stdio.
GET /mcp returns 405 for the same reason — there is no session to push a
stream to, and an open one would leak.
Configuration
Variable | Default | Purpose |
| — | Local API Key from Astra settings. Required. |
|
| Set this if you changed the port in Astra. |
|
| How often Astra pushes position updates (250–5000). |
| unset | Set to |
|
| Enables HTTP mode, same as |
|
| Bind address for HTTP mode. |
| empty | Comma-separated browser origins allowed to call the server directly. |
A missing token is a warning, not a crash — the server starts and each tool explains what to fix.
On
ASTRA_MCP_HTTP_ORIGINS: this process holds a token that can control your music player, so no browser origin is allowed by default. Any page you allowlist can drive Astra. You do not need this for llama.cpp — its proxy calls from the server side, where CORS does not apply.
Related MCP server: Spotify MCP Server
Tools
Tool | What it does |
| Find tracks, albums, artists, playlists. Start here — everything else takes refs from it. |
| Current track, position, volume, shuffle, repeat, output device. |
| play, pause, stop, next, previous, seek, set-volume, set-muted, set-shuffle, set-repeat. |
| Play a ref now, replacing the queue. |
| Add a ref to the queue, |
| Focus the Astra window on a ref without playing it. |
| Read the queue with per-item ids. |
| Move, remove, or clear upcoming queue items. |
| Set a track's favorite state explicitly. |
| Create, rename, and edit the contents of normal playlists. |
| Granted scopes, features, limits — the tool to reach for when something is 403. |
Resources
astra://playback, astra://queue, and astra://capabilities are live JSON views that support
subscriptions. astra://artwork/{ref} returns album art as a blob — a resource rather than a tool
so a model can't flood its own context with 2 MiB images.
How it works
Refs are opaque. Astra never exposes file paths or database ids; it hands out signed
AstraRef strings. Nothing here accepts a name, so every flow is search → act. Refs can go stale
and start returning 404, which means search again.
One event stream, not polling. The server holds a single SSE connection to /v2/events and
keeps playback and queue snapshots warm, so astra_now_playing usually costs zero HTTP requests.
Astra's budget is 120 requests/minute shared across everything using the token; a client-side
limiter keeps this server under it by queuing rather than failing. If the stream drops, tools fall
back to direct reads.
202 is not "done". Playback, intent, and queue commands are queued to Astra's renderer and
return immediately. astra_control and astra_play wait briefly on the event stream and report the
state Astra actually reached, rather than claiming success.
The tool list is live. Flipping a switch in Astra's settings force-closes the event stream; the
reconnect handshake carries the new scopes, and the server enables or disables tools to match.
(Over HTTP the gating still applies, but the client is not notified — it sees the change on its next
tools/list.)
One Astra connection, many MCP servers. HTTP mode builds a fresh McpServer per request, as
stateless mode requires, but they all share a single AstraRuntime holding one HTTP client and one
event stream. Otherwise each request would open its own stream and exhaust Astra's limit of eight.
What this cannot do
Astra's v2 contract deliberately omits catalog browsing, audio streaming, metadata editing, library scans, remote-source administration, settings, DSP/EQ, lyrics, playlist deletion, and dynamic playlist rules. Those endpoints do not exist, so no tool here can reach them. Library writes are limited to favorites and locally owned normal playlists — mirrored (Jellyfin/Subsonic) and dynamic playlists reject edits.
Only the loopback transport is supported. Astra also serves the same v2 surface to paired LAN devices over HTTPS on port 38402, which needs its own pairing flow.
Development
npm run build # tsc
npm test # build, then unit + contract tests
npm run inspector # MCP Inspector against the built server
npm run smoke # end-to-end against a running Astra (read-only)Smoke testing runs against a live Astra and is read-only unless you opt in.
--play replaces the current queue; --write creates a playlist you then have
to delete by hand, since Astra has no delete endpoint. Neither touches existing
playlists or favorites.
# PowerShell
$env:ASTRA_API_TOKEN = 'your-token'
npm run smoke
node scripts/smoke.mjs "Miles Davis" # + search
node scripts/smoke.mjs "Miles Davis" --play # + play and enqueue
node scripts/smoke.mjs "Miles Davis" --write # + playlist creation# bash / zsh
export ASTRA_API_TOKEN='your-token'
npm run smokesrc/types.ts mirrors Astra's src/types/companionApi.ts by hand, and ASTRA_ENDPOINTS in
src/client.ts lists every endpoint this server calls. test/contract.test.mjs checks both against
Astra's own docs/api/openapi-v2.json, and fails if the source calls a path that isn't declared.
It looks for the Astra checkout as a sibling directory; set ASTRA_REPO if yours lives elsewhere.
License
GPL-3.0
Available Tools
11 toolsastra_capabilitiesAstra: capabilities and granted scopesARead-only
Report which Astra Companion API scopes are granted, which features are available, and the current limits. Useful for diagnosing a permission error: if a tool returns "insufficient_scope", this shows which switch is off in Astra → Settings → Integrations → Local API.
Inputs: no named parameters.
astra_controlAstra: control playbackA
Control playback in Astra: play, pause, stop, next, previous, seek, set-volume, set-muted, set-shuffle, set-repeat. Each action needs its own argument — seek needs positionSeconds, set-volume needs volume (0-1), set-muted needs muted, set-shuffle needs enabled, set-repeat needs mode. Astra accepts commands asynchronously; this tool waits briefly and reports the state it actually landed on. To start a specific track or album instead, use astra_search then astra_play.
Inputs: action (required), mode, muted, volume, +2 more.
astra_enqueueAstra: add a target to the queueA
Add a track, album, artist, or playlist to the Astra queue without interrupting what is playing. Takes an opaque ref from astra_search. Use position "next" to play it after the current track, or "end" to append. Refs are opaque signed strings from astra_search (or from the current track / queue). Pass them through verbatim — never parse, edit, or invent one. A ref can go stale and return 404.
Inputs: targetRef (required), position.
astra_now_playingAstra: now playingARead-only
Get the current playback state of the Astra music player: track, position, duration, volume, mute, shuffle, repeat, output device, and queue length. Served from a live event stream when connected, so it is cheap to call. Returns the current track's ref, which can be passed to astra_set_favorite or astra_playlist.
Inputs: no named parameters. Returns: muted, state, repeat, source, +8 more
astra_openAstra: show a target in the appAIdempotent
Bring the Astra window to the front and navigate to a track, album, artist, or playlist. This only changes what the user is looking at — it does not start playback. Takes an opaque ref from astra_search. Refs are opaque signed strings from astra_search (or from the current track / queue). Pass them through verbatim — never parse, edit, or invent one. A ref can go stale and return 404.
Inputs: targetRef (required).
astra_playAstra: play a target nowADestructive
Start playing a track, album, artist, or playlist in Astra, replacing the current queue. Takes an opaque ref from astra_search — call that first to turn a name into a ref. Refs are opaque signed strings from astra_search (or from the current track / queue). Pass them through verbatim — never parse, edit, or invent one. A ref can go stale and return 404. To resume something already loaded, use astra_control with action "play" instead.
Inputs: targetRef (required).
astra_playlistAstra: create and edit playlistsA
Create a playlist in Astra, rename one, or add / remove / reorder its tracks. "create" needs name. "rename" needs ref and name. "add-tracks" needs ref and trackRefs. "remove-track" needs ref and trackRef. "move-track" needs ref, trackRef, and position. Get playlist refs from astra_search with types ["playlist"], and track refs from astra_search with types ["track"]. Refs are opaque signed strings from astra_search (or from the current track / queue). Pass them through verbatim — never parse, edit, or invent one. A ref can go stale and return 404.
Limits: only locally owned normal playlists are editable — mirrored (Jellyfin or Subsonic) and dynamic playlists reject edits with playlist_not_writable. Astra has no playlist deletion endpoint, so playlists cannot be deleted through this server.
Inputs: action (required), ref, name, position, +2 more.
astra_queueAstra: read the play queueARead-only
List the tracks in the Astra play queue, in order, with the currently playing one marked. Each entry has a queue item id — pass that to astra_queue_edit to move or remove it. Served from the live event stream when connected. Astra only publishes the first 200 queue entries to the API, so a longer queue is reported as truncated and the later entries are not reachable.
Inputs: limit.
astra_queue_editAstra: edit the play queueADestructive
Reorder or trim the Astra play queue. "move" needs queueItemId and a 0-based position, "remove" needs queueItemId, and "clear" empties the upcoming queue without stopping the current track. Get queue item ids from astra_queue. The currently playing item cannot be moved or removed — attempting it returns queue_item_not_found. To add tracks instead, use astra_enqueue.
Inputs: action (required), position, queueItemId.
astra_searchAstra: search the libraryARead-only
Search the user's local Astra music library by name and get back opaque refs. This is the entry point for almost everything: nothing else in this server accepts a title or artist name, only a ref from here. Search is bounded — it needs a non-empty query, returns at most 50 results, has no pagination, and cannot list the whole catalog. Follow up with astra_play, astra_enqueue, or astra_open.
Inputs: q (required), limit, types.
astra_set_favoriteAstra: set a track favoriteAIdempotent
Mark or unmark a track as a favorite in the Astra library. This sets an explicit state rather than toggling, so it is safe to repeat. Takes a track ref from astra_search or from the current track reported by astra_now_playing. Refs are opaque signed strings from astra_search (or from the current track / queue). Pass them through verbatim — never parse, edit, or invent one. A ref can go stale and return 404.
Inputs: favorite (required), trackRef (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct resource or action: search returns refs, play/enqueue/queue_edit manage the queue, control handles transport, set_favorite toggles favorites, playlist manages playlists, open navigates the UI, and now_playing/capabilities are informational. There is minor potential overlap between astra_play and astra_control 'play', but descriptions clearly separate starting a specific item from resuming playback.
All tools share the astro_ prefix, but the pattern is not uniform: most are verb_noun (set_favorite, queue_edit) or bare verbs (open, play, search), while some are nouns (queue, capabilities, playlist) implying a 'get' action. Occasional phrases like now_playing deviate from a strict verb_noun convention, but the prefix and readable structure keep it mostly consistent.
With 11 tools, the server is well-scoped for a music player control surface. Each tool covers a distinct operation without redundancy, and the count is within the ideal range for a focused MCP server.
The core workflows are covered: search, play, control, queue management, favorite toggling, and playlist CRUD (minus deletion, which is documented as unavailable). Minor gaps exist: there is no tool to list favorites or fetch the contents of a playlist, and search is bounded without pagination, but agents can work around these via now_playing/queue for current state and by using playlist refs directly.
Maintenance
Related MCP Connectors
Generate AI music via the Lacuna Music API from MCP clients like Claude Desktop & Code.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
MCP server for Producer/Riffusion AI music generation
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables controlling Spotify playback through natural language commands in MCP clients like Cursor or Claude for Desktop.1-
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI assistants like Claude Desktop to interact with Spotify's music streaming service, supporting playback control, playlist management, music search, and user profile access.412MIT
- AlicenseAqualityBmaintenanceMCP server for the Spotify Web API — gives Claude and other AI assistants tools to search music, control playback, manage playlists, library, and podcasts.475MIT
- AlicenseAqualityDmaintenanceMCP server to control Spotify conversationally from Claude, Cursor, and other AI clients.1195 npm2MIT