Properties
auth?
oauth and auth are set, oauth serves the
endpoint and auth is ignored.
cacheHints?
ttlMs / cacheScope) for the 2026-07-28 protocol revision’s
cacheable results (tools/list, prompts/list, resources/list,
resources/templates/list, resources/read, server/discover), keyed by
operation. Only affects modern (2026-07-28) responses — 2025-era responses
never carry these fields. Omitted operations (or omitting this option
entirely) keep the conservative defaults (ttlMs: 0, cacheScope: 'private').
Applies uniformly per operation; per-resource cache hints are not currently
supported (that per-registration override is only available through the
SDK’s high-level McpServer.registerResource, which FastMCP does not use).
dnsRebinding?
run(): validates
the Host and Origin request headers (port-agnostic, by hostname) and rejects
mismatches with 403. Defends localhost servers against a malicious web page
whose DNS rebinds to 127.0.0.1 (MCP transport security best practice).
This option does not apply to fetch(), which has no bind address from which
to infer a trusted host. A framework embedding fetch() owns Host/Origin
validation at its HTTP boundary. stdio is unaffected.
Default posture (option omitted): protection auto-enables when, and only when,
run() binds the HTTP server to a loopback host (127.0.0.1, ::1,
localhost) — the deployment the attack targets. A server bound to a routable
interface (e.g. 0.0.0.0 or a public host) is left open by default, because a
localhost-only allowlist would reject its legitimate traffic; such deployments
must opt in with an explicit allowedHosts/allowedOrigins for their domain.
allowedHosts?
Host header hostnames (no port; IPv6 in brackets, e.g. [::1]).
Supplying this list also implies protection on. Default: localhost,
127.0.0.1, [::1].
allowedOrigins?
Origin header hostnames (a missing Origin always passes — non-browser
clients send none). Supplying this list also implies protection on. Default:
localhost, 127.0.0.1, [::1].
enabled?
true) or off (false). Omit for the loopback-auto default.
eventBus?
subscriptions/listen streams
subscribe to, and tool()/resource()/prompt() registration publishes
change events onto. Defaults to an in-process bus, which is correct for a
single server process. Supply your own ServerEventBus implementation over a
shared pub/sub backend (e.g. Redis) for a horizontally-scaled deployment,
where a subscriptions/listen stream and the request that changed the list it
cares about may land on different processes.
http?
ctx.http. redactHeaders adds names to
the sensitive set withheld from ctx.http.headers (defaults:
authorization, cookie, proxy-authorization, mcp-session-id); use it for
deployment-specific credentials such as a proxy shared-secret header.
exposeHeaders removes names from the set; it is the explicit, greppable
opt-out. Withheld names are listed in ctx.http.redactedHeaderNames.
Redaction applies to ctx.http only; a RequestVerifier always sees the
full wire headers.
cors configures the CORS posture of the HTTP listener run() starts
(both serve paths): omitted or true serves the permissive defaults
(Access-Control-Allow-Origin: *), false disables CORS handling
entirely, and an object narrows it — see CorsOptions. Malformed
values throw here, at construction, for every transport. fetch() is
unaffected: the embedding framework owns CORS at its HTTP boundary.
cors?
exposeHeaders?
redactHeaders?
inputRequired?
inputRequired) serving knobs (protocol revision 2026-07-28).
On 2026-era requests the client fulfils input_required returns directly; on
2025-era connections the SDK’s legacy shim fulfils them server-side (real
server→client requests + handler re-entry) — so handlers written with
inputRequired(...) serve both eras unchanged.
legacyShim?
false disables the legacy shim: an inputRequired(...) return on a 2025-era
request fails loudly instead of being bridged. Default: true.
maxRounds?
roundTimeoutMs?
logger?
console and Winston loggers satisfy the shape directly; see
the logging docs for a Pino adapter. Default: a built-in stderr logger
(styled on a TTY, plain single-line format otherwise). Client-facing MCP
logging (ctx.log) is a separate channel and is not affected. Do not use
logger: console with the stdio transport: console.info and
console.debug write to stdout, which carries the JSON-RPC stream on
that transport.
logLevel?
middleware?
name
oauth?
promptsPageSize?
requestState?
requestState
(protocol revision 2026-07-28) — see ctx.requestState() / ctx.mintRequestState().
Backed by the SDK’s createRequestStateCodec. When omitted, requestState passes
through unverified (the raw wire string) — the client can read and tamper with it,
so this MUST be configured for any flow whose requestState influences
authorization, resource access, or business logic.
bind?
requestState to, e.g., the authenticated principal and/or the
originating method — a value minted under one binding is rejected when echoed
under a different one. See RequestStateCodecOptions.bind.
Parameters
ctx
ServerContext
Returns
string
key
string is UTF-8-encoded; MUST be at least 32 bytes (256 bits).
ttlSeconds?
requestState stays valid, in seconds. Default: 600 (10 minutes).