# API reference: mcp

The hub as a remote MCP server: one URL an AI agent connects to, with an API key, and the same tools the `lucen-mcp` package serves.

## POST /mcp

`mcpMessage` · scope `key:read` · The hub as a remote MCP server

An AI agent connects here with one line of configuration and nothing to install. The transport is MCP's Streamable HTTP. Send a JSON-RPC message with an API key as `Authorization: Bearer`. The server keeps no session: every request stands alone and the answer is JSON.

The tools are the ones the `lucen-mcp` package serves over stdio. Each tool calls this API with the caller's own key. So every scope rule, every rate limit and every `404` is the API's own. Tools that act on the server's own computer are not offered here. No tool can approve a deployment, mint a key or continue a stopped campaign.

`toolsets` picks the tools. `train` is the default: the training flow from picking a robot to its sim test videos. `all` serves every tool. A browser session token is refused with `401`. Give the agent an API key instead. A request whose `Origin` is not this hub's web app is `403`. Each key may make 600 requests a minute here, like the rest of the API. One person has at most three requests in flight, whichever of their keys sends them. The body must arrive whole within 10 seconds, or the answer is `408`.

A deployment serves this endpoint only once its operator switches it on. Until then every request is `503`.

Parameters:

- `toolsets` (query): Comma-separated toolsets, for example `train,devices`. The default is `train`. Unknown names are `400`.

Request body: `application/json`, required.

Responses:

- `200`: The JSON-RPC response.
- `202`: A notification or a response from the client, accepted.
- `400`: The body is not a JSON-RPC message, or a toolset is unknown.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `408`: The request body did not arrive within 10 seconds.
- `413`: The request body is larger than 1 MiB.
- `429`: This key made too many requests this minute, or this person already has three requests in flight.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.
