π The fast, Pythonic way to build MCP servers and clients.
Move `fastmcp dev` to `fastmcp dev inspector`
Jeremiah Lowin618195c065f6
diff --git a/docs/development/v3-notes/v3-features.mdx b/docs/development/v3-notes/v3-features.mdxindex ae6bfc27d..fb3cb8ad0 100644--- a/docs/development/v3-notes/v3-features.mdx+++ b/docs/development/v3-notes/v3-features.mdx@@ -988,9 +988,9 @@ Implementation (`src/fastmcp/cli/run.py`):- stdio: Full MCP features including elicitation- HTTP: Limited bidirectional features during reload-Also available with `fastmcp dev`:+Also available with `fastmcp dev inspector`:```bash-fastmcp dev server.py # Includes --reload by default+fastmcp dev inspector server.py # Includes --reload by default```---diff --git a/docs/patterns/cli.mdx b/docs/patterns/cli.mdxindex 8ccf9d01f..fe32bdd75 100644--- a/docs/patterns/cli.mdx+++ b/docs/patterns/cli.mdx@@ -345,10 +345,14 @@ This will run all the servers defined in the file.## `fastmcp dev`+The `dev` command group contains development tools for MCP servers.++### `fastmcp dev inspector`+Run a MCP server with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) for testing. Auto-reload is enabled by default, so your server automatically restarts when you save changes to source files.```bash-fastmcp dev server.py+fastmcp dev inspector server.py```<Tip>@@ -361,7 +365,7 @@ When using `fastmcp.json`, the dev command automatically uses the configured dep</Tip><Warning>-The `dev` command is a shortcut for testing a server over STDIO only. When the Inspector launches, you may need to:+The `dev inspector` command is a shortcut for testing a server over STDIO only. When the Inspector launches, you may need to:1. Select "STDIO" from the transport dropdown2. Connect manually@@ -377,7 +381,7 @@ This command does not support HTTP testing. To test a server over Streamable HTT2. Open the MCP Inspector separately and connect to your running server</Warning>-### Options+#### Options| Option | Flag | Description || ------ | ---- | ----------- |@@ -392,39 +396,39 @@ This command does not support HTTP testing. To test a server over Streamable HTT| Project Directory | `--project` | Run the command within the given project directory || Requirements File | `--with-requirements` | Requirements file to install dependencies from |-### Entrypoints+#### Entrypoints-The `dev` command supports local FastMCP server files and configuration:+The `dev inspector` command supports local FastMCP server files and configuration:1. **Inferred server instance**: `server.py` - imports the module and looks for a FastMCP server instance named `mcp`, `server`, or `app`. Errors if no such object is found.-2. **Explicit server entrypoint**: `server.py:custom_name` - imports and uses the specified server entrypoint+2. **Explicit server entrypoint**: `server.py:custom_name` - imports and uses the specified server entrypoint3. **Factory function**: `server.py:create_server` - calls the specified function (sync or async) to create a server instance4. **FastMCP configuration**: `fastmcp.json` - uses FastMCP's declarative configuration (auto-detects in current directory)<Warning>-The `dev` command **only supports local files and fastmcp.json** - no URLs, remote servers, or standard MCP configuration files.+The `dev inspector` command **only supports local files and fastmcp.json** - no URLs, remote servers, or standard MCP configuration files.</Warning>**Examples**```bash# Run dev server with editable mode and additional packages-fastmcp dev server.py -e . --with pandas --with matplotlib+fastmcp dev inspector server.py -e . --with pandas --with matplotlib# Run dev server with fastmcp.json configuration (auto-detects)-fastmcp dev+fastmcp dev inspector# Run dev server with explicit fastmcp.json file-fastmcp dev dev.fastmcp.json+fastmcp dev inspector dev.fastmcp.json# Run dev server with specific Python version-fastmcp dev server.py --python 3.11+fastmcp dev inspector server.py --python 3.11# Run dev server with requirements file-fastmcp dev server.py --with-requirements requirements.txt+fastmcp dev inspector server.py --with-requirements requirements.txt# Run dev server within a specific project directory-fastmcp dev server.py --project /path/to/project+fastmcp dev inspector server.py --project /path/to/project```## `fastmcp install`diff --git a/src/fastmcp/cli/cli.py b/src/fastmcp/cli/cli.pyindex 5b9c24e4a..07b2ddb5b 100644--- a/src/fastmcp/cli/cli.py+++ b/src/fastmcp/cli/cli.py@@ -134,8 +134,12 @@ def version(console.print("[dim]Run: pip install --upgrade fastmcp[/dim]")-async def dev(+# Create dev subcommand group+dev_app = cyclopts.App(name="dev", help="Development tools for MCP servers")+++@dev_app.command+async def inspector(server_spec: str | None = None,*,with_editable: Annotated[@@ -946,6 +950,9 @@ async def prepare(sys.exit(1)+# Add dev subcommand group+app.command(dev_app)+# Add project subcommand groupapp.command(project_app)diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.pyindex 703771dff..eecc4300c 100644--- a/tests/cli/test_cli.py+++ b/tests/cli/test_cli.py@@ -91,10 +91,10 @@ class TestVersionCommand:class TestDevCommand:"""Test the dev command."""- def test_dev_command_parsing(self):- """Test that dev command can be parsed with various options."""+ def test_dev_inspector_command_parsing(self):+ """Test that dev inspector command can be parsed with various options."""# Test basic parsing- command, bound, _ = app.parse_args(["dev", "server.py"])+ command, bound, _ = app.parse_args(["dev", "inspector", "server.py"])assert command is not Noneassert bound.arguments["server_spec"] == "server.py"@@ -102,6 +102,7 @@ class TestDevCommand:command, bound, _ = app.parse_args(["dev",+ "inspector","server.py","--with","package1",@@ -115,11 +116,12 @@ class TestDevCommand:assert bound.arguments["inspector_version"] == "1.0.0"assert bound.arguments["ui_port"] == 3000- def test_dev_command_parsing_with_new_options(self):- """Test dev command parsing with new uv options."""+ def test_dev_inspector_command_parsing_with_new_options(self):+ """Test dev inspector command parsing with new uv options."""command, bound, _ = app.parse_args(["dev",+ "inspector","server.py","--python","3.10",