Skip to main content
FastMCP uses pydantic-settings for configuration. Every setting is available as an environment variable with a FASTMCP_ prefix. Settings are loaded from environment variables and from a .env file (see the Tasks (Docket) section for a caveat about nested settings in .env files).
You can change which .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

Transport & HTTP

These control how the server listens when running with an HTTP transport.

Error Handling

Client

CLI & Display

Tasks (Docket)

These configure the Docket task queue used by server tasks. All use the FASTMCP_DOCKET_ prefix.
When setting Docket values in a .env file, use a double underscore: FASTMCP_DOCKET__URL (not FASTMCP_DOCKET_URL). This is because .env values are resolved through the parent Settings class, which uses __ as its nested delimiter. As regular environment variables (e.g., export), the single-underscore form FASTMCP_DOCKET_URL works fine.

Advanced