sandraschi/filesystem-mcp
If you are the rightful owner of filesystem-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Filesystem MCP is a FastMCP 2.12.0+ compliant server designed for comprehensive file system operations, Git repository management, and Docker container management.
Filesystem MCP
A FastMCP 2.12.0+ compliant MCP server for comprehensive file system operations, Git repository management, and Docker container management. Built with modern Python patterns, enterprise-grade security, and extensive testing for professional deployment.
โจ Features
๐๏ธ File System Operations
- Read, write, and manage files and directories
- List directory contents with detailed file metadata
- Check file existence and get file information
- Recursive directory scanning with configurable depth
- File content analysis and manipulation
๐ณ Docker Container Management
-
Container Operations
- List, create, start, stop, and remove containers
- Execute commands inside running containers
- Stream container logs with filtering options
- Monitor container resource usage and statistics
- Inspect container details and configuration
-
Image Management
- List available Docker images
- Pull, build, and remove images
- Inspect image details and history
-
Network & Volume Management
- Create and manage Docker networks
- Manage Docker volumes and bind mounts
- Configure container networking
-
Docker Compose Support
- Deploy and manage multi-container applications
- Scale services up and down
- View service logs and status
๐ Git Repository Management
- Clone repositories with branch and depth control
- Get repository status (staged, unstaged, untracked changes)
- Commit changes with custom messages
- Read repository structure and file contents
- Manage branches and remotes
๐ค System Tools & Help
- Multilevel Help System: Hierarchical documentation with tool examples and use cases
- System Status Tool: Comprehensive system monitoring with resource usage metrics
- Interactive Guidance: Context-aware help with parameter validation and suggestions
๐ Advanced Features
- FastMCP 2.12.0+ Compliance: Modern tool registration with
@app.tool()
decorators - Enterprise Security: Path traversal protection, permission validation, audit trails
- Extensive Testing: Unit, integration, and performance tests with 80%+ coverage
- DXT Packaging: Professional deployment with all dependencies included
- Structured Logging: Comprehensive logging with file output and monitoring
- Async Operations: Full async/await support for optimal concurrency
- Pydantic V2: Modern data validation with
field_validator
andConfigDict
- FastMCP 2.10 compliant API
- Asynchronous operations for improved performance
- Detailed documentation and type hints
๐ Installation
Prerequisites
- Python 3.9+ (FastMCP 2.12.0+ requirement)
- Docker Engine (for container operations)
- Git (for repository operations)
- Node.js 20+ (for DXT packaging)
Quick Start with DXT (Recommended)
- Download the
filesystem-mcp.dxt
package from Releases - Drag & Drop the file to Claude Desktop
- Configure working directory when prompted
- Start using professional tools immediately
Manual Installation
# Clone the repository
git clone https://github.com/sandr/filesystem-mcp.git
cd filesystem-mcp
# Create and activate a virtual environment (recommended)
python -m venv venv
# On Windows: .\venv\Scripts\Activate.ps1
# On Unix/Mac: source venv/bin/activate
# Install with all dependencies
pip install -e .[dev,test]
# Install development dependencies (optional)
pip install -r requirements-dev.txt
Claude Desktop Configuration
After installation, configure Claude Desktop to use the filesystem MCP server by adding the following to your Claude Desktop configuration file (claude_desktop_config.json
):
Windows:
{
"mcpServers": {
"filesystem-mcp": {
"command": "python",
"args": ["-m", "filesystem_mcp"],
"env": {
"PYTHONPATH": "D:\\path\\to\\filesystem-mcp\\src",
"PYTHONUNBUFFERED": "1",
"FASTMCP_LOG_LEVEL": "INFO"
},
"cwd": "D:\\path\\to\\your\\working\\directory"
}
}
}
macOS/Linux:
{
"mcpServers": {
"filesystem-mcp": {
"command": "python",
"args": ["-m", "filesystem_mcp"],
"env": {
"PYTHONPATH": "/path/to/filesystem-mcp/src",
"PYTHONUNBUFFERED": "1",
"FASTMCP_LOG_LEVEL": "INFO"
},
"cwd": "/path/to/your/working/directory"
}
}
}
Configuration Notes:
- Replace
D:\\path\\to\\filesystem-mcp\\src
with the actual path to your cloned repository'ssrc
directory - Set
cwd
to your preferred working directory for file operations - The server supports the following optional environment variables:
FASTMCP_LOG_LEVEL
: Set toDEBUG
,INFO
,WARNING
, orERROR
GIT_USERNAME
: Default Git username for commitsGIT_EMAIL
: Default Git email for commits
Docker Installation
Run the MCP server in a container with all dependencies:
# Build the multi-platform Docker image
docker buildx build -t filesystem-mcp \
--platform linux/amd64,linux/arm64 .
# Run the container
docker run -d --name filesystem-mcp \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):/workspace \
filesystem-mcp
๐ค Help System & Status Tools
Multilevel Help System
Get comprehensive guidance for all tools:
# Overview of all categories and tools
get_help()
# Detailed help for file operations
get_help('file_operations')
# Specific tool documentation with examples
get_help('file_operations', 'read_file')
Help Categories:
file_operations
- File reading, writing, directory managementgit_operations
- Repository cloning, status, commits, branchesdocker_operations
- Container listing, resource monitoringsystem_tools
- Help and status functionality
System Status Monitoring
Monitor system resources and server health:
# Comprehensive system status
get_system_status()
# Resource monitoring only
get_system_status(include_processes=True, include_disk=True)
# Network and system info
get_system_status(include_network=True)
Status Metrics:
- CPU usage (physical/logical cores, frequency, load)
- Memory statistics (total, available, usage percentage)
- Disk usage (total, used, free space)
- Process information (top CPU consumers)
- Network interfaces (IP addresses, status)
- Server health (FastMCP version, tool count, status)
๐ ๏ธ Usage
Starting the Server
# Start the MCP server (default: http://0.0.0.0:8000)
python -m filesystem_mcp
# With custom host and port
python -m filesystem_mcp --host 127.0.0.1 --port 8080
# With debug mode enabled
python -m filesystem_mcp --debug
Available Tools
๐ File Operations
Tool | Description | Parameters |
---|---|---|
read_file | Read file contents | file_path , encoding |
write_file | Write to a file | file_path , content , encoding |
list_directory | List directory contents | directory_path , recursive |
file_exists | Check if file/directory exists | file_path |
get_file_info | Get file/directory metadata | file_path |
๐ณ Docker Operations
Container Management
- โ
list_containers
: List all containers with filtering options - โ
get_container
: Get detailed container information - โ
create_container
: Create a new container with custom configuration - โ
start_container
: Start a stopped container - โ
stop_container
: Stop a running container - โ
restart_container
: Restart a container - โ
remove_container
: Remove a container - โ
container_exec
: Execute commands in a container - โ
container_logs
: Stream container logs - โ
container_stats
: Get container resource usage statistics
Image Management
- โ
list_images
: List available Docker images - โ
get_image
: Get detailed image information - โ
pull_image
: Pull an image from a registry - โ
build_image
: Build an image from a Dockerfile - โ
remove_image
: Remove an image - โ
prune_images
: Remove unused images
Network & Volume Management
- โ
list_networks
: List Docker networks - โ
get_network
: Get detailed network information - โ
create_network
: Create a new network - โ
remove_network
: Remove a network - โ
prune_networks
: Remove unused networks - โ
list_volumes
: List Docker volumes - โ
get_volume
: Get detailed volume information - โ
create_volume
: Create a new volume - โ
remove_volume
: Remove a volume - โ
prune_volumes
: Remove unused volumes
Docker Compose
- โ
compose_up
: Start services defined in docker-compose.yml - โ
compose_down
: Stop and remove containers, networks, etc. - โ
compose_ps
: List containers for services - โ
compose_logs
: View output from containers - โ
compose_config
: Validate and view compose configuration - โ
compose_restart
: Restart compose services
๐ Repository Operations
Tool | Description | Parameters |
---|---|---|
clone_repo | Clone a Git repository | repo_url , target_dir , branch , depth |
get_repo_status | Get repository status | repo_path |
commit_changes | Commit changes to repository | repo_path , message , add_all , paths |
read_repo | Read repository structure | repo_path , max_depth , include_files , include_dirs |
๐ ๏ธ Developer Tools
Unified Developer Toolkit - One tool with 10 specialized commands:
Command | Description | Key Parameters |
---|---|---|
analyze_dependencies | Analyze project dependencies from package managers | path |
analyze_imports | Analyze Python import statements and dependencies | path , recursive , max_results |
analyze_project | Detect project type, frameworks, and structure | path , output_format |
check_file_sizes | Analyze file sizes and identify large files | path , recursive , max_results |
detect_duplicates | Find duplicate files by content hash | path , recursive , max_results |
find_symbols | Search for function/class definitions and usages | path , pattern , recursive |
find_todos | Find TODO/FIXME comments in codebase | path , recursive , max_results |
run_linter | Execute code linting (ruff, flake8, eslint) | path , fix , encoding |
validate_config | Validate configuration files (JSON/YAML/TOML/INI) | path |
validate_json | Parse and validate JSON files with structure analysis | path |
Usage:
# Analyze project structure
result = developer_tool('analyze_project', path='.')
# Find all TODO comments
todos = developer_tool('find_todos', path='src', recursive=True)
# Run linting with auto-fix
lint_result = developer_tool('run_linter', path='src/', fix=True)
# Find function definitions
symbols = developer_tool('find_symbols', pattern='auth', recursive=True)
Example Usage
from filesystem_mcp import app
# Get a list of available tools
tools = app.list_tools()
print(f"Available tools: {', '.join(tools.keys())}")
# Example: List running containers
try:
containers = tools["list_containers"]()
print(f"Running containers: {containers}")
except Exception as e:
print(f"Error: {e}")
# Example: Create a new container
container_config = {
"image": "nginx:latest",
"name": "my-nginx",
"ports": {"80/tcp": 8080},
"detach": True
}
container = tools["create_container"](**container_config)
print(f"Created container: {container}")
Example Usage
from filesystem_mcp import app
# Get a list of available tools
tools = app.list_tools()
print(f"Available tools: {', '.join(tools.keys())}")
# Use a tool
try:
result = tools["read_file"]("README.md")
print(f"File content: {result[:200]}...")
except Exception as e:
print(f"Error: {e}")
๐๏ธ Development
Project Structure
filesystem-mcp/
โโโ .github/ # GitHub workflows and templates
โโโ docs/ # Documentation files
โโโ filesystem_mcp/ # Main package
โ โโโ __init__.py # Package initialization
โ โโโ app.py # FastAPI application setup
โ โโโ config.py # Configuration management
โ โโโ models/ # Pydantic models
โ โโโ tools/ # Tool implementations
โ โ โโโ __init__.py # Tool registration
โ โ โโโ file_operations/ # File system tools
โ โ โโโ docker_operations/ # Docker management tools
โ โ โโโ repo_operations/ # Git repository tools
โ โโโ utils/ # Utility functions
โโโ tests/ # Test suite
โโโ .gitignore # Git ignore rules
โโโ LICENSE # MIT License
โโโ pyproject.toml # Project configuration and dependencies
โโโ README.md # This file
โโโ requirements-dev.txt # Development dependencies
๐งช Running Tests
# Install test dependencies
pip install -r requirements-dev.txt
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=filesystem_mcp --cov-report=term-missing
# Run specific test file
pytest tests/test_docker_operations.py -v
๐จ Code Style & Quality
This project enforces code quality using:
- Black - Code formatting
- isort - Import sorting
- mypy - Static type checking
- pylint - Code quality analysis
# Format code with Black
black .
# Sort imports with isort
isort .
# Type checking with mypy
mypy .
# Lint with pylint
pylint filesystem_mcp/
๐ฆ Building and Releasing
- Update the version in
pyproject.toml
- Update
CHANGELOG.md
- Commit changes with a message like "Bump version to x.y.z"
- Create a git tag:
git tag vx.y.z
- Push the tag:
git push origin vx.y.z
- GitHub Actions will automatically build and publish the package to PyPI
๐ค Contributing
Contributions are welcome! Please read our for details on how to submit pull requests, report issues, or suggest new features.
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Changelog
See for a history of changes to this project.