neurarch-mcp puts the release gate in Claude Code, Cursor, Claude Desktop, VS Code and Windsurf.
In Claude Code it installs as a plugin with two hooks: one runs neurarch gate on every file the agent
edits that names a model or a serving launch, and one checks a serving or training launch before the Bash call runs.
The tools give the agent the same checks the CLI runs: what changed upstream since a model's pin, whether a vLLM or
SGLang launch starts and fits its cards, and what a job needs before it takes a GPU.
Node.js 20 or newer. No install step: every client launches the server through npx. The Cursor and VS Code buttons register npx -y neurarch-mcp --hosted --hf, the same server the plugin runs: it has no model of its own, so each call names one (hf:Qwen/Qwen2.5-7B-Instruct, a launch line, a file path).
The agent edits serve.sh. The PostToolUse hook runs neurarch gate on that file, the same command the pull request runs, and the refusal goes back to the agent in the same turn:
(agent edits serve.sh to: vllm serve Qwen/Qwen2.5-7B-Instruct -tp 8 --max-model-len 131072)
neurarch gate refuses serve.sh as edited (2 launch blockers). The pull request's gate will refuse it too:
- vllm serve Qwen/Qwen2.5-7B-Instruct -tp 8 --max-model-len 131072: TP 8 does not divide 28 attention heads
- vllm serve Qwen/Qwen2.5-7B-Instruct -tp 8 --max-model-len 131072: Served length 131072 is past the model's 32768-token context
A refusal exits 2 with the reasons, which Claude Code shows the agent as feedback. A review returns the findings as context without stopping anything. An admit prints nothing. The refusal above needs neurarch 0.5.1 or later; npx -y neurarch fetches the newest (0.5.5).
/plugin marketplace add neurarch-ai/neurarch-mcp /plugin install neurarch@neurarch-ai
From a shell, the same two steps are claude plugin marketplace add neurarch-ai/neurarch-mcp and claude plugin install neurarch@neurarch-ai. What it adds:
| Part | What it does |
|---|---|
| hook --edit | PostToolUse, after an Edit, MultiEdit or Write. When the file names a Hugging Face model or a serving launch (a from_pretrained call, a vllm serve line, a KServe storageUri, an hf:// address), it runs neurarch gate on that file. NEURARCH_ALLOW_EDIT=1 turns it off. |
| hook --hf | PreToolUse, before each Bash call. A vllm serve or SGLang launch is checked against the model's config.json and blocked on a finding such as a TP that does not divide the heads (NEURARCH_ALLOW_SERVE=1 lets it through). A training launch (python train.py, accelerate launch, torchrun, deepspeed, sky launch) is sized and blocked when it will not fit the card it names (NEURARCH_ALLOW_OOM=1). Every other command runs untouched. |
| MCP server | npx -y neurarch-mcp --hosted --hf: the tools below, with each call naming its model. |
| skill | /neurarch:neurarch-skill: check the change before it ships, then the edit loop. |
Both hooks fail open: a file or command they do not recognise, a gate they cannot run, a timeout or any error lets the call through. To configure them by hand, add this to .claude/settings.json in the repository (or ~/.claude/settings.json):
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{ "type": "command", "command": "npx -y neurarch-mcp hook --edit", "timeout": 120 }
]
}
],
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "npx -y neurarch-mcp hook --hf", "timeout": 120 }
]
}
]
}
}
The same hooks for other agents, and the Kubernetes and scheduler admission points: admission hooks.
Each is the same check the CLI runs, vendored and offline unless the row says otherwise.
| Tool | What it answers |
|---|---|
| model_changes | What a tracked Hugging Face model changed between revisions (config, tokenizer, chat template, generation defaults, weights), whether each change is breaking under the published rule, and with since_revision only what landed after your pin. Reads public files from the change record. |
| check_pins | Downloads that load whatever main points at on the day the job runs (from_pretrained, hf_hub_download, snapshot_download, vllm serve, the SGLang server, YAML model keys), with the fix for each file. The scanner behind npx neurarch pin-check. |
| check_serving_config | A vLLM, SGLang or llama.cpp launch line against the model's config.json, tokenizer config, chat template and generation defaults: TP against the heads, served length against the context, KV memory and concurrency, quantization against the card. It compares configuration, never outputs. The same check as npx neurarch serve-check. |
| check_parallel_layout | Whether a TP / PP / DP / CP / EP split is legal, which pipeline stage is the straggler, and the split that removes it. Every time is labelled predicted from the graph. The same check as npx neurarch layout. |
| check_edit | Whether an edit to a model's config is one that runs and is wrong: a vocabulary resize that left a tensor behind, lost weight tying, attention config drift, a longer context with no RoPE scaling, LoRA targets that match nothing. Then the training peak before and after. |
| size_training_job | What a training job needs before it takes a GPU: peak memory at that batch, the smallest card that holds it, the largest batch on each card, and one run's cost. |
| diagnose_oom | After a CUDA out-of-memory error: the cause read from the message, and the fixes, least invasive first. The same diagnosis as npx neurarch oom. |
check_serving_config { command: "vllm serve Qwen/Qwen3-8B -tp 4 --max-model-len 131072 --max-num-seqs 64", gpu: "l4", gpus: 4 }
-> blocked: Served length 131072 is past the model's 40960-token context
The default listing is the core nineteen, in the order they are meant to be reached for. --toolsets=serving,changes,... advertises only those groups, --tools=full advertises every read tool, and every tool stays callable by name. The full contract for each tool is at neurarch://docs/{tool} as an MCP resource.
One command + args shape. Use an absolute path for any file argument in a global config: npx does not run from your project directory.
claude mcp add neurarch -- npx -y neurarch-mcp --hosted --hf
Settings → Developer → Edit Config, or edit the file directly: macOS ~/Library/Application Support/Claude/claude_desktop_config.json, Windows %APPDATA%\Claude\claude_desktop_config.json. Fully quit and reopen the app afterwards; the config is read at startup.
{
"mcpServers": {
"neurarch": {
"command": "npx",
"args": ["-y", "neurarch-mcp", "--hosted", "--hf"]
}
}
}
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json for all projects), then enable the server under Settings → MCP. Or use the Add to Cursor button above.
{
"mcpServers": {
"neurarch": {
"command": "npx",
"args": ["-y", "neurarch-mcp", "--hosted", "--hf"]
}
}
}
Create .vscode/mcp.json (note the servers key, not mcpServers), or from a shell: code --add-mcp '{"name":"neurarch","command":"npx","args":["-y","neurarch-mcp","--hosted","--hf"]}'
{
"servers": {
"neurarch": {
"command": "npx",
"args": ["-y", "neurarch-mcp", "--hosted", "--hf"]
}
}
}
Same command + args shape; only the config file location differs. For clients that speak Streamable HTTP instead of stdio, run the server with --http and point the client at it:
{
"mcpServers": {
"neurarch": { "type": "http", "url": "http://127.0.0.1:8787/mcp" }
}
}
It binds to loopback by default. Set NEURARCH_MCP_TOKEN to require a bearer token, which is mandatory before --write may bind to a non-loopback host.
Verify it works: ask the agent "List the Neurarch tools you can see." From a shell, npx -y neurarch-mcp --help prints usage and the full tool list.
Some clients cannot launch a local process or read your disk. For those, a hosted instance serves the same tools over Streamable HTTP.
claude mcp add --transport http neurarch https://neurarch-mcp.fly.dev/mcp
There is no file on the server, so every call names its model: hf: (a Hub config), or the text itself via model_source. The hosted server sees what you send it. If it cannot leave your machine, run the server locally, which is the default and costs nothing.
Three tools reach the network when the agent calls them, and their descriptions and openWorldHint annotation say so. Two switches are off by default. Every other tool runs locally.
| What | What it sends | When |
|---|---|---|
| model_changes | GETs of public static files on www.neurarch.com: the advisory index, one model’s revision list (its path is the model id), the card lineage record and the weight fingerprint record. No key, nothing from your repository. | Only when the agent calls model_changes; cached for an hour. |
| --hf | A request to huggingface.co for a repo’s public config.json (and the tokenizer, chat template and generation config for check_serving_config), with HF_TOKEN if set. Never your files. |
Only for a model named by its Hugging Face id. |
| plan | A model graph (and the base graph, and your policy lines) to POST /api/v1/plan, with share pinned to false. |
Only when the agent calls plan. |
| history | An 8-character structural fingerprint and your NEURARCH_API_KEY to GET /api/v1/history. Never the graph. |
Only when the agent calls history and a key is set. With no key it makes no request. |
| NEURARCH_REPORT=1 | An anonymous structure+verdict row: fingerprint, layer-type histogram, edge count, rule-id and severity pairs. Never parameter values, layer names, file paths, or any identity. | After each design-graph check, fire and forget, 5-second cap. |
With --hf off, NEURARCH_REPORT unset and none of plan, history or model_changes called, the server makes no network calls at all. What the hosted side stores, and what it never does: trust and data handling.
These tools read a model graph from source and grade its structure. They predate the release gate and are kept for existing users.
A pip package that runs one forward pass through your model and records the real shapes at every layer, then writes a graph the server reads directly.
pip install neurarch-trace
neurarch-trace my_pkg.model:build --input 1,3,224,224
A PyTorch parser reads your nn.Module source: layers, types, hyperparameters, wiring and parameter counts. Tensor shapes stay unknown, because source never says what goes in. Pass it as the server's argument (npx -y neurarch-mcp /abs/path/to/model.py) or as model_path on a call.
A graph saved from the older design app. Carries shapes, groups and hyperparameters. --watch reloads it on change, and --write lets the agent edit it (off by default).
Build the graph from a Hugging Face config.json, at launch with --hf or from the conversation with load_hf_model. Config only, never weights.
We ran the .py parser against model files sampled from real public repositories and published both rounds.
Round 1 (2026-08-31): 8% of files produced a recognisable graph, and 0 of 103 findings survived hand-judging as true findings.
Round 2 (2026-09-01, after the parser fixes that round 1 forced): 86% of files return a graph at all, 41% recognisable, median 8 layers.
Hugging Face config.* dimensions are still read as text rather than resolved, and round 2 has not been hand-judged.
Method and per-repo tables: round 1,
round 2, and
the current one.
A neurarch-trace graph sidesteps this: it carries the structure explicitly.
| Tool | What it does |
|---|---|
| validate_model | Is it a well-formed graph: cycles, dangling connection refs, duplicate ids and names, orphan layers. |
| lint_model | The single-graph design rules: attention head-dim and GQA divisibility, norm and activation ordering, dropout and feature ranges, missing residuals in deep stacks, the statically decidable shape rules. The catalogue is on the design-rule page. |
| check_design · rank_designs | A readiness verdict for one graph; an ordering of k candidate graphs in which blocked ones go last and ties stay ties. |
| suggest_fix · trace_model | Lint findings as unified diffs against the .py; a runtime trace for real shapes. |
| plan · history | The card the PyTorch PR bot posts, and what the same structure measured the last time it trained in your organisation. The only two that call the hosted API (see Network). |
| describe_architecture · get_model_summary · layer_impact | Orientation, overview, and the blast radius of changing a layer. |
| get_layer · compare_layers · find_layers · find_path · list_connections | One layer, a diff of two, search, paths and edges. |
| param_count_by_block · flops_by_block · list_blocks · get_block | Parameters and MACs by block, scope or type. |
| diff_models · mermaid_diagram · list_hyperparams · get_design_notes | A structural diff against another graph, a Mermaid diagram, hyperparameters and notes. |
| list_architectures · load_architecture · load_hf_model | Bundled reference graphs, and a graph built from a Hugging Face config.json. |
| add_layer · modify_layer · add_connection · delete_connection · delete_layer · save_model | Opt in with --write. Mutations always target the file passed on the command line, never an invented path, and are refused on a .py. |
| export_pytorch | Runnable PyTorch for the current graph. |
Three MCP prompts bundle the calls a design review takes: review_design, shrink_for_target and pre_train_checklist.