Properties
auth?
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?
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). Only affects the
HTTP transport — 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.
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?
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).