Use fastmcp.json for declarative server configuration
New in version: 2.11.4
FastMCP supports declarative configuration through fastmcp.json files. This is the canonical and preferred way to configure FastMCP projects, providing a single source of truth for server settings, dependencies, and deployment options that replaces complex command-line arguments.
fastmcp.json configuration file allows you to define all aspects of your FastMCP server in a structured, shareable format. Instead of remembering command-line arguments or writing shell scripts, you declare your server’s configuration once and use it everywhere.
When you have a fastmcp.json file, running your server becomes as simple as:
fastmcp.json for enhanced developer experience:
https://gofastmcp.com/schemas/fastmcp_config/v1.jsonhttps://gofastmcp.com/schemas/fastmcp_config/latest.jsonfastmcp.json file has three main sections, each controlling a different aspect of your server:
entrypoint field is required. The environment and deployment sections are optional and provide additional configuration when needed.
uv to create an isolated environment for your server, ensuring reproducible deployments across different systems.
uv.uvfastmcp.json files, making server execution simple and consistent:
run - Start the server in production modedev - Launch with the Inspector UI for developmentinspect - View server capabilities and configurationinstall - Install to Claude Desktop, Cursor, or other MCP clientsfastmcp.json. This means you can simply navigate to your project directory and run fastmcp run to start your server with all its configured settings.
fastmcp.json - Default configurationdev.fastmcp.json - Development settingsprod.fastmcp.json - Production settingstest_fastmcp.json - Test configurationapp), making it clear which object contains your FastMCP server. Uses all defaults: STDIO transport, no special dependencies, standard logging.fastmcp.json for your projects, consider these recommendations:
Version Control: Always commit your fastmcp.json to version control. It’s essential project documentation that ensures others can run your server correctly.
Environment Variables: Use the env field for configuration values instead of hardcoding them in your Python code. For sensitive values, consider using environment variable references or separate secret management.
Dependency Management: Specify exact versions for production dependencies to ensure reproducible builds:
env field in deployment configuration supports runtime interpolation of environment variables using ${VAR_NAME} syntax. This enables dynamic configuration based on your deployment environment:
${ENVIRONMENT}, ${DB_USER}, etc. with values from your system’s environment variables. If a variable doesn’t exist, the placeholder is preserved as-is.
Example: If your system has ENVIRONMENT=production and DB_HOST=db.example.com:
fastmcp.json simplifies your workflow. Here’s how common CLI patterns map to configuration:
CLI Command: