Docs

Configuration reference

Every Neurouter environment variable with its default and what it does, from PUBLIC_URL and DATABASE_URL to OIDC, OAuth, embeddings, egress policy and telemetry.

Last updated: 2026-11-24 · Markdown

Neurouter is configured with environment variables, validated at start-up. An invalid value stops the server with a message naming the variable. In development the server also loads a .env file; in production it reads the real environment. Gateway behaviour that admins change at runtime (approval timeouts, rate-limit defaults, retention, audit export) lives in Settings → Gateway settings instead; see Runtime settings below.

Defaults below are the server's built-in defaults. The repository's .env.example sets some values differently for local development.

Production requirements

With NODE_ENV=production the server refuses to start unless:

  • PUBLIC_URL is set, starts with https:// and has no trailing slash;
  • NEUROUTER_MASTER_KEYS, NEUROUTER_ACTIVE_KEY_ID and HASH_PEPPER are set;
  • OIDC_ISSUER, OIDC_CLIENT_ID and OIDC_CLIENT_SECRET are all set.

AUTH_DEV_LOGIN=true is refused unless NODE_ENV=development. Outside production, missing keys fall back to ephemeral values with a warning, so the server boots with no .env.

Core

VariableDefaultDescription
NODE_ENVdevelopmentdevelopment, test or production.
HOST0.0.0.0Listen address.
PORT3000Listen port.
PUBLIC_URLhttp://localhost:PORT outside productionExternal origin users and clients use, e.g. https://mcp.example.com. The MCP resource is PUBLIC_URL/mcp; OIDC and OAuth redirect URIs and cookies are built from it.
TRUST_PROXYloopbackWhich reverse proxies to trust for client IP and protocol.
INSTANCE_ID—Optional replica identifier (also used in telemetry).
LOG_LEVELinfofatal, error, warn, info, debug, trace or silent.
LOG_PRETTYfalseHuman-readable logs instead of JSON.
ORG_NAMENeurouterOrganization name shown in the UI.

Database

VariableDefaultDescription
DATABASE_URLsqlite:./data/neurouter.dbsqlite: path for local evaluation, or postgres://… (PostgreSQL 16+ with pgvector) for production and for more than one replica.
AUDIT_DATABASE_URLsame as DATABASE_URLOptional separate database for the audit log, sessions and metric rollups.
AUDIT_ARCHIVE_URL—Where audit rows are archived before retention deletes them: file:, s3://, gs:// or azblob://.
DB_POOL_MAX20Main database pool size.
AUDIT_DB_POOL_MAX10Audit database pool size.
MIGRATE_ON_STARTtrueApply migrations when the server starts. The Helm chart can run them as a Job instead.

Encryption keys

VariableDefaultDescription
NEUROUTER_MASTER_KEYS— (required in production)Key-encryption keys as id:base64 pairs, comma-separated, for example k1:…,k2:…. Each must decode to 32 bytes; ids are 1–32 characters of letters, digits, _ or -.
NEUROUTER_ACTIVE_KEY_ID— (required in production)Which key wraps new data keys. Must be one of the ids above.
HASH_PEPPER— (required in production)HMAC pepper for API keys and OAuth tokens, at least 32 characters. Changing it invalidates every API key and token.

Generate all three with npm run keys -- gen. See Deployment for rotation.

Human sign-in (OIDC)

