π The fast, Pythonic way to build MCP servers and clients.
Update dependency management
Jeremiah Lowinc5ae6f42eff9
diff --git a/README.md b/README.mdindex 06970132d..39f001980 100644--- a/README.md+++ b/README.md@@ -81,9 +81,21 @@ def calculate(x: int, y: int) -> int:FastMCP includes a development server with the MCP Inspector for testing your server:```bash+# Basic usagefastmcp dev your_server.py++# Load dependencies from current directory's pyproject.toml+fastmcp dev your_server.py --uv-directory .++# Install additional packages+fastmcp dev your_server.py --with pandas,numpy++# Combine both+fastmcp dev your_server.py --uv-directory . --with pandas,numpy```+The `--with` flag automatically includes `fastmcp` and any additional packages you specify. The `--uv-directory` flag tells uv where to find your project's dependencies.+### Installing in ClaudeTo use your server with Claude Desktop:diff --git a/src/fastmcp/cli/cli.py b/src/fastmcp/cli/cli.pyindex db61c40c7..b58f63f1a 100644--- a/src/fastmcp/cli/cli.py+++ b/src/fastmcp/cli/cli.py@@ -26,6 +26,7 @@ app = typer.Typer(def _build_uv_command(file: Path,uv_directory: Optional[Path] = None,+ with_packages: Optional[list[str]] = None,) -> list[str]:"""Build the uv run command."""cmd = ["uv"]@@ -33,7 +34,14 @@ def _build_uv_command(if uv_directory:cmd.extend(["--directory", str(uv_directory)])- cmd.extend(["run", str(file)])+ cmd.extend(["run", "--with", "fastmcp"])++ if with_packages:+ for pkg in with_packages:+ if pkg:+ cmd.extend(["--with", pkg])++ cmd.append(str(file))return cmd@@ -148,6 +156,14 @@ def dev(resolve_path=True,),] = None,+ with_packages: Annotated[+ Optional[list[str]],+ typer.Option(+ "--with",+ help="Additional packages to install",+ multiple=True,+ ),+ ] = None,) -> None:"""Run a FastMCP server with the MCP Inspector."""file, server_object = _parse_file_path(file_spec)@@ -158,11 +174,12 @@ def dev("file": str(file),"server_object": server_object,"uv_directory": str(uv_directory) if uv_directory else None,+ "with_packages": with_packages,},)try:- uv_cmd = _build_uv_command(file, uv_directory)+ uv_cmd = _build_uv_command(file, uv_directory, with_packages)# Run the MCP Inspector commandprocess = subprocess.run(["npx", "@modelcontextprotocol/inspector"] + uv_cmd,@@ -227,8 +244,6 @@ def run()try:- uv_cmd = _build_uv_command(file, uv_directory)-# Import and get server objectserver = _import_server(file, server_object)diff --git a/src/fastmcp/server.py b/src/fastmcp/server.pyindex 5a8973844..a42cebf92 100644--- a/src/fastmcp/server.py+++ b/src/fastmcp/server.py@@ -108,6 +108,7 @@ class FastMCP:async def list_resources(self) -> list[MCPResource]:"""List all available resources."""+resources = self._resource_manager.list_resources()return [MCPResource(diff --git a/uv.lock b/uv.lockindex 11ef22589..0c906e95e 100644--- a/uv.lock+++ b/uv.lock@@ -222,7 +222,7 @@ wheels = [[[package]]name = "fastmcp"-version = "0.1.dev4+g18aaf41.d20241129"+version = "0.1.1.dev1+gca7438f.d20241130"source = { editable = "." }dependencies = [{ name = "httpx" },