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).
# Set via environment
export FASTMCP_LOG_LEVEL=DEBUG
export FASTMCP_PORT=3000

# Or use a .env file (loaded automatically)
echo "FASTMCP_LOG_LEVEL=DEBUG" >> .env
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

Environment VariableTypeDefaultDescription
FASTMCP_LOG_LEVELLiteral["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]INFOLog level for FastMCP’s own logging output. Case-insensitive.
FASTMCP_LOG_ENABLEDbooltrueEnable or disable FastMCP logging entirely.
FASTMCP_CLIENT_LOG_LEVELLiteral["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]NoneDefault minimum log level for messages sent to MCP clients via context.log(). When set, messages below this level are suppressed. Individual clients can override this per-session using the MCP logging/setLevel request.
FASTMCP_ENABLE_RICH_LOGGINGbooltrueUse rich formatting for log output. Set to false for plain Python logging.
FASTMCP_ENABLE_RICH_TRACEBACKSbooltrueUse rich tracebacks for errors.
FASTMCP_DEPRECATION_WARNINGSbooltrueShow deprecation warnings.

Transport & HTTP

These control how the server listens when running with an HTTP transport.
Environment VariableTypeDefaultDescription
FASTMCP_TRANSPORTLiteral["stdio", "http", "sse", "streamable-http"]stdioDefault transport.
FASTMCP_HOSTstr127.0.0.1Host to bind to.
FASTMCP_PORTint8000Port to bind to.
FASTMCP_SSE_PATHstr/ssePath for SSE endpoint.
FASTMCP_MESSAGE_PATHstr/messages/Path for SSE message endpoint.
FASTMCP_STREAMABLE_HTTP_PATHstr/mcpPath for Streamable HTTP endpoint.
FASTMCP_STATELESS_HTTPboolfalseEnable stateless HTTP mode (new transport per request). Useful for multi-worker deployments.
FASTMCP_JSON_RESPONSEboolfalseUse JSON responses instead of SSE for Streamable HTTP.
FASTMCP_DEBUGboolfalseEnable debug mode.

Error Handling

Environment VariableTypeDefaultDescription
FASTMCP_MASK_ERROR_DETAILSboolfalseMask error details before sending to clients. When enabled, only messages from explicitly raised ToolError, ResourceError, or PromptError are included in responses.
FASTMCP_STRICT_INPUT_VALIDATIONboolfalseStrictly validate tool inputs against the JSON schema. When disabled, compatible inputs are coerced (e.g., the string "10" becomes the integer 10).
FASTMCP_MOUNTED_COMPONENTS_RAISE_ON_LOAD_ERRORboolfalseRaise errors when loading mounted components instead of logging warnings.

Client

Environment VariableTypeDefaultDescription
FASTMCP_CLIENT_INIT_TIMEOUTfloat | NoneNoneTimeout in seconds for the client initialization handshake. Set to 0 or leave unset to disable.
FASTMCP_CLIENT_DISCONNECT_TIMEOUTfloat5Maximum time in seconds to wait for a clean disconnect before giving up.
FASTMCP_CLIENT_RAISE_FIRST_EXCEPTIONGROUP_ERRORbooltrueWhen an ExceptionGroup is raised, re-raise the first error directly instead of the group. Simplifies debugging but may mask secondary errors.

CLI & Display

Environment VariableTypeDefaultDescription
FASTMCP_SHOW_SERVER_BANNERbooltrueShow the server banner on startup. Also controllable via --no-banner or server.run(show_banner=False).
FASTMCP_CHECK_FOR_UPDATESLiteral["stable", "prerelease", "off"]stableUpdate checking on CLI startup. stable checks stable releases only, prerelease includes pre-releases, off disables checking.

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.
Environment VariableTypeDefaultDescription
FASTMCP_DOCKET_NAMEstrfastmcpQueue name. Servers and workers sharing the same name and backend URL share a task queue.
FASTMCP_DOCKET_URLstrmemory://Backend URL. Use memory:// for single-process or redis://host:port/db for distributed workers.
FASTMCP_DOCKET_WORKER_NAMEstr | NoneNoneWorker name. Auto-generated if unset.
FASTMCP_DOCKET_CONCURRENCYint10Maximum concurrent tasks per worker.
FASTMCP_DOCKET_REDELIVERY_TIMEOUTtimedelta300sIf a worker doesn’t complete a task within this time, it’s redelivered to another worker.
FASTMCP_DOCKET_RECONNECTION_DELAYtimedelta5sDelay between reconnection attempts when the worker loses its backend connection.
FASTMCP_DOCKET_MINIMUM_CHECK_INTERVALtimedelta50msHow frequently the worker polls for new tasks. Lower values reduce latency at the cost of more CPU usage.

Advanced

Environment VariableTypeDefaultDescription
FASTMCP_HOMEPathPlatform defaultData directory for FastMCP. Defaults to the platform-specific user data directory.
FASTMCP_ENV_FILEstr.envPath to the .env file to load settings from. Must be set as an environment variable (see above).
FASTMCP_SERVER_DEPENDENCIESlist[str][]Additional dependencies to install in the server environment.
FASTMCP_DECORATOR_MODELiteral["function", "object"]functionControls what @tool, @resource, and @prompt decorators return. function returns the original function (default); object returns component objects (deprecated, will be removed).
FASTMCP_TEST_MODEboolfalseEnable test mode.