@chainrender/mcp
A Model Context Protocol (MCP) server for building ChainRender apps with AI. It exposes the ChainRender SDK as tools so an AI assistant that speaks MCP (in your editor or an MCP-capable chat) can compose, grade, compile, and validate fully on-chain, Grade-A, verifiable apps.
The principle: AI proposes, the SDK and chain verify
ChainRender is designed so AI output is checkable, not blind:
- Closed vocabulary — the AI can't express an invalid construct.
grade()— the AI's trust claim is computed, not asserted (A/B/C + itemized breakdown).- Deterministic
compile()— you reproduce the exact hash the AI produced. - Enforcer validation — an unsafe app is refused; the validate tool catches it locally first.
Tools
| Tool | What it does |
|---|---|
chainrender_vocabulary | The closed vocabulary (node types and fields, enums, capabilities, resolver kinds). Call first. Optional include returns only the named sections. |
chainrender_search_kinds | Find resolver kinds by words and data edge — names, one-line summaries and arg names only. |
chainrender_describe_kind | One kind's full descriptor: args, argsEncoding, data edge, capability, notes. |
chainrender_check_node | Check a Node tree against everything compile() reads; reports what it would silently drop, with paths. |
chainrender_node_schema | The strict JSON Schema of a Node tree. |
chainrender_grade | Grade a composition (A/B/C + breakdown) before deploying. |
chainrender_compile | Compile a composition to its content-addressed hash (deterministic). |
chainrender_validate | Run the enforcer-equivalent checks locally (needs a manifest; optional known-components). |
chainrender_review | check + grade + compile + honesty findings + (optional) validate in one call — the finalize loop. pass is the bit to gate "done" on. Pass chain to check every address against that chain. |
chainrender_verify | Confirmed / Refuted / Inconclusive, with evidence, for one fact: kind-exists, export-exists, kind-deployed, contract-deployed, address-has-code. |
chainrender_doctor | Installed SDK and server vs npm; chains.json vs the published Addresses page; each RPC reachable; every listed contract has code. |
The server's instructions (sent when a client connects) are Start here for AI builders: the model does not know
ChainRender from training data, where each fact is published, and the verify loop. Same text as the top of
llms.txt.
Keep the context small: the full vocabulary is ~59 KB, most of it resolver kinds. Request every section except
resolverKinds ({"include":["nodeTypes","a11y","behavior","enums","capabilities","kinds","limits"]}, ~5 KB) and
look kinds up with chainrender_search_kinds → chainrender_describe_kind.
Install & run
npm install -g @chainrender/mcp
chainrender-mcp # runs on stdio
chainrender_verify, chainrender_doctor and chainrender_review with chain read the published deploy records
and the chain. Override any source with an environment variable:
| Variable | Default |
|---|---|
CHAINRENDER_CHAINS | https://chainrender.org/chains.json (a path or URL) |
CHAINRENDER_ADDRESSES | https://chainrender.org/docs/reference/addresses.md |
CHAINRENDER_RPC_<chainId> | the chain's rpc in chains.json |
CHAINRENDER_NPM_REGISTRY | https://registry.npmjs.org |
Review a tree from the command line
For a tree an AI gave you, when that AI cannot run MCP (for example a chat model, or Google AI Studio):
npx -y @chainrender/mcp review app.json # human-readable report; exit 0 = pass, 1 = fail
npx -y @chainrender/mcp review app.json --chain sepolia # also check every address against that chain
npx -y @chainrender/mcp review app.json --json # the full result, as chainrender_review returns it
It is the same review as the chainrender_review tool and the visual builder's Review tab. Paste the printed
report back to the AI and ask it to fix every item.
Configure in an MCP client
Add to your client's MCP server config (e.g. an editor's mcp.json):
{
"mcpServers": {
"chainrender": { "command": "chainrender-mcp" }
}
}
The AI workflow
- The AI calls
chainrender_vocabulary(slim) to learn what it can compose, andchainrender_search_kinds/chainrender_describe_kindfor the data sources it binds — encoding eachargexactly as the descriptor says. - It composes a Node tree from the vocabulary (using the
compose.*builders' shapes). - It calls
chainrender_check_nodeand fixes every issue —compile()silently drops unknown fields and invalid enum values. - It calls
chainrender_gradeto check the trust level — and fixes anything that lowered it. - It calls
chainrender_verifyfor every fact it relies on (a kind, an export, a contract on the target chain, an address) and uses only what is Confirmed. - It calls
chainrender_review(withchain) and does not report the app as done untilpassis true and every honesty warning is fixed or explained. - The human deploys the reproducible, graded, validated result.
Every step after the AI composes is a verification, not trust. See the ChainRender docs: "Building with AI" and "Instructing an AI" — also as Markdown for agents at https://chainrender.org/docs/llms.txt.
Status
v0.9.0. Wraps the shipped @chainrender/client (^0.16.0) — the tools are thin wrappers over the SDK's
vocabulary(), checkNode(), nodeJsonSchema(), grade(), compileComponent(), validateApp() and
honestyFindings(); verify and doctor read chains.json, the Addresses page and the chain (src/chain.ts).
Tests: npm test drives the built server over stdio against local mocks. No logic is duplicated; the SDK is the single
source of truth.