Documentation
A condensed reference. The complete one is on GitHub: every setting and environment variable in docs/configuration.md, the API in docs/api.md, and remote-server sign-in in the README.
Configuration
All config lives in the Postgres that DATABASE_URL names, which must be a
postgres:// URL: the router refuses to start without one. The compose files run a
postgres:18 beside it (DB_CONNECT_TIMEOUT_MS bounds how long boot waits for it).
Migrations run on boot. Manage it from the web UI or /graphql; there are no config files to
edit. The shapes below are what each row holds, written as JSON.
If something other than the router writes the tables, have it re-read them:
curl -X POST -H "x-api-key: $MCP_ROUTER_API_KEY" -H 'Content-Type: application/json' \
-d '{"query":"mutation { reloadConfig { reloaded serverCount } }"}' \
http://localhost:3000/graphql
Settings
{
"port": 3000, // PORT env wins over this
"allowedOrigins": [], // extra browser Origins allowed to reach /mcp
"idleTimeoutMs": 300000, // default stdio idle shutdown (ms)
"sessionIdleTimeoutMs": 1800000, // reclaim an idle MCP session after this (ms)
"maxSessions": 1000 // cap on live sessions; LRU-evicted past it
}
One row. The Settings page edits the timeouts, publicUrl and network discovery; the port and
address are set through the environment. The old authToken is imported as an API key on
boot and cleared; authEnabled is ignored.
The optional host setting (or HOST env) picks the bind interface. Leave it
unset to bind all interfaces — that's what Docker and LAN exposure need, so the
published port stays reachable. Set it to 127.0.0.1 only for a bare-metal,
localhost-only install; inside a container that would make the mapped port refuse connections.
The /mcp endpoints run stateful sessions: initialize mints an
Mcp-Session-Id reused across the session's requests and its GET SSE stream. Idle sessions are
reclaimed after sessionIdleTimeoutMs, and a browser Origin guard (loopback +
allowedOrigins) fronts /mcp to block DNS-rebinding — it applies even when auth is
disabled.
Registries
[
{ "name": "official", "url": "https://registry.modelcontextprotocol.io" }
]
Any MCP-registry-API-compatible service (GET {url}/v0/servers) works. The official
registry is seeded on first run.
Servers
One row per installed server. The name doubles as the route segment (/mcp/<name>)
and the install directory (data/servers/<name>). Names must match
^[a-z0-9][a-z0-9._-]*$ (max 64 chars). A local stdio server installed from a registry:
{
"name": "github",
"enabled": true,
"source": {
"type": "registry",
"registry": "official",
"serverName": "io.github.github/github-mcp-server"
},
"transport": {
"type": "stdio",
"command": "node",
"args": ["/data/servers/github/node_modules/.bin/github-mcp-server"]
},
"env": { "GITHUB_TOKEN": "ghp_..." }
}
Use "source": { "type": "npm", "package": "@scope/pkg" } to install straight from npm, or
"source": { "type": "remote" } with a streamable-http transport to proxy a
remote server without installing anything.
Workspaces
A workspace is a custom aggregate: it exposes a chosen subset of servers at its own
/mcp/w/<slug> endpoint. The slug is derived from the name; each member may override the base server's env, args, or
headers for this workspace only. Each member runs as an isolated downstream instance, so a
workspace can run a server that's globally disabled — and its overrides never touch the base server.
{
"name": "Coding assistant",
"slug": "coding-assistant",
"enabled": true, // false = the /mcp/w/<slug> endpoint 404s
"description": "GitHub + local files for a code client.",
"members": {
"github": { "enabled": true },
"filesystem": {
"enabled": true,
"args": ["/data/servers/filesystem", "/srv/repo"], // replaces the base args
"env": { "READ_ONLY": "1" } // merged over base env
}
}
}
The effective enabled state of a member is workspace.enabled && member.enabled — the base
server's own enabled flag is ignored inside a workspace. A member must name an installed server,
and deleting a server removes it from every workspace.
Upgrading from 2.x
Older routers kept their config as JSON files under DATA_DIR/config. The new router needs
a Postgres: add the postgres service from the compose file beside it, or use one you already
run, and set DATABASE_URL. On its first boot,
while the database is empty, the router imports them in one transaction and renames each one
*.imported; after that they are never read again. The image now runs as uid 1000, so a data
folder an older (root) image wrote needs sudo chown -R 1000:1000 data. To back up, use
pg_dump, plus DATA_DIR/servers for the installed npm packages.
GraphQL API
The router is managed through GraphQL at POST /graphql, with your session in the UI or an API key elsewhere; the same
schema is offered to agents as MCP tools at /admin/mcp. There is no REST API. Every field
describes itself: outside production, open /graphql in a browser for GraphiQL. A refused
operation carries its reason in extensions.code.
| To | Use |
|---|---|
| Router status | routerStatus |
| Registries | registries, createRegistry, deleteRegistry, registryServers |
| Servers and their live state | servers, serverRuntimes |
| Install, edit, remove a server | installServer, updateServer, deleteServer |
| Restart a server (after env edits) | restartServer |
| What a server offers | serverTools, serverResources, serverPrompts |
| Try a tool, resource or prompt | callServerTool, readServerResource, getServerPrompt |
| Workspaces | workspaces, saveWorkspace, deleteWorkspace, and the workspace… forms of the above |
| Re-read config from the database | reloadConfig |
| Sign in, and who is signed in | authConfig, setUp, verifyOidcSignIn, me, signOut |
| Sign another device in, change your address | createSignInLink, spendSignInLink, changeEmail |
| Pair an OIDC provider | ssoSetup, pairSso, unpairSso |
| API keys (a person only) | apiKeys, createApiKey, revokeApiKey |
MCP endpoints
| Endpoint | Purpose |
|---|---|
POST/GET/DELETE /mcp/<name> | Proxy 1:1 to that server |
POST/GET/DELETE /mcp | Aggregate of all enabled servers, <server>__ prefix |
POST/GET/DELETE /mcp/w/<slug> | A workspace's custom aggregate — same <server>__ prefix |
They speak streamable HTTP and take an API key, as Authorization: Bearer or
x-api-key; a UI session never opens them. An admin can open them without a key in Settings (Open /mcp without a
key), which only takes effect while the router's address is a private one. Disabled servers return 404; a missing or dead key
returns 401 before any MCP handling.
Security notes
- Secrets are plaintext in the database (env values, remote headers, OAuth tokens, the OIDC pairing's secret); API keys are stored as hashes. Anyone who can read the Postgres database, its volume or a dump of it can read them. Protect it, and its backups.
- An API key is a password. Give each client its own and revoke one that leaks. Keys
can't make or revoke keys, end sessions, change sign-in or edit settings: only a signed-in person can.
Open /mcp without a key makes the network the credential for
/mcp, so the router refuses it at a public address. - Don't expose the router directly to the internet — it speaks plain HTTP. Put it behind a TLS-terminating reverse proxy, or bind to localhost / a private network.
- Installed servers run as child processes with the env you configure. Installing a server means running its code with those secrets — install packages you trust.