Fastmcp Filesystem Server
A production-ready filesystem MCP server built with FastMCP. Secure file operations with path sandboxing, supporting read/write/search/move/copy and directory management. Designed for AI assistants to safely interact with local filesystems.
Ask AI about Fastmcp Filesystem Server
Powered by Claude Β· Grounded in docs
I know everything about Fastmcp Filesystem Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
FastMCP Filesystem Server
A secure, feature-rich filesystem MCP (Model Context Protocol) server built with FastMCP. Enables AI assistants like Claude to safely read, write, search, and manage files on your local machine with configurable path restrictions.
Features
- π Security First: Path sandboxing prevents unauthorized directory access
- π Complete Operations: List, read, write, create, delete, move, copy files and directories
- π Smart Search: Glob pattern matching with optional content regex search
- π Metadata: File hashes (MD5), MIME types, permissions, timestamps
- π FastMCP Powered: Clean decorator-based API, async support, multiple transports
- π οΈ Production Ready: Error handling, logging, size limits, encoding detection
Quick Start
Installation
# Clone repository
git clone https://github.com/newbieking/fastmcp-filesystem-server.git
cd fastmcp-filesystem-server
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install fastmcp
Usage
Standalone Mode
# Allow access to specific directories only (recommended)
python filesystem_server.py /home/user/Documents /home/user/Projects
# Development mode (no restrictions - use with caution)
python filesystem_server.py
With Claude Desktop
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "python",
"args": [
"/absolute/path/to/filesystem_server.py",
"/Users/yourname/Documents",
"/Users/yourname/Projects"
]
}
}
}
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "python",
"args": [
"C:\\path\\to\\filesystem_server.py",
"C:\\Users\\yourname\\Documents"
]
}
}
}
Available Tools
| Tool | Description | Parameters |
|---|---|---|
list_directory | List directory contents | path |
read_file | Read file with offset/limit | path, offset, limit |
write_file | Write or append to file | path, content, append |
create_directory | Create directory (mkdir -p) | path, parents |
delete_path | Delete file or directory | path, recursive |
search_files | Search by name/content | path, pattern, content_pattern, max_depth |
get_file_info | Get metadata + MD5 hash | path |
move_file | Move/rename file or directory | source, destination, overwrite |
copy_file | Copy file or directory | source, destination, overwrite |
Examples
List Directory
{
"path": "/home/user/Projects"
}
Read Large File (Chunked)
{
"path": "/var/log/syslog",
"offset": 0,
"limit": 10240
}
Search Python Files Containing "TODO"
{
"path": "/home/user/Projects",
"pattern": "*.py",
"content_pattern": "TODO|FIXME",
"max_depth": 3
}
Write Configuration File
{
"path": "/home/user/.config/app/settings.json",
"content": "{\"theme\": \"dark\", \"version\": \"1.0\"}"
}
Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Claude/AI ββββββΊβ MCP Protocol ββββββΊβ FastMCP Server β
β Assistant β β (stdio/SSE) β β β
βββββββββββββββββββ ββββββββββββββββββββ ββββββββββ¬βββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββ
βΌ βΌ βΌ
ββββββββββββ ββββββββββββββ ββββββββββ
β Path β β File Ops β β Search β
β Validatorβ β (read/write)β β Engine β
ββββββββββββ ββββββββββββββ ββββββββββ
Security Considerations
β οΈ Important: This server grants AI assistants direct filesystem access.
-
Always use path restrictions in production:
python filesystem_server.py /safe/path/only -
Never run with sudo/root permissions
-
Audit sensitive directories: Avoid exposing
.ssh/,.env files, or financial data -
Review AI actions: Claude will ask permission before destructive operations (delete/overwrite)
Development
Testing
# Run tests
pytest tests/
# Test with MCP Inspector
npx @modelcontextprotocol/inspector --config mcp-config.json --server fs-server
Project Structure
.
βββ mcp-config.json # mcp config file for mcp client
βββ README.md # This file
βββ fast_mcp_server/
βββ filesystem_server.py # Main MCP server implementation
Requirements
- Python 3.10+
fastmcp>=1.0.0mcp>=1.0.0
License
MIT License - see LICENSE file.
Related
Built with FastMCP | Secure by Design | AI-Ready
