Skip to main content
FrontMCP provides transport-level security controls for CORS, network binding, DNS rebinding protection, and host header validation. The defaults are the safe choice — the server binds loopback and sends no CORS headers — so reaching it from another host or another origin is something you opt into. In production, FrontMCP logs a security audit at startup and offers a strict mode that enables the remaining protections at once.
Changed in v1.7.0. security.bindAddress now defaults to 'loopback' (was '0.0.0.0'), and omitting cors now sends no CORS headers (was { origin: true }). A container or VM that must be reachable from outside now needs an explicit opt-in — see Bind Address. See BREAKING_CHANGES.v1.md entries BC-033 and BC-034.

Quick Start

Enable strict security mode for production:

Security Options

CORS Configuration

By default FrontMCP sends no CORS headers at all. A cross-origin request still reaches the server and is served normally — the browser simply refuses to let the calling page read the response. Non-browser clients (the MCP CLI, an agent runtime, curl) are unaffected: CORS is a browser rule, not server-side access control. If you need to keep callers out, use authentication. If a browser on another origin needs access, say so explicitly:
cors: false is the same runtime state as omitting the option — no headers — and exists only to say so explicitly:
To restore the pre-v1.7.0 permissive behaviour, ask for it by name:
origin: true reflects the request origin header, effectively allowing any website to make cross-origin requests — including any page a developer happens to have open while a local server is running. It should never be used in production.

Bind Address

Controls which network interface the server listens on. The default is 127.0.0.1 — a server that says nothing about security is local-only. The effective address is resolved in this order, first match wins:
  1. http.security.bindAddress in the server config
  2. The FRONTMCP_BIND_ADDRESS environment variable (all, loopback, or a literal address)
  3. Strict mode — 0.0.0.0 for a distributed deployment, 127.0.0.1 otherwise
  4. Distributed deployment mode — 0.0.0.0
  5. The default — 127.0.0.1

Containers and VMs

A container publishes a port and expects the process inside to listen on every interface, but a Dockerfile cannot reach into the server’s TypeScript config. Set the environment variable instead — no rebuild required:
Projects scaffolded by frontmcp create with the Docker target already set this.
Distributed builds (frontmcp build --target distributed, which sets FRONTMCP_DEPLOYMENT_MODE=distributed) bind all interfaces automatically — a distributed deployment must be reachable by its peers. Serverless targets (Vercel, Lambda, Cloudflare) never bind a port at all, so this setting does not apply to them.

Strict Mode Behavior

When security.strict: true:
  • Standalone mode: binds to 127.0.0.1 (loopback only)
  • Distributed mode: binds to 0.0.0.0 (pods need external access)

Explicit Override

When running behind a reverse proxy (NGINX, Traefik, Envoy), bind to loopback and let the proxy handle external traffic.

DNS Rebinding Protection

Validates the HTTP Host and Origin headers against an allowlist. When a request arrives with an unrecognized host, the server responds with 403 Forbidden.
  • allowedHosts: Matches the Host header exactly (include port if non-standard)
  • allowedOrigins: Matches the Origin header exactly (include scheme)
  • If allowedOrigins is set, requests without an Origin header are allowed through (non-browser clients)
DNS rebinding attacks use a malicious domain that resolves to 127.0.0.1, tricking a browser into making requests to your local server. Host validation blocks these requests.

Request Body Limits

FrontMCP’s Express host applies a default request body limit of '4mb' to both express.json() and express.urlencoded() — lifting body-parser’s silent 100KB default, which routinely rejected base64-encoded blobs (PDFs, DOCXes, large HTML inputs) before they reached MCP tool handlers (issue #410). Override the limits via the http block on @FrontMcp:
When a request exceeds the configured limit, the adapter returns HTTP 413 with a structured JSON-RPC envelope:
Security trade-off. Body-parser buffers the full request body in memory before parsing, so raising bodyLimit scales per-request memory with concurrency. Deployments exposed to untrusted networks should set an explicit lower bound (e.g. '500kb' or '1mb') sized for the largest legitimate payload. The 100KB → 4MB default change in this release is a liberalization — every request that succeeded before still succeeds, but the implicit DoS guard is gone unless you set the option yourself.
Custom hostFactory users build their own Express app and are not affected by bodyLimit/urlencodedLimit — those options are consumed only by the built-in ExpressHostAdapter. Custom-host deployments must configure their own body limits.

Security Audit Warnings

In production (NODE_ENV=production) or distributed mode, FrontMCP logs security warnings at startup:
A server on the defaults logs only info-level findings — CORS_DISABLED and BIND_RESTRICTED — because the defaults are already the safe choice. The audit reports; it never changes behaviour. Use it to check what your configuration actually exposes before going to production.

Production Checklist

  • Set explicit cors.origin (not true) — only if a browser on another origin needs access
  • Enable security.dnsRebindingProtection with allowedHosts
  • Confirm the bind address: loopback behind a reverse proxy, FRONTMCP_BIND_ADDRESS=all in a container
  • Configure TLS termination at the reverse proxy layer
  • Set NODE_ENV=production for security audit warnings
  • Review startup logs for [Security] warnings
  • Tune http.bodyLimit to your largest legitimate payload

Example: Full Production Config

Security Headers & CSP

Content Security Policy, HSTS, and X-Frame-Options

High Availability

Distributed sessions, heartbeat, and session takeover

Redis Setup

Redis connection and session store configuration

Production Build

Build and deploy for production