"""
LocalFS MCP Server - Sandboxed filesystem operations via MCP.
This server provides comprehensive filesystem management tools with security
features including sandboxing, path traversal protection, and configurable limits.
To run the server:
Development: uv run dev
Production: uv run start
Playground: uv run playground
Documentation: https://smithery.ai/docs
MCP Protocol: https://modelcontextprotocol.io
"""
from mcp.server.fastmcp import FastMCP
from smithery.decorators import smithery
from .schemas.config import LocalFSConfig
from .api import (
register_directory_routes,
register_file_routes,
register_search_routes,
)
@smithery.server(config_schema=LocalFSConfig)
def create_server():
"""
Create and configure the LocalFS MCP server.
The server provides 16 filesystem tools organized into three categories:
- Directory operations (5 tools): list, create, delete, move, metadata
- File operations (6 tools): list, read, write, append, delete, move, metadata
- Search operations (5 tools): by name, glob, filename regex, content text, content regex
Note: All operations have full filesystem access (root directory: /)
Configuration (per-session):
- max_file_size_mb: Maximum file size for operations (default: 100 MB)
- max_search_depth: Maximum recursion depth for searches (default: 10)
Returns:
Configured FastMCP server instance
"""
# Create FastMCP server
server = FastMCP(name="LocalFS", host="0.0.0.0")
# Register all API routes
register_directory_routes(server)
register_file_routes(server)
register_search_routes(server)
return server