Mode Overview
Theauth.mode literal accepts one of five values: 'public', 'static', 'transparent', 'local', 'remote'.
Mode Comparison
Public Mode
No authentication required. All requests receive an anonymous session.How It Works
Configuration Options
Use Cases
Development
Rapid prototyping without auth setup overhead
Public APIs
Endpoints that don’t require user identity
Bearer tokens in public mode. A JWT is still verified against this instance’s own HS256 secret, so a valid gateway token upgrades the request to that identity. A bearer token that is not a JWT is ignored and the request is served anonymously — public mode has no issuer, JWKS or audience to verify it against, and a request carrying a credential must never fare worse than the same request without one.That also means a
@Will('checkAuthorization') hook can implement its own shared-secret check without having to strip the header before the built-in verifier sees it. For a first-class shared secret, prefer static mode.Static Mode
A fixed shared secret presented on every request — the shape every non-OAuth MCP host expects. ChatGPT’s custom-app connector calls it Access token / API key: it attaches a constantAuthorization: Bearer <token> and never performs an OAuth exchange.
How It Works
- The credential is read from the configured header (
authorizationby default), and the scheme prefix (Bearerby default, matched case-insensitively) is stripped. - It is compared against each configured token in constant time, over SHA-256 digests, so neither the secret’s value nor its length is observable through timing.
- A match produces an authenticated session whose
subisstatic:<12 hex chars>— a non-reversible digest prefix of the token that matched, so audit logs and per-subject partitions (rate limits, sessions) can tell configured tokens apart without the secret appearing anywhere. - Anything else answers
401with aWWW-Authenticate: Bearer realm="…"challenge. Unlike public mode, a missing credential is also a 401.
Configuration Options
An API-key header with no scheme prefix:
Static mode is checked entirely in the
session:verify flow’s handleStaticToken stage, before any other authentication stage runs. The server still exposes the OAuth discovery endpoints that public mode does; nothing uses them in this mode.Transparent Mode
Pass-through tokens from an external identity provider. FrontMCP validates tokens but doesn’t issue them.How It Works
Configuration Options
Claim validation
A valid signature only proves the IdP’s key signed the token — not that the token was minted for this server. Because every service behind the same IdP shares the same signing keys, FrontMCP enforces two claims on top of the signature:- Issuer (
iss) — must equalprovider(matched with or without a trailing slash) or one ofproviderConfig.additionalIssuers. Enabled by default. This stops a token minted by the same IdP for a different issuer from being replayed here. - Audience (
aud) — if the token carries anaud, it must matchexpectedAudience(or the derived resource URL). This stops a token issued for service A from being replayed against service B. Tokens with noaudclaim are accepted for IdP compatibility; setexpectedAudienceand issue audience-bound tokens for the strictest posture. - Expiry (
exp) — required. A token withoutexpwould never expire, so it is refused (401whoseerror_descriptionsaysexpis missing).
Provider Examples
- Auth0
- Okta
- Azure AD
Use Cases
Existing IdP Integration
Your organization already uses Auth0, Okta, or similar
Single Provider
All users authenticate through one identity provider
Local Mode
FrontMCP acts as a full OAuth 2.1 authorization server with a built-in login form. Self-contained auth server with built-in user management.JWT_SECRET environment variable (no RSA/EC key pair). See Local OAuth for token signing, persistent tokenStorage (memory / sqlite / redis), the requireEmail / anonymousSubject single-operator options, and tunnel/issuer configuration.
Local mode also orchestrates multiple upstream OAuth providers out of the box. Declare a providers array (GitHub, Slack, Jira, …) and FrontMCP federates them at /oauth/authorize, refuses to mint a JWT until federatedAuth.minProviders (default 1) are linked, stores each provider’s tokens encrypted server-side, and exposes them to tools via this.orchestration.getToken(id):
minProviders / requiredProviders gate, and the this.orchestration tool API.
Remote Mode
FrontMCP acts as an OAuth 2.1 authorization server that proxies user authentication to an upstream IdP. End users never submit credentials to FrontMCP directly — they’re redirected to the upstream IdP, and FrontMCP exchanges the resulting upstream code/tokens before issuing its own session token to the MCP client.How It Works
The upstream identity comes from the IdP’sid_token only when it verifies:
signed by a key the provider publishes (providerConfig.jwks, else
providerConfig.jwksUri, else <provider>/.well-known/jwks.json, else the
jwks_uri of the provider’s OAuth metadata or /.well-known/openid-configuration), issued by
provider (or providerConfig.additionalIssuers), for clientId, and not
expired. Otherwise FrontMCP asks the userinfo endpoint. A callback whose RFC 9207
iss names another server, and a sign-in the user declined at the IdP
(error=access_denied), end with an error page and no code.
Configuration Options
Consent Configuration
consent.enabled is true, the local flow renders an interactive tool-selection screen after login and enforces the selection at call time: the chosen tool ids are embedded in the token’s consent claim and a tools/call to an unselected tool is rejected with TOOL_NOT_CONSENTED (JSON-RPC -32003). The flags groupByApp, showDescriptions, allowSelectAll, requireSelection, customMessage, excludedTools, and defaultSelectedTools are all honored. See Local OAuth → Consent for the full table.
Tokens minted without consent (consent disabled, or created via the test/programmatic factory) carry no
consent claim and are unaffected — all tools remain callable. rememberConsent (default true) persists each user’s per-client selection and reuses it on the next login, re-prompting only when a NEW tool appears; set it false to always re-show the screen.Incremental Authorization
Federated Authentication Configuration
Configure how multi-provider (federated) authentication is gated and validated.OAuth Endpoints
Local and remote modes expose standard OAuth endpoints:Use Cases
Multi-Provider Federation
Combine multiple IdPs under one session (Slack + GitHub + custom)
Progressive Authorization
Users authorize apps incrementally as needed
Full Token Control
Custom token lifetimes, scopes, and refresh behavior
Tool-Authorization Enforcement
Gate tools via the interactive consent picker (shipped) and enforce the selection at call time
Discovery and Sessions by Mode
The protected resource metadata (/.well-known/oauth-protected-resource) advertises in scopes_supported the scopes a client can actually be given here:
Outside local and remote mode, the scopes entries declare on their
authProviders are listed too. A server that names no scope leaves scopes_supported out. The issuer named in discovery, on authorization responses and in tokens is the same for every request; see The issuer.
A session client (protocol revisions before 2026-07-28) resumes its session with the mcp-session-id header, or the ?sessionId= query parameter on the legacy SSE /message endpoint. The server serves the request under that id only when session:verify verified it: in public, static and anonymous transparent mode the id must decrypt under MCP_SESSION_SECRET and carry the signature of the mode (in static mode, of the token that opened it); in the authenticated modes it must also belong to the caller’s token. Any other id is answered with HTTP 404 (-32000), which tells the client to send initialize again; it is never used to look up a transport. An initialize that presents an unverified id starts a fresh session.
An MCP 2026-07-28 request has no session. An anonymous or static-key caller is identified for that request only (a fresh anon: subject, or static:<digest>), and no session is minted for it, so MCP_SESSION_SECRET is needed only for session clients (protocol revisions before 2026-07-28). In a tool, this.context.sessionId and this.authInfo.sessionId name the request, and this.context.verifiedSessionId is undefined: key anything that must outlive the request on the authenticated caller.
Mode Selection Flowchart
Security Comparison
Token Verification Flow
Next Steps
Remote OAuth
Configure upstream IdP integration
Local OAuth
Set up self-contained authentication
Progressive Authorization
Implement incremental app authorization
Production Deployment
Security checklist for production