FASTMCP_ prefix. Settings are loaded from environment variables and from a .env file.
.env file is loaded by setting the FASTMCP_ENV_FILE environment variable (defaults to .env). Because this controls which file is loaded, it must be set as an environment variable — it cannot be set inside a .env file itself.
Logging
To turn on debug logging from your own entry point, for example behind a
--debug flag, pass log_level to run() instead of reconfiguring logging yourself. It applies to every transport for as long as the server runs:
Transport & HTTP
These control how the server listens when running with an HTTP transport.
MCP SDK 2.2 also limits concurrent stateful HTTP sessions to 10,000. Keeping
the default idle timeout lets abandoned sessions expire and frees capacity for
new connections. Disabling it means clients must explicitly close their sessions
to release that capacity. Stateless HTTP does not use the session pool.
Error Handling
Client
CLI & Display
Telemetry
Tasks (Docket)
Task settings (theFASTMCP_DOCKET_ and FASTMCP_TASKS_ variables) live in the optional fastmcp-tasks package. See server tasks for configuration, including FASTMCP_TASKS_ENCRYPTION_KEY for encrypting task snapshots at rest.
Security
These control FastMCP’s SSRF protection for the outbound fetches it makes during authentication (OAuth client metadata and JWKS).
By default, FastMCP protects its OAuth and JWKS fetches against SSRF by resolving the target hostname, rejecting any address that maps to a private, loopback, link-local, or reserved IP, and then pinning the connection to that validated IP.
This breaks when a corporate
CONNECT proxy is the only egress path: the container often cannot resolve external DNS at all (only the proxy can), and even when it can, pinning to the IP makes TLS verification fail because public certificates list hostnames, not IP addresses.
Set FASTMCP_SSRF_TRUST_PROXY=true when a trusted proxy is your mandated egress. FastMCP then skips DNS resolution, the IP blocklist, and connection pinning, and makes a single request to the hostname URL through the proxy named by the standard HTTPS_PROXY / ALL_PROXY environment variables (checked in that order). The HTTPS-only and hostname checks still apply.