examples/fastmcp_config_demo/README.md
This example demonstrates the recommended way to configure FastMCP servers using fastmcp.json.
Previously (deprecated as of FastMCP 2.11.4), you would specify dependencies in the Python code:
mcp = FastMCP("Demo Server", dependencies=["pyautogui", "Pillow"])
Now, dependencies are declared in fastmcp.json:
{
"environment": {
"dependencies": ["pyautogui", "Pillow"]
}
}
With the configuration file in place, you can run the server in several ways:
# Auto-detect fastmcp.json in current directory
cd examples/mcp_server_config_demo
fastmcp run
# Or specify the config file explicitly
fastmcp run examples/mcp_server_config_demo/fastmcp.json
# Or use development mode with the Inspector UI
fastmcp dev examples/mcp_server_config_demo/fastmcp.json
The fastmcp.json file supports three main sections:
See the full documentation for more details.