π The fast, Pythonic way to build MCP servers and clients.
Rename filesystem-provider example dir to avoid mcp/ collision (#3878)
Jeremiah Lowindfe9b307bdd3
diff --git a/docs/servers/providers/filesystem.mdx b/docs/servers/providers/filesystem.mdxindex 95dba3b3b..353a671d5 100644--- a/docs/servers/providers/filesystem.mdx+++ b/docs/servers/providers/filesystem.mdx@@ -34,13 +34,13 @@ from pathlib import Pathfrom fastmcp import FastMCPfrom fastmcp.server.providers import FileSystemProvider-mcp = FastMCP("MyServer", providers=[FileSystemProvider(Path(__file__).parent / "mcp")])+mcp = FastMCP("MyServer", providers=[FileSystemProvider(Path(__file__).parent / "components")])```-In your `mcp/` directory, create Python files with decorated functions.+In your `components/` directory, create Python files with decorated functions.```python-# mcp/tools/greet.py+# components/tools/greet.pyfrom fastmcp.tools import tool@tool@@ -139,7 +139,7 @@ The decorator supports: `name`, `title`, `description`, `icons`, `tags`, and `meThe directory structure is purely organizational. The provider recursively scans all `.py` files regardless of which subdirectory they're in. Subdirectories like `tools/`, `resources/`, and `prompts/` are optional conventions that help you organize code.```-mcp/+components/βββ tools/β βββ greeting.py # @tool functionsβ βββ calculator.py # @tool functions@@ -152,7 +152,7 @@ mcp/You can also put all components in a single file or organize by feature rather than type.```-mcp/+components/βββ user_management.py # @tool, @resource, @prompt for usersβββ billing.py # @tool, @resource for billingβββ analytics.py # @tool for analytics@@ -176,9 +176,9 @@ The provider follows these rules when scanning:If your directory contains an `__init__.py` file, the provider imports files as proper Python package members. This means relative imports work correctly within your components directory.```python-# mcp/__init__.py exists+# components/__init__.py exists-# mcp/tools/greeting.py+# components/tools/greeting.pyfrom ..helpers import format_name # Relative imports work@tool@@ -197,7 +197,7 @@ from pathlib import Pathfrom fastmcp.server.providers import FileSystemProvider-provider = FileSystemProvider(Path(__file__).parent / "mcp", reload=True)+provider = FileSystemProvider(Path(__file__).parent / "components", reload=True)```With `reload=True`, the provider:@@ -227,7 +227,7 @@ A complete example is available in the repository at `examples/filesystem-provid```examples/filesystem-provider/βββ server.py # Server entry point-βββ mcp/+βββ components/βββ tools/β βββ greeting.py # greet, farewell toolsβ βββ calculator.py # add, multiply tools@@ -246,7 +246,7 @@ from fastmcp import FastMCPfrom fastmcp.server.providers import FileSystemProviderprovider = FileSystemProvider(- root=Path(__file__).parent / "mcp",+ root=Path(__file__).parent / "components",reload=True,)diff --git a/examples/filesystem-provider/mcp/prompts/assistant.py b/examples/filesystem-provider/components/prompts/assistant.pysimilarity index 100%rename from examples/filesystem-provider/mcp/prompts/assistant.pyrename to examples/filesystem-provider/components/prompts/assistant.pydiff --git a/examples/filesystem-provider/mcp/resources/config.py b/examples/filesystem-provider/components/resources/config.pysimilarity index 100%rename from examples/filesystem-provider/mcp/resources/config.pyrename to examples/filesystem-provider/components/resources/config.pydiff --git a/examples/filesystem-provider/mcp/tools/calculator.py b/examples/filesystem-provider/components/tools/calculator.pysimilarity index 100%rename from examples/filesystem-provider/mcp/tools/calculator.pyrename to examples/filesystem-provider/components/tools/calculator.pydiff --git a/examples/filesystem-provider/mcp/tools/greeting.py b/examples/filesystem-provider/components/tools/greeting.pysimilarity index 100%rename from examples/filesystem-provider/mcp/tools/greeting.pyrename to examples/filesystem-provider/components/tools/greeting.pydiff --git a/examples/filesystem-provider/server.py b/examples/filesystem-provider/server.pyindex 2f3cf47a6..11bbf7f81 100644--- a/examples/filesystem-provider/server.py+++ b/examples/filesystem-provider/server.py@@ -22,7 +22,7 @@ from fastmcp.server.providers import FileSystemProvider# Functions decorated with @tool, @resource, or @prompt are registered.# Directory structure is purely organizational - decorators determine type.provider = FileSystemProvider(- root=Path(__file__).parent / "mcp",+ root=Path(__file__).parent / "components",reload=True, # Set True for dev mode (re-scan on every request))