Neurouter
OfficialCompiles GraphQL APIs, provided as SDL or introspection, into a curated MCP tool model so agents can call GraphQL operations through generated tools with overlays and governance.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Neurouter
Turn an OpenAPI or GraphQL API into a governed MCP server that AI agents can actually use:
Compiler: OpenAPI 3.0/3.1 and GraphQL (SDL or introspection) → a curated tool model, with overlays (rename, describe, hide, shape responses, composites) that survive spec re-imports.
Data plane: one stateless MCP endpoint per server and environment (
/mcp/{server}/{env}, protocol 2026-07-28 plus the 2025-11-25 path), read-only by default, prod writes confirmed by the user through MCP elicitation, policies, rate limits, kill switches, hash-chained audit log.Code mode:
run_scriptruns short Python scripts (Pydantic Monty, sandboxed in a separate executor process) that call the API tools as functions, with dry runs and planned changes.Ops tools:
neurouter_begin_task,end_task,report_unmet_need,report_issue,explain_error, … so agents frame their work and tell you what the API is missing.Evals: generated agent tasks run in tool and code mode, an agent-readiness score (0–100) and fix suggestions as overlay patches (
npx neurouter eval, GitHub Action).
Apache-2.0. © Neurouter contributors.
Quickstart
npm install
npx tsx --conditions=@neurouter/source packages/cli/src/main.ts serve --config neurouter.example.yaml
# published package: npx neurouter serve --config neurouter.example.yamlThe example loads the Swagger Petstore against the in-process mock:
TOKEN=$(npx tsx --conditions=@neurouter/source packages/cli/src/main.ts keys create --server petstore --env dev --scopes tools:read,code:run)
claude mcp add --transport http petstore http://localhost:3000/mcp/petstore/dev --header "Authorization: Bearer $TOKEN"Evals without an API key (deterministic stub provider, not a real model):
NEUROUTER_EVAL_LLM=stub npx tsx --conditions=@neurouter/source packages/cli/src/main.ts eval \
--spec examples/petstore/openapi.yaml --generate --repeats 1 --md report.mdWith OPENAI_API_KEY set, the same command uses the default model gpt-6-luna (BYOK). Evals also run
on Anthropic (ANTHROPIC_API_KEY, claude-* models) and Gemini (GEMINI_API_KEY, gemini-* models):
pass --models gpt-6-luna,claude-sonnet-5-5,gemini-3.5-flash-lite to compare them; each model goes to
its provider (provider:model forces one). Keys can also be stored, encrypted, in the console
(Settings › Models).
Token figures in eval reports are comparable across providers: tokens of an attempt = uncached input +
cached input + output (reasoning included), summed over its turns; "tokens per multi-step task" is the
mean of that over the multi-step attempts. Cached input (OpenAI cached_tokens, Anthropic
cache_read_input_tokens, Gemini total_cached_tokens) is also reported on its own, and Anthropic cache
writes are counted as input. --transcripts <file> writes every attempt untrimmed (--transcript-max-chars
to cap each item).
Checks are outcome-based (0.2.2): expected values are computed at run time by running each task's reference
calls on the same mock data, only the arguments the prompt asks for are checked, answers are compared by
meaning (booleans, numbers, minor units, dates, ids), and call budgets are soft (over budget is reported as
efficiency, not failure). A suite is accepted only when every task's reference solution passes its own
checks (calibration; --calibrate-with <model> adds a model pass that flags disagreements for review).
--max-run-tokens caps a run's spend (agent, judge and fix-suggestion tokens): every attempt in flight reserves its
per-attempt token limit, so attempts running at once (--concurrency, default 4) cannot overshoot it. Per-attempt limits (turns, tool calls, tokens including cached input,
wall time, enforced during calls) can be overridden per suite or per task (limits). Exact values (numbers,
amounts, ids) are never passed by the equivalence judge. Details, score definitions and the 0.2.1 suite converter
(--migrate-suite) and offline re-grade (--regrade): packages/evals/README.md.
Related MCP server: production-mcp-server
Agent contract
Tool results follow one of two contracts, chosen per session:
Contract 2 (default for servers created from this release on): every
tools/callresult is one envelope,{"ok","data","page","truncated","error","state"}(plus an optionalhint), as the only text item and asstructuredContent.datais the API's payload unchanged;pagesayscount/total/has_moreon list tools, withnext_cursor: pass it ascursorto the same tool with the same other arguments for the next page, whatever the upstream's paging style (cursor tokens, page/per_page, offset/limit,starting_after,Linkheaders) and for the rest of a list Neurouter cut. Cursors are signed, bound to the tool, the query arguments (notfields) and the credential, and last 1 hour; a cursor sent with other arguments answers with the call that continues it. Every tool takesfields(dot paths, per item on lists; the overlayincludeis the default set) and list tools takelimit(the upstream page size); names the upstream already uses get annr_prefix.truncatednames the object fields Neurouter clipped and thefieldscall that returns them;errorhas a code, a short message, every invalid field with its allowed values,retryandnext(the exact call to make next);statecarries the environment, write mode, task and call counter (and identical-result streaks). Unknown tools answer with an envelope (unknown_tool+ closest names), not a JSON-RPC error. Inrun_script, tool functions return plain data;ns.list_x.page(…)returns aResult(.data,.items,.page,.next(),.pages()) andns.list_x.pages(…, max_items=500)the items of every page (ops.pages(fn="ns.list_x", …)is a deprecated alias). Tool errors raise typed exceptions:NotFound(aLookupError),InvalidArgs(ValueError),Forbidden,WritesDisabledandConfirmationRequired(PermissionError),Timeout(TimeoutError),RateLimitedandUpstreamError(RuntimeError); catch them by name, by base or asToolError.str(e)is short (code, message, next call) andops.error(e)returns the structured error (code,message,retry,next,fields,plan).print()output comes back aslogs(up to 2,000 characters); a return value over 8,192 characters (limits.code.resultChars) is cut withtruncated(truncated.nextreads the rest) and a hint to return less; the cut data always fits. Inside a script, a call that hits the gateway rate limit waits for a token instead of failing (contracts 1 and 2). Each wait is bounded by the script's remaining wall time and bylimits.code.rateLimitWaitSec(default 30 s; 0 fails at once). Only a wait that cannot fit raisesRateLimitedwithretry_after_ms. The waits appear in the run's stats (rateLimitWaits,rateLimitWaitMs). One tool result inside a script may be up to 16 MiB (results over the executor's 2 MiB frame go in parts); over that, the call raisesresponse_too_large. Asearch_toolsresult over 8,192 characters (limits.searchResultChars) keeps the full detail (doc, schema, example) for the top 3 hits only, then drops the last hits;truncatedsays what was cut andtruncated.nextissearch_toolsfor one tool by name with its full detail. There is no task framing: Neurouter infers tasks per credential, client and MCP session (10-minute idle gap), countsstate.call/streakin the task row (the same on every instance), and showsstate.leftwhen a rate limit is down to 20%. One ops tool is listed,neurouter_report(kind: done|blocked|unmet_need|tool_problem| decision, text); the v1 names still answer. Write tools takedry_run: true(the plan: target, effect,reversible). Outside prod a destructive call first answersconfirmation_requiredwith the plan and the same call carryingconfirm: "ct_…"(5 minutes, single use, bound to the arguments and the credential); scripts with destructive calls do the same per plan. In prod your user approves through elicitation; tokens are not accepted.Contract 1: the 0.2.x shapes. Servers created before contract 2 keep it until switched.
A client picks a version with the capability experimental["dev.neurouter/contract"] = {"versions":[2,1]} or the
header X-Neurouter-Contract: 2; otherwise exposure.contract (server, or per environment in neurouter.yaml)
decides. NEUROUTER_NEW_SERVER_CONTRACT (default 2) sets the contract of new servers. exposure.outputSchema
is envelope (default: the shared envelope schema with an open data), none, or typed (the shaped upstream
schema as data, validated before sending; a tool whose response does not match is re-listed without it and
reported in the inbox).
Rate limits
Gateway limits. Neurouter limits calls per credential (
limits.rateLimit) and per credential and tool (limits.toolRateLimit). When an environment sets neither, the defaults are 600/min (burst 120) per credential and 300/min (burst 60) per credential and tool. These are the sharedDEFAULT_LIMITS; the limiter applies them and the console shows them (one source of truth since 0.3.5). An API key's own rate limit replaces the per-credential one.Mock environment. The built-in mock (
baseUrl: "mock:") has no gateway rate limit unless its limits or the API key set one (0.3.3).Scripts. Inside
run_script, inner calls wait for a token (see above).Upstream backoff. A read that gets 429 or 503 from the upstream is retried when the response says when to come back:
Retry-After, orX-RateLimit-Remaining: 0withX-RateLimit-Reset. It is retried at most twice, each wait is at most 10 s, and inside a script no wait runs past its wall time. Writes are never retried: they returnrate_limitedwithretry_after_ms.Upstream concurrency.
limits.upstreamConcurrencycaps an environment's in-flight upstream calls (default: no cap).
Development
Command | What |
| server (tsx watch, embedded executor) + console dev server |
| Vitest (unit + in-process integration tests); |
| TypeScript project build + test configs; ESLint incl. the data/control plane boundary |
| crypto values for |
Layout: packages/shared (REST contract the console imports), packages/compiler, packages/evals,
apps/executor (Monty pool behind a socket frame protocol), apps/server (kernel/, dataplane/,
controlplane/), apps/web (console), packages/cli (npm neurouter).
Local dev uses SQLite (no Docker). Production uses Postgres with pgvector.
Deploy
Docker:
docker build -t neurouter-core .thendocker run -p 3000:3000 --env-file .env -e NEUROUTER_CONFIG=/app/neurouter.example.yaml neurouter-core.Docker image:
ghcr.io/neurouter/core:<version>.Kubernetes: the
neurouter-corechart,helm install neurouter oci://ghcr.io/neurouter/charts/neurouter-core --version <version> -f values.yaml(source indeploy/helm/neurouter-core; executor as a sidecar, or a separate Deployment with a deny-all egress NetworkPolicy, recommended for production). Model provider keys:openai.existingSecret,anthropic.existingSecret,gemini.existingSecret.Cloud Run demo:
deploy/cloudrun/setup.shanddeploy/cloudrun/deploy.sh(reviewed and run by a human).
See SECURITY.md for the code-mode threat model.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Governed app access for AI agents: 1,000+ apps & 12,000+ tools via Code Mode MCP.
An MCP gateway for teams deploying AI tools at scale to employee-facing and headless agents.
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceEnables AI agents to securely call MCP tools with risk scoring, checkpoints, rollback, and approval workflows.28 npmMIT- AlicenseNot gradedqualityCmaintenanceEnables AI agents to safely call enterprise tools through a governed MCP gateway with permission enforcement, blast-radius controls, input validation, and a full audit trail for every invocation.MIT
- AlicenseNot gradedqualityBmaintenanceTurns existing REST/OpenAPI APIs into governed MCP tools for AI agents without modifying the APIs themselves, generating agent-friendly tools from specs, Postman collections, HAR files or cURL commands. Owners enable tools and set policies, while every call injects upstream credentials, redacts PII, projects responses to fit context limits, and produces a full audit trail.5Apache 2.0

Civic MCP Gatewayofficial
AlicenseNot gradedqualityDmaintenanceEnables AI agents to connect to tools and data through a governed MCP endpoint with agent identity, scoped permissions, guardrails, and full audit trails. Access is user-controlled and can be revoked instantly, with every tool call logged by agent identity and timestamp.MIT