MCP server
Drive an alineod swarm from Claude Code, Claude Desktop, Cursor, or any MCP client with `npx alineo-mcp`.
alineo-mcp is an MCP server that exposes alineod's swarm-control API as
tools, so an AI client can create a run, fork agents, steer them, and collect their results without you writing
any HTTP calls.
MCP client ── stdio ──▶ alineo-mcp ── HTTP + SSE ──▶ alineod ──▶ OpenSandbox + Pi
(Claude Code, Cursor, …) (npx, local process) (daemon)It is a small local process, not a hosted service. The client launches it over stdio, and it talks to an
alineod that you (or init) have running. It is published on npm as
alineo-mcp.
You still need alineod and Docker
alineo-mcp only translates tool calls into alineod requests. The agents run in OpenSandbox
containers behind alineod, so Docker is required. The init tool starts both for you.
Connect a client
There is nothing to install. The client runs npx -y alineo-mcp on demand.
claude mcp add alineo -- npx -y alineo-mcp
# only for the current project
claude mcp add alineo --scope project -- npx -y alineo-mcpRestart the client and it will list 16 tools, named {subject}_{verb} — run_start, agent_spawn, spec_add and so on.
Pass environment variables through the client
Many clients start MCP servers with a limited environment rather than your shell's, so set anything
alineo-mcp needs in the config's env block:
{
"mcpServers": {
"alineo": {
"command": "npx",
"args": ["-y", "alineo-mcp"],
"env": {
"ALINEOD_URL": "http://127.0.0.1:4600",
"NVIDIA_API_KEY": "nvapi-..."
}
}
}
}For Claude Code: claude mcp add alineo --env NVIDIA_API_KEY=nvapi-... -- npx -y alineo-mcp.
Start alineod
Every run_*, agent_* and result_* tool needs alineod reachable at ALINEOD_URL (default http://127.0.0.1:4600). Either:
- Ask the client to call
init. It starts OpenSandbox and alineod in Docker, pulling images if needed, and writesalineo.config.jsonin the current directory if missing. It forwards any model provider key found inalineo-mcp's own environment into the alineod container, which is why the key belongs in theenvblock above. This is the same setup asalineo init. - Or run alineod yourself, as described in the Quickstart and
Deployment, and point
ALINEOD_URLat it.
Run a swarm from chat
With the server connected and alineod up, you can describe the swarm and let the client drive the tools:
Add the agent spec at
./agents/reviewer.json, start a run with it, fork two child agents from the root, and give me each one's result.
Behind that, the client makes calls in roughly this order:
Get a spec
spec_add fetches an agent spec from a URL or local path,
validates it, and saves it to the local spec cache. spec_list shows what is already saved.
Create the run
run_start takes the spec, an optional first prompt, and an optional budget override. It returns
a runId and rootAgentId immediately while the root agent is still provisioning; poll
run_get for its real state.
Fan out
agent_spawn forks a child from a live parent (parentAgentId). Pass waitFor to hold the spawn
until other agents finish, and idempotencyKey so a retried call cannot create a duplicate. This is the same
fan-out/gather model as the HTTP API.
Drive and observe
agent_prompt starts a turn and agent_steer redirects one in flight.
agent_pause and agent_resume freeze and thaw a container. To observe, use
run_get for the whole tree or run_watch for events.
Collect and tear down
result_get returns a settled agent's output. agent_stop stops one agent and
run_stop aborts and closes every live agent in the run. The ledger is kept.
For a complete, runnable version of this flow, see the MCP Agent Swarm cookbook: a lead agent forks two reviewers, one is paused and the other steered, and an editor merges their findings, all through these tools.
Tools
Swarm control (need alineod)
| Tool | alineod route | What it does |
|---|---|---|
run_start | POST /runs | Load the root agent from a spec, optionally drive a first prompt. |
run_list | GET /runs | Your runs, newest first. Find a run id you no longer have. |
run_get | GET /runs/:runId | The spawn tree: every agent with its parent and current state. |
run_stop | DELETE /runs/:runId | Abort and close every live agent in the run. |
run_watch | GET /runs/:runId/events (SSE) | Collect lifecycle and harness events for a bounded window. |
agent_spawn | POST /runs/:runId/agents | Fork a child under a live parent, optionally with waitFor. |
agent_get | GET /agents/:agentId | An agent's current view plus session stats. |
agent_prompt | POST /agents/:agentId/prompt | Drive one turn. Returns immediately. |
agent_steer | POST /agents/:agentId/steer | Inject a message into the in-flight turn. |
agent_pause | POST /agents/:agentId/pause | Freeze the agent's container. |
agent_resume | POST /agents/:agentId/resume | Thaw a paused container. |
agent_stop | POST /agents/:agentId/stop | Abort and close one agent. |
result_get | GET /agents/:agentId/result | A settled agent's output. waitSeconds (max 240) long-polls. |
Setup and specs (work without alineod)
| Tool | What it does |
|---|---|
init | Start OpenSandbox and alineod locally in Docker. |
spec_add | Fetch a spec from a URL or file, validate it, and save it locally. |
spec_list | List saved specs. |
spec_get | Return one saved spec, ready to pass as spec to run_start. |
spec_remove | Delete a saved spec by name. |
Events are polled, not streamed
An MCP tool call is request/response, so run_watch collects events for a bounded window (20
seconds by default, at most 120) and returns them. Pass the last event's id as sinceEventId on
the next call to resume without missing anything.
Not exposed through MCP yet
The tools cover alineod's core routes, not everything the HTTP API has gained since. These are available over HTTP only:
scope: "subtree"on pause, resume, and stop (and on steer), which act on an agent and all its descendants. The MCP tools act on the one agent you name. To end a whole swarm, userun_stop.GET /agents/:agentId/transcript- The coordination routes:
await,notify-on, and the inbox.
Serve it to other people
npx alineo-mcp runs on one person's machine and trusts them: init starts Docker, and spec_add reads local files.
To serve the MCP to other people, run it over streamable HTTP in remote mode:
ALINEOD_URL=https://alineod.internal:4600 npx -y alineo-mcp --http --port 4700It listens on 127.0.0.1 by default (--host changes that). It speaks plain HTTP at /mcp, with GET /health open.
Put your own TLS in front of it to expose it.
Remote mode differs from the local server in four ways:
- It holds no credential. Each request must carry an
Authorizationheader, and the server forwards that header, unchanged, to alineod. alineod's authentication decides who the caller is and which runs they may see. A request with no header gets401here, so the endpoint is not an open door to an alineod with no authentication.--allow-anonymousturns that check off when alineod does the checking. - There is no
init. The daemon is already running. spec_addtakes the spec itself inspec, or a publichttps://URL inurl, never a file path. The URL must use port 443 and resolve only to public addresses. Redirects are checked at every hop, and the body is capped at 1 MiB. A URL that points at the server's own network is refused.registryDependenciesare fetched the same way, up to 20.- Specs live in a
SpecStore, not on the server's disk. With no store passed, the server keeps nothing between requests, so it offersspec_addas a validator only (it returns the spec, and you pass that object torun_start) and leaves outspec_list,spec_getandspec_remove. Pass a store that persists, one per caller, to get all four.
To embed it in your own program, import from alineo-mcp/server:
import { createHttpMcp } from "alineo-mcp/server";
const mcp = createHttpMcp({
baseUrl: "https://alineod.internal:4600",
specsFor: (authorization) => storeFor(authorization), // your per-caller SpecStore
});
Bun.serve({ fetch: (request) => mcp.fetch(request) });One gap in the URL check
The server resolves a spec URL's name, checks the addresses, and then fetch resolves it again. A
hostile DNS server can answer differently the second time. Run the server where it cannot reach
private addresses, as well.
Configuration
| Setting | Where | Default | Affects |
|---|---|---|---|
ALINEOD_URL | env var on the alineo-mcp process | http://127.0.0.1:4600 | Every run_*/agent_*/result_* tool. |
ALINEOD_API_KEY | env var on the alineo-mcp process | none | Sent as Authorization: Bearer when set. |
alineo.config.json | project file, or ~/.config/alineo/config.json as fallback | written by init | Where spec_add and friends store specs. |
| Model provider key | env var on the alineo-mcp process, e.g. NVIDIA_API_KEY | none | Forwarded into alineod by init. |
alineo-mcp shares alineo.config.json and the spec directory with alineo-cli, so a spec added by either
shows up in both.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
alineod error (network): Could not reach alineod... | alineod is not running, or ALINEOD_URL is wrong. | Call init (needs Docker), or check what is listening on the configured URL. |
alineod error (401): authentication required | alineod requires a token and none was sent, or it was wrong. | Set ALINEOD_API_KEY in the client's env block to the token that alineod expects. |
alineod error (429, LIMIT_EXCEEDED) | A per-tenant limit on runs, live agents or agent creation. | Stop an agent or close a run, or wait, then try again. The message names the limit. |
alineod error (403, TENANT_SUSPENDED) | The operator suspended your account. | Contact whoever runs the daemon. Reads and stopping still work. |
alineod error (404): no run ... or no agent ... | Wrong ID, or it was already deleted or stopped. | Take the ID from the tool result that created it. run_get lists current agents. |
alineod error (409): agent ... is not live | The agent's sandbox has already ended. | Check state and outcome in agent_get before prompting again. |
init fails at "Checking Docker..." | Docker is not installed or its daemon is not running. | Start Docker and retry. |
| A spawned agent never produces a result | No model provider key reached alineod. | Put the key in the client's env block before init, or in the alineod container's env. |
The client shows no alineo tools | The server failed to start. | Run npx -y alineo-mcp in a terminal. It should wait silently for input, and errors go to stderr. |
Every tool returns errors as a tool result with isError set instead of crashing the server, so a failed call
is visible to the client and safe to retry.