Starting a Server
fastmcp run starts a server. Point it at a Python file, a factory function, a remote URL, or a config file:
Entrypoints
FastMCP supports several ways to locate and start your server: Inferred instance — FastMCP imports the file and looks for a variable namedmcp, server, or app:
fastmcp.json file that declaratively specifies the server, its dependencies, and deployment settings. When you run fastmcp run with no arguments, it auto-detects fastmcp.json in the current directory:
fastmcp.json format.
MCP config — runs servers defined in a standard MCP configuration file (any .json with an mcpServers key):
Options
| Option | Flag | Description |
|---|---|---|
| Transport | --transport, -t | stdio (default), http, or sse |
| Host | --host | Bind address for HTTP (default: 127.0.0.1) |
| Port | --port, -p | Bind port for HTTP (default: 8000) |
| Path | --path | URL path for HTTP (default: /mcp/) |
| Log Level | --log-level, -l | DEBUG, INFO, WARNING, ERROR, CRITICAL |
| No Banner | --no-banner | Suppress the startup banner |
| Auto-Reload | --reload / --no-reload | Watch for file changes and restart automatically |
| Reload Dirs | --reload-dir | Directories to watch (repeatable) |
| Skip Env | --skip-env | Don’t set up a uv environment (use when already in one) |
| Python | --python | Python version to use (e.g., 3.11) |
| Extra Packages | --with | Additional packages to install (repeatable) |
| Project | --project | Run within a specific uv project directory |
| Requirements | --with-requirements | Install from a requirements file |
Dependency Management
By default,fastmcp run uses your current Python environment directly. When you pass --python, --with, --project, or --with-requirements, it switches to running via uv run in a subprocess, which handles dependency isolation automatically.
The --skip-env flag is useful when you’re already inside an activated venv, a Docker container with pre-installed dependencies, or a uv-managed project — it prevents uv from trying to set up another environment layer.
Previewing Apps
fastmcp dev apps launches a browser-based preview UI for servers with Prefab App tools. It starts your MCP server on one port and a local dev UI on another — giving you a live, interactive picker where you can call app tools and see their rendered output without needing a full MCP host client.
| Option | Flag | Description |
|---|---|---|
| MCP Port | --mcp-port | Port for the MCP server (default: 8000) |
| Dev Port | --dev-port | Port for the dev UI (default: 8080) |
| Auto-Reload | --reload / --no-reload | Watch for file changes (default: on) |
Development with the Inspector
fastmcp dev inspector launches your server inside the MCP Inspector, a browser-based tool for interactively testing MCP servers. Auto-reload is on by default, so your server restarts when you save changes.
| Option | Flag | Description |
|---|---|---|
| Editable Package | --with-editable, -e | Install a directory in editable mode |
| Extra Packages | --with | Additional packages (repeatable) |
| Inspector Version | --inspector-version | MCP Inspector version to use |
| UI Port | --ui-port | Port for the Inspector UI |
| Server Port | --server-port | Port for the Inspector proxy |
| Auto-Reload | --reload / --no-reload | File watching (default: on) |
| Reload Dirs | --reload-dir | Directories to watch (repeatable) |
| Python | --python | Python version |
| Project | --project | Run within a uv project directory |
| Requirements | --with-requirements | Install from a requirements file |
Pre-Building Environments
fastmcp project prepare creates a persistent uv project from a fastmcp.json file, pre-installing all dependencies. This separates environment setup from server execution — install once, run many times.
pyproject.toml, a .venv with all packages installed, and a uv.lock for reproducibility. This is particularly useful in deployment scenarios where you want deterministic, pre-built environments.
