Commands Overview
fastmcp run
Run a FastMCP server directly or proxy a remote server.
Options
Entrypoints
New in version2.3.5
The fastmcp run command supports the following entrypoints:
- Inferred server instance:
server.py- imports the module and looks for a FastMCP server instance namedmcp,server, orapp. Errors if no such object is found. - Explicit server entrypoint:
server.py:custom_name- imports and uses the specified server entrypoint - Factory function:
server.py:create_server- calls the specified function (sync or async) to create a server instance - Remote server proxy:
https://example.com/mcp-server- connects to a remote server and creates a local proxy server - FastMCP configuration file:
fastmcp.json- runs servers using FastMCP’s declarative configuration format (auto-detects files in current directory) - MCP configuration file:
mcp.json- runs servers defined in a standard MCP configuration file
Inferred Server Instance
If you provide a path to a file,fastmcp run will load the file and look for a FastMCP server instance stored as a variable named mcp, server, or app. If no such object is found, it will raise an error.
For example, if you have a file called server.py with the following content:
server.py
Explicit Server Entrypoint
If your server is stored as a variable with a custom name, or you want to be explicit about which server to run, you can use the following syntax to load a specific server entrypoint:server.py with the following content:
Factory Function
New in version2.11.2
Since fastmcp run ignores the if __name__ == "__main__" block, you can use a factory function to run setup code before your server starts. Factory functions are called without any arguments and must return a FastMCP server instance. Both sync and async factory functions are supported.
The syntax for using a factory function is the same as for an explicit server entrypoint: fastmcp run server.py:factory_fn. FastMCP will automatically detect that you have identified a function rather than a server Instance
For example, if you have a file called server.py with the following content:
Remote Server Proxy
FastMCP run can also start a local proxy server that connects to a remote server. This is useful when you want to run a remote server locally for testing or development purposes, or to use with a client that doesn’t support direct connections to remote servers. To start a local proxy, you can use the following syntax:FastMCP Configuration
New in version2.11.4
FastMCP supports declarative configuration through fastmcp.json files. When you run fastmcp run without arguments, it automatically looks for a fastmcp.json file in the current directory:
The
--skip-env flag is useful when:- You’re already in an activated virtual environment
- You’re inside a Docker container with pre-installed dependencies
- You’re in a uv-managed environment (prevents infinite recursion)
- You want to test the server without environment setup
MCP Configuration
FastMCP can also run servers defined in a standard MCP configuration file. This is useful when you want to run multiple servers from a single file, or when you want to use a client that doesn’t support direct connections to remote servers. To run a MCP configuration file, you can use the following syntax:fastmcp dev
Run a MCP server with the MCP Inspector for testing.
Options
Entrypoints
Thedev command supports local FastMCP server files and configuration:
- Inferred server instance:
server.py- imports the module and looks for a FastMCP server instance namedmcp,server, orapp. Errors if no such object is found. - Explicit server entrypoint:
server.py:custom_name- imports and uses the specified server entrypoint - Factory function:
server.py:create_server- calls the specified function (sync or async) to create a server instance - FastMCP configuration:
fastmcp.json- uses FastMCP’s declarative configuration (auto-detects in current directory)
fastmcp install
New in version 2.10.3
Install a MCP server in MCP client applications. FastMCP currently supports the following clients:
- Claude Code - Installs via Claude Code’s built-in MCP management system
- Claude Desktop - Installs via direct configuration file modification
- Cursor - Installs via deeplink that opens Cursor for user confirmation
- MCP JSON - Generates standard MCP JSON configuration for manual use
--with and/or --with-editable options (following uv conventions) or by attaching them to your server in code via the dependencies parameter. You should not assume that the MCP server will have access to your local environment.
Python Version Considerations: The install commands now support the
--python option to specify a Python version directly. You can also use --project to run within a specific project directory or --with-requirements to install dependencies from a requirements file.Options
Entrypoints
Theinstall command supports local FastMCP server files and configuration:
- Inferred server instance:
server.py- imports the module and looks for a FastMCP server instance namedmcp,server, orapp. Errors if no such object is found. - Explicit server entrypoint:
server.py:custom_name- imports and uses the specified server entrypoint - Factory function:
server.py:create_server- calls the specified function (sync or async) to create a server instance - FastMCP configuration:
fastmcp.json- uses FastMCP’s declarative configuration with dependencies and settings
Factory functions are particularly useful for install commands since they allow setup code to run that would otherwise be ignored when the MCP client runs your server. When using fastmcp.json, dependencies are automatically handled.
MCP JSON Generation
Themcp-json subcommand generates standard MCP JSON configuration that can be used with any MCP-compatible client. This is useful when:
- Working with MCP clients not directly supported by FastMCP
- Creating configuration for CI/CD environments
- Sharing server configurations with others
- Integration with custom tooling
To use this configuration with your MCP client, you’ll typically need to add it to the client’s
mcpServers object. Consult your client’s documentation for any specific configuration requirements or formatting needs.fastmcp inspect
New in version 2.9.0
Inspect a FastMCP server to view summary information or generate a detailed JSON report.
Options
Output Formats
FastMCP Format (--format fastmcp)
The default and most comprehensive format, includes all FastMCP-specific metadata:
- Server name, instructions, and version
- FastMCP version and MCP version
- Tool tags and enabled status
- Output schemas for tools
- Annotations and custom metadata
- Uses snake_case field names
- Use this for: Complete server introspection and debugging FastMCP servers
MCP Protocol Format (--format mcp)
Shows exactly what MCP clients will see via the protocol:
- Only includes standard MCP protocol fields
- Matches output from
client.list_tools(),client.list_prompts(), etc. - Uses camelCase field names (e.g.,
inputSchema) - Excludes FastMCP-specific fields like tags and enabled status
- Use this for: Debugging client visibility and ensuring MCP compatibility
Entrypoints
Theinspect command supports local FastMCP server files and configuration:
- Inferred server instance:
server.py- imports the module and looks for a FastMCP server instance namedmcp,server, orapp. Errors if no such object is found. - Explicit server entrypoint:
server.py:custom_name- imports and uses the specified server entrypoint - Factory function:
server.py:create_server- calls the specified function (sync or async) to create a server instance - FastMCP configuration:
fastmcp.json- inspects servers defined with FastMCP’s declarative configuration
Examples
fastmcp project prepare
Create a persistent uv project directory from a fastmcp.json file’s environment configuration. This allows you to pre-install all dependencies once and reuse them with the --project flag.
Options
Usage Pattern
- A
pyproject.tomlcontaining all dependencies from the fastmcp.json - A
.venvwith all packages pre-installed - A
uv.lockfile for reproducible environments

