# MCP transports

Mirli serves MCP two ways: Streamable HTTP on the app's own port, and a stdio bridge for clients that cannot speak
HTTP. HTTP covers every tool; the bridge covers six. Step-by-step setup for thirteen named clients is in the how-to
guide [Connect an AI agent to Mirli](https://mirli.app/docs/connect-agent/index.md).

## Streamable HTTP

The endpoint, on the server's default port:

```text title="Endpoint"
http://127.0.0.1:17494/mcp
```

| Property | Behaviour |
|---|---|
| Auth | None by default. With an access token set on the server, `/mcp` requires it. See [Access token and allowed hosts](#access-token-and-allowed-hosts) |
| Path | `/mcp` with no trailing slash. Mirli answers on `/mcp` directly and never redirects, so a client that does not follow a `307` on `POST` works |
| Port | Follows the server. The **Agents** page in the app (`/#/agents`) prints the endpoint of the running server |
| Sessions | Streamable HTTP sessions, identified by the `mcp-session-id` header. The session id appears in the call log |

A generic `mcpServers` entry, as most clients read it:

```json title="mcp.json"
{
  "mcpServers": {
    "soundbox": {
      "type": "http",
      "url": "http://127.0.0.1:17494/mcp"
    }
  }
}
```

### Client config keys

Config keys differ by client, and most clients ignore an entry with a wrong key without an error. The full entries,
each checked against the vendor's page in November 2026, are in `app/src/content/mcp/clients.ts`.

| Client | Key or file detail |
|---|---|
| Claude Code | In a hand-written `.mcp.json`, `"type": "http"` is required. An entry with `url` and no `type` is read as stdio and skipped |
| Claude Desktop | `claude_desktop_config.json` takes stdio servers only, and **Settings > Connectors** connects from Anthropic's cloud, which cannot reach `127.0.0.1`. The entry runs `npx -y mcp-remote <URL>` or the stdio bridge |
| VS Code | `.vscode/mcp.json` uses a `servers` key, not `mcpServers` |
| Antigravity | `serverUrl` (or `url`). `httpUrl` is rejected |
| Gemini CLI (legacy) | `httpUrl` is Streamable HTTP and `url` means SSE: the reverse of Antigravity |
| Devin Desktop | The `.devin/mcp_config.json` entry carries `"transport": "http"` next to `url` |
| Zed | `context_servers`, not `mcpServers` |
| Cline | `"type": "streamableHttp"` is required; without it Cline falls back to SSE |
| Goose | The key is `uri`, not `url`, and `type` is `streamable_http` |
| opencode | Remote servers default to OAuth. Mirli has none, so the entry sets `"oauth": false` |
| Continue | `type: streamable-http`. A standalone file in `.continue/mcpServers/` also needs `name`, `version` and `schema` |

A client that speaks only stdio can reach the HTTP endpoint through `mcp-remote`, which needs Node.js. The command a
client config runs:

```bash
npx -y mcp-remote http://127.0.0.1:17494/mcp
```

## Stdio bridge

`server/dist/mcp/stdio.js` is a thin proxy onto the running server. It does not load models, so there is never a
second copy of a model on the GPU, and its calls appear on the **Agents** page tagged `stdio`. A client entry for it:

```json title="mcp.json"
{
  "mcpServers": {
    "soundbox": {
      "command": "node",
      "args": ["<CHECKOUT>/server/dist/mcp/stdio.js"]
    }
  }
}
```

`<CHECKOUT>` is the absolute path to the Mirli clone. The **Agents** page prints the command with the path resolved
for the running install.

| Property | Behaviour |
|---|---|
| Build | The file exists only after `npm run build` (or `npm run build --workspace server`). A fresh clone does not have it |
| Path | Absolute. `npx soundbox-mcp` fails because the package is private, and a bare `soundbox-mcp` fails because the bin is linked only into the checkout's own `node_modules/.bin`, which is not on the `PATH` an editor starts MCP servers with |
| Tools | Six: `generate`, `enhance_prompt`, `list_models`, `list_sounds`, `get_sound`, `delete_sound`. `separate`, speech, stories and the studio are HTTP only |
| Results | A sound is the HTTP API's object, with a `file` URL such as `/files/<SOUND_ID>.wav` and no absolute path |

Environment variables the bridge reads:

| Variable | Default | Purpose |
|---|---|---|
| `MIRLI_URL` | `http://127.0.0.1:17494` | Where the running server listens |
| `MIRLI_API_TOKEN` | none | The server's access token, sent with every request |

## Access token and allowed hosts

When the server is started with an access token, `/mcp` requires it like every other route, as
`Authorization: Bearer <TOKEN>`. A Claude Code `.mcp.json` entry that sends it:

```json title=".mcp.json"
{
  "mcpServers": {
    "soundbox": {
      "type": "http",
      "url": "http://127.0.0.1:17494/mcp",
      "headers": {
        "Authorization": "Bearer <TOKEN>"
      }
    }
  }
}
```

`<TOKEN>` is the value of `MIRLI_API_TOKEN` on the server. Over the stdio bridge, `MIRLI_API_TOKEN` in the bridge's
environment does the same. See [Access token](https://mirli.app/docs/install-access/index.md#access-token).

`/mcp` checks the `Host` header against DNS rebinding. A client that reaches it by any name other than `localhost`,
`127.0.0.1` or `[::1]` needs that name in `MIRLI_ALLOWED_HOSTS` on the server, or the endpoint answers `403`. This
holds even when the server is bound to `0.0.0.0`. See
[Reverse proxy or another machine](https://mirli.app/docs/install-remote/index.md#put-mirli-behind-a-reverse-proxy).

## Progress and timeouts

A long music render can outlast a client's tool-call timeout; some clients cut a call off at 60 seconds. When the
request carries `_meta.progressToken`, Mirli sends `notifications/progress` while the job runs:

| Field | Value |
|---|---|
| `progress` | 0 to 1 |
| `total` | `1` |
| `message` | The job's own phase, such as `loading model` or `sampling` |

| Behaviour | Detail |
|---|---|
| Frequency | One when the job moves, at most once a second, plus one every 5 seconds while nothing moves, such as while weights load |
| Tools | Every tool that waits on a job: `generate`, `speak`, `speak_story` (one bar across all the lines it reads), `separate`, `export_story`, `open_in_studio`. Over the stdio bridge, `generate` |
| No token | No notifications. A client that neither sends a token nor resets its timeout on progress needs a longer tool timeout or a shorter `duration_s` |
| Server limit | 15 minutes per job (per line, for `speak_story`). The job is then cancelled and the tool returns an error |
