Docs

Environments and credentials

The built-in mock, dev/QA/prod environments, secret references, per-tool write switches, production confirmation, limits and policies.

Last updated: 2026-11-26 · Markdown

An environment is where a server's calls go. Each one is a separate MCP endpoint, /mcp/{server}/{env}, with its own base URL, credentials, write switches, limits and policies. API keys and OAuth tokens are bound to one environment.

The mock environment

Every server has a built-in mock environment (unless you declare one named mock). It answers from data generated from the spec: resources are inferred from paths, seeded deterministically, and support list, create, read, update and delete. State is in memory and can be reset. Evals use mock by default; you can also run npx neurouter mock --spec <file> to serve the same mock over HTTP.

Kinds

KindMeaning
devDevelopment; writes may be enabled without confirmation
qaTest; same rules as dev
prodProduction; writes, when enabled, always need confirmation; evals never run here

Names are free-form; the kind sets the rules.

Read-only by default

A new environment has writes.enabled: false, and every write tool is refused, whether called directly, through search, inside a script or by a composite. Enable writes for all write tools or for a list:

writes:
  enabled: true
  tools: [add_order_note]       # omit to allow every write tool
  confirm: elicit               # elicit or deny_without_elicitation (any kind); prod default elicit

Write confirmation

On prod, confirm defaults to elicit and confirm: none is invalid. Other kinds default to none, and you can set a confirmation mode there too. With either mode, the user confirms each write in their client (MCP elicitation); the agent can never confirm its own writes. In code mode, executing a script that writes first runs a dry run, asks once with the planned changes, and then allows only the writes in that approved plan.

The modes differ for clients that cannot ask the user:

ModeClient without elicitation
elicitNothing is changed. The call returns the planned change (method, path and arguments; for a script, its dry-run plan) in the error and in _meta["dev.neurouter/planned-changes"], so the user can review it and approve it from a client that can ask
deny_without_elicitationRefused, with no details of the planned change

Elicitation works with clients on the 2026-07-28 MCP protocol revision that declare the elicitation capability. Clients on the older 2025-11-25 revision count as unable to ask: Neurouter serves them statelessly, and a stateless server cannot receive their answer to a server-initiated request. neurouter_whoami reports the environment's mode and whether the current client can confirm (client_can_confirm).

Credentials

Configuration holds references, never values:

ReferenceResolved from
env:NAMEthe server's process environment, at call time
secret:NAMEa secret stored encrypted in the database, set in the console

Supported auth.type: none, bearer, header, query, basic, oauth_client_credentials, and oauth_passthrough (each user connects their own account to the upstream API once). Credentials never reach tool results, scripts, logs or the audit log.

Limits

limits:
  rateLimit: { perMinute: 300, burst: 60 }       # per principal
  toolRateLimit: { perMinute: 120, burst: 30 }   # per principal per tool
  timeoutMs: 15000
  maxResponseBytes: 2097152
  code: { maxToolCalls: 200, wallTimeSec: 30, cpuTimeSec: 10, maxMemoryMb: 64, maxConcurrentCalls: 8, maxResultBytes: 1048576 }

These are the defaults; set only the values you want to change.

Policies

Basic YAML policies deny calls by tool, tag, argument pattern, time window or call sequence within a task; the first matching deny wins.

policies:
  - name: no-external-write-after-sensitive-read
    deny: { sequence: { first: { tags: [read-sensitive] }, then: { tags: [external-write] } }, within: task }

A built-in policy (no-raw-urls) refuses path-parameter arguments that look like absolute URLs or contain ... Outbound requests go only to the environment's allowedHosts (by default, the base URL's host).

Kill switches

Switches at global, server, environment and tool level turn off all calls, writes only, or code mode, immediately.