|
| 1 | +--- |
| 2 | +description: Let AI agents control Nuclear via the Model Context Protocol. |
| 3 | +--- |
| 4 | + |
| 5 | +# MCP server |
| 6 | + |
| 7 | +Nuclear includes a built-in [MCP](https://modelcontextprotocol.io/) server that lets your AI control the music player, doing pretty much anything that you can! |
| 8 | + |
| 9 | +## Enable the server |
| 10 | + |
| 11 | +1. Open Nuclear → Settings → Integrations. |
| 12 | +2. Toggle `Enable MCP Server` on. |
| 13 | +3. The server starts on `http://127.0.0.1:8800/mcp` (localhost only). If port 8800 is taken, it tries 8801, 8802, and so on up to 8809. |
| 14 | +4. The **MCP Server URL** field below the toggle shows the actual URL. Click the copy button to grab it. |
| 15 | + |
| 16 | +## Connect your AI tool |
| 17 | + |
| 18 | +The server URL is `http://127.0.0.1:8800/mcp` using the `Streamable HTTP` transport. |
| 19 | + |
| 20 | +{% tabs %} |
| 21 | +{% tab title="Claude Code" %} |
| 22 | +```bash |
| 23 | +claude mcp add nuclear --transport http http://127.0.0.1:8800/mcp |
| 24 | +``` |
| 25 | +{% endtab %} |
| 26 | + |
| 27 | +{% tab title="OpenCode" %} |
| 28 | +Add to your `opencode.json`: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "mcp": { |
| 33 | + "nuclear": { |
| 34 | + "type": "remote", |
| 35 | + "url": "http://127.0.0.1:8800/mcp" |
| 36 | + } |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
| 40 | +{% endtab %} |
| 41 | + |
| 42 | +{% tab title="Codex CLI" %} |
| 43 | +Add to `~/.codex/config.toml`: |
| 44 | + |
| 45 | +```toml |
| 46 | +[mcp_servers.nuclear] |
| 47 | +url = "http://127.0.0.1:8800/mcp" |
| 48 | +``` |
| 49 | + |
| 50 | +Or via the CLI: |
| 51 | + |
| 52 | +```bash |
| 53 | +codex mcp add nuclear --url http://127.0.0.1:8800/mcp |
| 54 | +``` |
| 55 | +{% endtab %} |
| 56 | + |
| 57 | +{% tab title="Claude Desktop / Cursor / Windsurf" %} |
| 58 | +Add to your MCP config (`claude_desktop_config.json`, `.cursor/mcp.json`, etc.): |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "mcpServers": { |
| 63 | + "nuclear": { |
| 64 | + "url": "http://127.0.0.1:8800/mcp" |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | +``` |
| 69 | +{% endtab %} |
| 70 | + |
| 71 | +{% tab title="MCP Inspector" %} |
| 72 | +```bash |
| 73 | +npx @modelcontextprotocol/inspector |
| 74 | +``` |
| 75 | + |
| 76 | +Enter `http://127.0.0.1:8800/mcp` as the URL and select `Streamable HTTP` as the transport. |
| 77 | +{% endtab %} |
| 78 | +{% endtabs %} |
| 79 | + |
| 80 | +## Tools |
| 81 | + |
| 82 | +Nuclear exposes four MCP tools. The server uses a hierarchical discovery pattern: start broad, drill down, then act. |
| 83 | + |
| 84 | +### `list_methods` |
| 85 | + |
| 86 | +Lists available methods in a domain. |
| 87 | + |
| 88 | +| Parameter | Type | Required | Description | |
| 89 | +| --------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------- | |
| 90 | +| `domain` | string | yes | One of: `Queue`, `Playback`, `Metadata`, `Favorites`, `Playlists`, `Dashboard`, `Providers`. | |
| 91 | + |
| 92 | +Returns the method names and short descriptions for that domain. |
| 93 | + |
| 94 | +### `method_details` |
| 95 | + |
| 96 | +Gets full details for a single method: its description, parameter names and types, and return type. |
| 97 | + |
| 98 | +| Parameter | Type | Required | Description | |
| 99 | +| --------- | ------ | -------- | ----------------------------------------------------------------- | |
| 100 | +| `method` | string | yes | The method name in `Domain.method` format, e.g. `Queue.addToQueue`. | |
| 101 | + |
| 102 | +### `describe_type` |
| 103 | + |
| 104 | +Gets the JSON shape of a data type. Use this when `method_details` returns a parameter or return type that references a complex type. |
| 105 | + |
| 106 | +| Parameter | Type | Required | Description | |
| 107 | +| --------- | ------ | -------- | ---------------------------------------------------- | |
| 108 | +| `type` | string | yes | The type name, e.g. `Track`, `QueueItem`, `Playlist`. | |
| 109 | + |
| 110 | +### `call` |
| 111 | + |
| 112 | +Calls a Nuclear API method. |
| 113 | + |
| 114 | +| Parameter | Type | Required | Description | |
| 115 | +| --------- | ------ | -------- | ---------------------------------------------------------------------------------------------- | |
| 116 | +| `method` | string | yes | The method name in `Domain.method` format, e.g. `Queue.addToQueue`. | |
| 117 | +| `params` | object | no | A JSON object with named fields matching the method's parameters. Omit or pass `{}` for methods with no parameters. | |
| 118 | + |
| 119 | +## Discovery workflow |
| 120 | + |
| 121 | +An agent follows this sequence to find and call an API method: |
| 122 | + |
| 123 | +1. Read the `list_methods` tool description to see the seven available domains. |
| 124 | +2. Call `list_methods` with a domain (e.g. `Queue`) to see that domain's methods. |
| 125 | +3. Call `method_details` (e.g. `Queue.addToQueue`) to get parameter names, types, and the return type. |
| 126 | +4. If a parameter or return type is a complex type like `Track`, call `describe_type` to see its fields. |
| 127 | +5. Call `call` with the method name and parameters to execute it. |
| 128 | + |
| 129 | +Each step returns a small, focused payload to save on tokens. |
| 130 | + |
| 131 | +## Agent skill |
| 132 | + |
| 133 | +If your AI tool supports skills (like Claude Code), you can install one that teaches the agent how to use Nuclear's MCP tools, including the discovery workflow, common recipes, and the full API reference. |
| 134 | + |
| 135 | +[Download nuclear-mcp.zip](/skills/nuclear-mcp.zip) |
| 136 | + |
| 137 | +Unzip it into your skills directory (e.g. `~/.claude/skills/`) and the agent will pick it up automatically. |
0 commit comments