Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP server (for AI agents)

redstart mcp starts a Model Context Protocol server over stdio, exposing the toolchain as tools an AI agent can call directly. The point is the write → check → fix loop: an agent authoring a subgraph edits .red, calls check, reads precisely-located diagnostics, and fixes them — without a human relaying compiler output.

Wiring it up

Register redstart mcp as an MCP server with your agent/host. For Claude Code:

$ claude mcp add redstart -- redstart mcp

Any MCP-capable client works — the transport is standard newline-delimited JSON-RPC 2.0 over stdio.

Tools

ToolArgumentsReturns
checkpath or source{ ok, diagnostics } — errors and lint warnings, each with a code, message, and file/line. ok is false only when there are errors.
explaincode (optional)The code’s meaning, the footgun it prevents, and the fix. Omit code to list every code.
buildpath, write (optional)The generated schema.graphql, subgraph.yaml, and src/mappings.ts (plus optimisation notes). write: true also writes them to disk.
testpathPer-test pass/fail for the project’s test blocks (native, no Docker).

check is the keystone. It returns the same structured diagnostics as redstart check --json, so the agent gets machine-readable feedback on every edit — and a parse or load failure comes back as an ordinary { ok: false, diagnostics } result rather than an error, so the loop never stalls on broken input. check also accepts inline source (a single .red file, no on-disk ABIs) for quick snippets.

Why this matters

Redstart’s guarantees — no nullable-arithmetic miscompiles, no non-deterministic host calls, Bytes ids, @derivedFrom relations — are only useful if they reach the author at the moment of writing. For a human that’s redstart check and the LSP; for an agent it’s this MCP server. The compiler already owns check, explain, build, and test; the MCP server just hands them to the agent.