Neurouter Hub
OfficialThis server is an authenticated MCP gateway for discovering and invoking only the tools you are allowed to use.
Search across connected MCP servers by natural-language query, optionally limiting by server slug and result count, returning matching tools, schemas, scores, and approval requirements.
Execute a discovered tool by exact name with arguments matching its input schema via
call_tool.Unauthorized tools are hidden or indistinguishable from unknown tools, and tools may require human approval before execution.
Gateway controls apply: authentication, authorization/grants, rate limiting, audit logging, metrics, tool-definition pinning, and schema validation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Neurouter Hub show me which MCP tools my agent can access"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Neurouter Hub
Self-hosted enterprise MCP gateway. Agents connect to one /mcp endpoint and reach only the
upstream MCP servers and tools they've been granted; every call is authenticated, authorized,
rate-limited, audited and measured. The same server hosts the admin console and user portal.
A built-in server library syncs the official MCP Registry (opt-in) and grades every server
A–F by rules you can read (how grading works).
Renamed in 0.2.0: Neurouter is now Neurouter Hub. The image is
ghcr.io/neurouter/hub(alsodocker.io/neurouter/hub), the chart isoci://ghcr.io/neurouter/charts/neurouter-hub, and the registry entry iscom.neurouter/hub. Nothing else changes: env vars, secrets, resource names and data stay the same, sohelm upgrade <release> oci://ghcr.io/neurouter/charts/neurouter-hub --version 0.2.0 --reuse-valuesupgrades in place.ghcr.io/neurouter/neurouterstill receives 0.2.x images.
Website: hub.neurouter.com · Live demo (read-only, simulated data): neurouter-hub-demo.web.app · Docs: hub.neurouter.com/docs
38 s walkthrough of the live demo (simulated data): approvals, the live audit log, a blocked tool definition change, grants and metrics.
Phase 1 is in progress.
Requirements
Node.js >= 24 (runtime target is Node 26 LTS; CI runs 24 and 26)
npm 11 (npm workspaces)
No Docker for local development: the default database is SQLite (with sqlite-vec) in a local file.
Related MCP server: agent-security-gateway
Quick start (local dev, SQLite)
npm install
cp .env.example .env # then edit; see "Environment" below
npm run keys -- gen # prints NEUROUTER_MASTER_KEYS / NEUROUTER_ACTIVE_KEY_ID / HASH_PEPPER for .env
npm run dev # API server (tsx watch) + Vite dev server with the API proxynpm run dev starts the server, waits for GET /healthz, then starts Vite. Open the URL Vite
prints. The server applies migrations on start (MIGRATE_ON_START=true) and creates
apps/server/data/neurouter.db.
Run them separately if you prefer:
npm run dev:server # API on $PORT (default 3000)
npm run dev:web # Vite; proxies /api, /mcp, /oauth, /.well-known, /metrics to $NEUROUTER_DEV_API_URLHealth checks: GET /healthz (liveness, alias /health) and GET /readyz (DB + audit store).
UI without a backend: set VITE_ENABLE_MSW=true and run npm run dev:web; the app runs against
MSW handlers generated from the shared API contract.
Run with Docker Compose (Postgres)
A prod-like stack on one machine: the Neurouter Hub image plus Postgres 18 with pgvector.
cp .env.example .env
npm run keys -- gen # paste the three values into .env (never commit them)
docker compose up --build # http://localhost:3000, MCP endpoint http://localhost:3000/mcpCompose runs the production image in "local production" mode (NODE_ENV=development semantics
for login and URLs, because production mode requires an https PUBLIC_URL and OIDC). Sign in with
AUTH_DEV_LOGIN=true and BOOTSTRAP_ADMIN_EMAIL=<you> in .env, or use a real IdP:
docker compose --profile oidc upstarts a local Dex (deploy/compose/dex.yaml, useradmin@example.com/password). SetOIDC_ISSUER=http://<host-ip>:5556/dex,OIDC_CLIENT_ID=neurouter,OIDC_CLIENT_SECRET=neurouter-dev-secret. The issuer URL must be reachable from both your browser and the container.docker compose --profile otel upadds an OpenTelemetry collector that logs traces and logs; setOTEL_SDK_DISABLED=false.
The image (see Dockerfile) is multi-stage on node:26-bookworm-slim (glibc, because the
onnxruntime and sqlite-vec prebuilds target glibc), runs as the non-root node user and bakes the
embedding model in, so it needs no network egress for models (EMBEDDINGS_ALLOW_REMOTE=false).
Multi-arch build: docker buildx build --platform linux/amd64,linux/arm64 -t neurouter:<tag> .
Released images (linux/amd64 and linux/arm64) are published to GHCR, signed with cosign (keyless) and shipped with an SBOM and build provenance:
docker pull ghcr.io/neurouter/hub:0.2.0
cosign verify ghcr.io/neurouter/hub:0.2.0 \
--certificate-identity-regexp '^https://github.com/neurouter/hub/\.github/workflows/release\.yml@' \
--certificate-oidc-issuer https://token.actions.githubusercontent.comKubernetes (Helm)
kubectl create secret generic neurouter-crypto \
--from-literal=NEUROUTER_MASTER_KEYS='k1:…' --from-literal=NEUROUTER_ACTIVE_KEY_ID=k1 --from-literal=HASH_PEPPER='…'
kubectl create secret generic neurouter-db --from-literal=DATABASE_URL='postgres://…'
helm install neurouter oci://ghcr.io/neurouter/charts/neurouter-hub --version 0.2.0 \
--set publicUrl=https://mcp.example.com \
--set crypto.existingSecret=neurouter-crypto --set database.existingSecret=neurouter-db \
--set oidc.issuer=https://idp.example.com --set oidc.clientId=neurouter --set oidc.existingSecret=neurouter-oidc \
--set ingress.enabled=true --set ingress.host=mcp.example.comThe chart is also in this repo at deploy/helm/neurouter-hub; it defaults to the
ghcr.io/neurouter/hub image at the chart's appVersion.
Postgres 16+ with the
vectorextension is required for more than one replica (SQLite is single-process). Replicas coordinate through Postgres (LISTEN/NOTIFY, advisory locks, leases), so rate limits, approvals and caches are shared; no Redis is needed.Defaults: 2 replicas,
RollingUpdatewithmaxUnavailable: 0, a PodDisruptionBudget, a read-only root filesystem with anemptyDiron/tmp, andmigrations.mode=job(a pre-upgrade Job migrates and pods skip it; the first install migrates on pod start). Migrations are forward-only and additive, so old and new pods run side by side during a rollout.terminationGracePeriodSecondsisapprovals.maxTimeoutSec + 30, so calls held for human approval can finish during a rollout. Keep it at least theapprovalMaxTimeoutSecsetting.Ingress: SSE (
/mcpheld calls,/api/approvals/stream) needs proxy buffering off and long read timeouts; the chart's nginx annotations set both.Optional:
metrics.serviceMonitor.enabled,autoscaling.enabled,networkPolicy.enabled(cloud metadata endpoints are always denied),archive.urlfor audit retention archives.
Keys: generation and rotation
Variable | What it protects | Rotation |
| KEKs ( | supported, see below |
| which KEK wraps new DEKs | |
| HMAC pepper for API keys and OAuth tokens | changing it invalidates every API key and OAuth token |
npm run keys -- gen [keyId] prints fresh values. Store them in a secret manager and back them
up: without the KEKs, stored credentials can't be decrypted, and without the pepper no API key
works.
KEK rotation (no downtime):
Generate a new key (
npm run keys -- gen k2) and append it:NEUROUTER_MASTER_KEYS=k1:…,k2:…. SetNEUROUTER_ACTIVE_KEY_ID=k2and roll the deployment.As an admin,
POST /api/system/keys/rotate {"type":"rewrap"}rewraps every DEK underk2. PollGET /api/jobs/:id. The result'skekIdsInUselists the KEKs still referenced.When
k1is no longer inkekIdsInUse, remove it fromNEUROUTER_MASTER_KEYSand roll again.
DEK rotation: POST /api/system/keys/rotate {"type":"dek"} creates a new data key, re-encrypts
every secret under it and deletes retired DEKs that nothing references.
API keys look like nr_live_<10-char id>_<43-char secret>. The fixed prefix lets secret scanners
match them (e.g. a GitHub custom pattern nr_live_[0-9A-Z]{10}_[0-9A-Za-z]{43}). Only an HMAC of
the secret is stored; a leaked key is revoked from the agent's page and stops working at once on
every replica.
Backup and restore
What to back up: the main database, the audit database if
AUDIT_DATABASE_URLis separate, and the crypto secret (KEKs + pepper). A database backup without the keys can't decrypt upstream credentials; the keys without the database are useless.Postgres:
pg_dump -Fc "$DATABASE_URL" > neurouter.dump(and the same for the audit DB). Restore into an empty database withpg_restore -d "$DATABASE_URL" neurouter.dump, start Neurouter Hub with the same crypto values, then run an audit verification (below).SQLite: stop the server (or use
sqlite3 neurouter.db ".backup backup.db"while it runs), then copy the file. Restore by putting the file back atDATABASE_URL.Audit retention archives (
AUDIT_ARCHIVE_URL:file:,s3://,gs://,azblob://) are written before rows are deleted; keep them under the same retention policy as your backups.Migrations are forward-only in production: restore a backup taken by the same or an older version, then let the newer version migrate it.
Audit log verification
Every audit row is hash-chained (sha256(prev_hash ‖ JCS(row))), and a checkpoint signed with an
HMAC key derived from the KEKs is written every 10,000 rows or 5 minutes, on key rotation and before
every retention cut.
UI: Audit log → Verify. API:
POST /api/audit/verify {"from"?, "to"?}(ISO timestamps; omit both to verify the whole retained log) (auditor or admin) returns202 {jobId}; pollGET /api/jobs/:id. The result is{ ok, checked, firstSeq, lastSeq, checkpointsVerified, brokenAt };brokenAtnames the first row whose hash, link or checkpoint doesn't match. The run itself is audited.Threat model, honestly: someone with database write access can rewrite rows and recompute the chain, but can't forge checkpoint MACs without the KEKs. Deleting the newest rows is only detectable up to the last checkpoint that left the database, so export audit events (webhook or OTLP logs sink, Settings → Export) to a system the database admins don't control.
Security model
Identity: people sign in with OIDC (authorization code + PKCE); sessions are server-side, HttpOnly cookies with CSRF tokens. Roles come from IdP groups (
OIDC_ADMIN_GROUPS,OIDC_AUDITOR_GROUPS).AUTH_DEV_LOGINis refused outside development.Agents authenticate to
/mcpwith an API key or an OAuth access token issued by Neurouter Hub's own authorization server (RFC 8414 metadata, client ID metadata documents, dynamic registration, PKCE S256, audience-bound tokens, rotating refresh tokens). Client tokens are never forwarded upstream.Authorization: grants on servers or tools to users, groups or agents; deny wins; an agent can be narrowed below its user. Tools the caller may not use are indistinguishable from unknown tools, in search results and in errors.
Tool pinning: each tool definition is hashed and must be approved; a changed upstream definition ("rug pull") is blocked until an owner re-approves it. Arguments are validated against the pinned schema.
Human approval:
requires_approvaltools are held until an owner or admin approves (never the requester), the approval expires, or the client cancels. Clients that time out sooner should send aprogressToken; Neurouter Hub sends progress every 10 s while a call is held.Upstream credentials (shared bearer, headers, per-user OAuth) are envelope-encrypted (AES-256-GCM DEKs wrapped by the KEKs). Outbound requests are SSRF-guarded: cloud metadata ranges are always denied, private networks are configurable (
UPSTREAM_ALLOW_PRIVATE_NETWORKS,OUTBOUND_ALLOW_PRIVATE_NETWORKS).Audit: every MCP call, search, admin change and sign-in is audited with redaction rules applied before storage (secrets in arguments are never written).
Web: strict CSP (
default-src 'self', no inline script),frame-ancestors 'none', and the/mcpendpoint checksOriginagainstPUBLIC_URLandMCP_ALLOWED_ORIGINS.
Scripts (repo root)
Command | What it does |
| server + web in watch mode |
|
|
| runs the built server ( |
| all Vitest unit tests (projects: shared, server, web) |
| build, then the Playwright browser suite ( |
| tests with v8 coverage |
|
|
| ESLint (flat config) |
| migration CLI ( |
| generate crypto env values |
Repository layout
package.json · tsconfig.base.json · tsconfig.json · vitest.config.ts · eslint.config.js · .env.example
scripts/dev.mjs # starts server, waits for /healthz, starts web
packages/shared/ # @neurouter/shared — isomorphic, zod only (no Node imports)
src/domain/ # enums, roles, capabilities + can() (shared by server guards and the UI)
src/mcp/ # tool naming (<slug>__<tool>), _meta keys, meta-tool JSON Schemas
src/api/ # the Phase 1 REST contract: one file per area (zod request/response
# schemas + types), common.ts (Problem, Page<T>, cursor query),
# endpoint.ts (endpoint()/buildPath/serializeQuery), routes.ts (registry)
apps/server/ # @neurouter/server — Fastify 5 API + (later) MCP gateway
src/main.ts · app.ts # bootstrap / pure wiring (buildApp is fastify.inject-testable)
src/config/ # zod env schema (env.ts) + loader (load.ts)
src/lib/ # clock, ids (UUIDv7), crypto, JCS, errors, pagination, json, logger
src/api/ # problem+json error handler, registerEndpoint() from the shared contract
src/db/ # Kysely: sqlite.ts (better-sqlite3 + sqlite-vec), postgres.ts (pg + pgvector),
# index.ts (main + audit DBs), migrator.ts, schema.ts, migrations/{main,audit}
src/audit/store.ts # AuditStore interface (+ SQL scaffold stub)
src/coordination/ # CoordinationStore interface + in-memory implementation
src/jobs/scheduler.ts # croner + lease-based leadership
src/health/ · src/web/ # /healthz /readyz /health · production static serving + SPA fallback
src/scripts/ # migrate.ts, keys.ts CLIs
src/test/fakes/ # test DB, recording Kysely driver (compiles Postgres SQL without a DB), app builder
apps/web/ # @neurouter/web — Vite 8 + React 19 + Tailwind 4 + shadcn (Base UI)
index.html · public/theme-init.js # pre-paint theme script (light/dark/system, CSP-safe)
vite.config.ts · dev-proxy.ts # TanStack Router plugin, dev proxy from NEUROUTER_DEV_API_URL
src/app/ # router, query client (401/403 policy), providers, nav IA, route guards
src/routes/ # file routes (TanStack Router); routeTree.gen.ts is generated
src/components/ui/ # shadcn-generated (CLI-owned)
src/components/layout/ # app shell: sidebar (per role), top bar (breadcrumbs, theme, user menu)
src/features/auth/ # me/badges queries, guards (requireAuth, requireAnyCapability, landingPath)
src/lib/ # api-client (problem+json → ApiError, CSRF, contract parsing)
src/mocks/ # MSW handlers generated from the shared contract + fixturesDatabase
Local:
DATABASE_URL=sqlite:./data/neurouter.db(relative toapps/server). sqlite-vec is loaded on every connection; FTS5 is compiled into better-sqlite3.Production:
DATABASE_URL=postgres://…(PG 16+, target 18) with thevectorextension (the migration runsCREATE EXTENSION IF NOT EXISTS vector; it fails with a clear message if the role lacks the privilege).Audit DB:
AUDIT_DATABASE_URL(optional, defaults toDATABASE_URL). Audit log, sessions and metric rollups live there, with their own pool and migration table (kysely_audit_migration).Migrations are TypeScript, one set per database, applied under Kysely's DB lock (safe with replicas). Production is forward-only.
Environment
All variables are documented in .env.example. Production requires PUBLIC_URL
(https), NEUROUTER_MASTER_KEYS, NEUROUTER_ACTIVE_KEY_ID, HASH_PEPPER and the OIDC trio. In
development the server falls back to ephemeral keys (with a warning) so it boots with no .env.
Web dev variables (read by apps/web/vite.config.ts from the repo-root .env):
NEUROUTER_DEV_API_URL (required for dev:web), NEUROUTER_WEB_DEV_PORT (optional),
VITE_ENABLE_MSW. When you use the UI through Vite, set PUBLIC_URL to the Vite origin.
Tests
Unit tests (Vitest 5): npm test. Server tests run against in-memory SQLite with all
migrations; Postgres SQL paths are compiled through a recording Kysely driver and asserted without
a database. Web tests use jsdom, Testing Library and MSW handlers generated from the contract.
End-to-end (Playwright, Chromium): npm run test:e2e builds everything, then
apps/web/playwright.config.ts boots the built server (SQLite in a temp dir, dev login,
generated keys) and fake upstream MCP servers (apps/web/e2e/support/upstream-server.ts) on free
ports. Specs seed data through the API with unique names, so they are independent and run in
parallel. First time: npx playwright install chromium. After a build you can run
npm run test:e2e -w @neurouter/web -- e2e/catalog.spec.ts for one spec. Vitest never picks up
apps/web/e2e.
License
Available Tools
2 toolscall_toolCall a toolA
Execute a tool returned by search_tools. Pass the exact name and arguments matching its inputSchema.
Inputs: name (required), arguments.
search_toolsSearch available toolsARead-only
Find tools you are allowed to use across all connected servers. Returns the best matches with their input schemas. Call a result with call_tool.
Inputs: query (required), limit, server, includeSchemas. Returns: tools, totalAllowed
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly separate roles: search_tools discovers tools and their schemas, while call_tool executes a selected tool. There is no overlap or ambiguity between discovery and execution.
Both names follow a consistent verb_noun snake_case pattern: search_tools and call_tool. The convention is predictable and readable.
Two tools are minimal but sufficient for a router whose job is discovery plus execution. It is slightly under the typical 3-15 range, but each tool clearly earns its place.
The surface covers the essential lifecycle: find an allowed tool, inspect its input schema, then call it. Minor gaps exist around explicitly listing all available tools or servers, but core workflows are supported.
Maintenance
Related MCP Connectors
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
An MCP gateway for teams deploying AI tools at scale to employee-facing and headless agents.
Open-source MCP gateway with per-agent tool permissions, call approvals and tool-change review.
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceGoverned MCP gateway that lets AI agents call tools with policy enforcement, prompt-injection screening, a kill-switch, and tamper-evident signed audit logs.Apache 2.0- FlicenseNot gradedqualityDmaintenanceMCP server that provides a security gateway for AI agents, enforcing allow/confirm/deny policies on tool calls and requiring human approval for risky operations, with full audit logging.-

AISIX AI Gatewayofficial
AlicenseAqualityAmaintenanceSelf-hosted MCP gateway that registers upstream MCP servers and fronts them behind one governed Streamable HTTP endpoint: per-tool access control by caller API key, guardrails over tool arguments and results, rate limits, and usage logs. The same Rust gateway also proxies LLM and A2A agent traffic.1231Apache 2.0- AlicenseNot gradedqualityDmaintenanceActs as an MCP gateway between AI agents and upstream tool servers, evaluating YAML policies on every tool call, injecting real credentials at the last mile, scanning requests and responses for secrets, PII, and prompt injection, and recording each action in a tamper-evident audit log. Also supports HTTP forward-proxy governance with rate limiting, cost tracking, and policy replay against historical audit data.4Apache 2.0