VariableDefaultDescription
OIDC_ISSUER—Issuer URL of your identity provider. Set together with the next two.
OIDC_CLIENT_ID—Client ID registered at the provider.
OIDC_CLIENT_SECRET—Client secret.
OIDC_DISPLAY_NAMESingle sign-onLabel on the sign-in button.
OIDC_SCOPESopenid email profileScopes requested at sign-in.
OIDC_GROUPS_CLAIMgroupsID-token claim that carries group names or IDs.
OIDC_ADMIN_GROUPS—Comma-separated group values that grant the Admin role.
OIDC_AUDITOR_GROUPS—Comma-separated group values that grant the Auditor role.
OIDC_ALLOWED_EMAIL_DOMAINS— (any)Comma-separated email domains allowed to sign in.
OIDC_GROUP_AUTO_CREATEfalseCreate a Neurouter group for every value in the groups claim.
BOOTSTRAP_ADMIN_EMAIL—Pre-provisions this email as an admin, so the first sign-in has admin rights.
AUTH_DEV_LOGINfalseEmail-only login without an identity provider. Development only.
SESSION_TTL_HOURS12Maximum length of a browser session.
SESSION_IDLE_MINUTES120Idle timeout of a browser session.

The redirect URI to register at your provider is PUBLIC_URL/api/auth/callback. Provider-specific steps: identity provider guides.

MCP endpoint and OAuth

VariableDefaultDescription
MCP_ALLOWED_ORIGINS—Extra browser origins allowed to call /mcp, in addition to PUBLIC_URL.
OAUTH_ACCESS_TOKEN_TTL_SEC3600Lifetime of access tokens issued to MCP clients.
OAUTH_REFRESH_TOKEN_TTL_DAYS30Lifetime of refresh tokens.
COORDINATION_BACKENDautoauto, memory or postgres. How replicas share rate limits, approvals and caches.

Tool search embeddings

VariableDefaultDescription
EMBEDDINGS_ENABLEDtrueUse vector search in addition to keyword search.
EMBEDDINGS_MODELonnx-community/granite-embedding-small-english-r2-ONNXLocal embedding model.
EMBEDDINGS_DTYPEq8fp32, fp16, q8 or q4.
EMBEDDINGS_DIMS384Embedding dimensions.
MODELS_DIR./modelsWhere models are cached.
EMBEDDINGS_ALLOW_REMOTEtrueAllow downloading the model. The container image bakes the model in and sets this to false, so it needs no network access for models.

Outbound network policy

VariableDefaultDescription
UPSTREAM_ALLOW_PRIVATE_NETWORKStrueAllow upstream MCP servers on private networks.
UPSTREAM_DENY_CIDRS169.254.0.0/16,fd00:ec2::/32Address ranges upstream calls may never reach (cloud metadata by default).
OUTBOUND_ALLOW_PRIVATE_NETWORKSfalseAllow other outbound fetches (for example OAuth metadata or client metadata documents) to private networks.
OUTBOUND_ALLOW_HTTP_LOOPBACKfalseAllow plain-HTTP loopback targets, for local testing.
HTTPS_PROXY—Proxy for outbound HTTPS.

Telemetry and web app

VariableDefaultDescription
METRICS_ENABLEDtrueServe Prometheus metrics at /metrics.
METRICS_TOKEN—If set, /metrics requires Authorization: Bearer <token>.
OTEL_SDK_DISABLEDtrueSet to false to enable OpenTelemetry. Standard OTEL_* variables (OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES, OTEL_METRICS_EXPORTER=otlp) configure the exporters.
WEB_DIST_DIR../web/distLocation of the built web app.
SERVE_WEBtrue in productionServe the web app from the API server.

See Observability for details.

Runtime settings

These are stored in the database and edited by admins in Settings → Gateway settings (or through the admin API). Defaults:

SettingDefault
Audit retention90 days
Store full tool output in the audit logoff (outputs are stored as size and hash)
Metrics retention14 days of per-minute rollups, 400 days of hourly rollups
Approval timeout5 minutes (maximum 15)
Allow self-approvaloff
Rate limit per agent600 per minute, burst 120
Rate limit per agent and tool120 per minute, burst 30
Session idle gap30 minutes
Catalog visibilityall servers visible in the portal (all) or only granted ones (granted)
OAuth dynamic client registrationon
Client ID metadata documentsany host, or an allowlist
Audit exportwebhook and OpenTelemetry logs, both off