File Manager MCP
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@File Manager MCPfind duplicate files in the Downloads folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
File Manager MCP
π― Overview
File Manager MCP is a production-grade Model Context Protocol (MCP) server built with FastMCP that provides comprehensive file system management capabilities. It enables AI agents, LLM applications, and remote clients to interact with the filesystem through a standardized, secure interface via Streamable HTTP transport.
Whether you're building intelligent file automation workflows, AI-assisted development tools, or delegating filesystem operations to autonomous agents, File Manager MCP provides a robust, well-tested foundation with 34 specialized tools covering everything from basic CRUD operations to advanced utilities like duplicate detection, batch processing, and archive management.
Why File Manager MCP?
Standardized Protocol: Implements Model Context Protocol for seamless integration with AI frameworks and agents
Comprehensive Tooling: 34 production-tested tools covering all major filesystem operations
AI-First Design: Purpose-built for LLM interactions and autonomous agent workflows
Enterprise-Ready: Security validations, error handling, logging, and deployment patterns
Streamable HTTP: Modern transport protocol enabling real-time interactions
FastMCP Foundation: Leverages the lightweight, async-native FastMCP framework
Related MCP server: MCP Filesystem Server
β¨ Features
Core File Operations
CRUD Operations: List, create, read, update, delete files
Advanced Operations: Append, rename, move, copy files with full path validation
Directory Management: Create, delete, and analyze directory structures
Batch Operations: Efficient bulk operations for files and directories (create, delete, move, copy, rename)
Search & Discovery
File Search: Find files by name patterns across directory trees
File Metadata: Retrieve detailed file and directory information
Tree Generation: Generate visual directory tree representations
Large File Discovery: Identify files exceeding specified size thresholds
Archive & Compression
ZIP Operations: Create, extract, and list ZIP archive contents
Batch Archive: Process multiple files and directories into archives
Advanced Utilities
File Hashing: Generate MD5, SHA-1, and SHA-256 hashes for integrity verification
Duplicate Detection: Find duplicate files across directories using content hashing
File Comparison: Compare files at byte level for differences
Directory Comparison: Analyze structural differences between directories
Cleanup Operations: Identify and remove temporary files and empty directories
System & Health
Health Checks: Monitor server status and availability
Tool Discovery: Enumerate all available tools and their specifications
Server Information: Access server configuration and metadata
Logging: Comprehensive request/response logging for debugging and auditing
ποΈ Architecture
High-Level Design
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Agent / Client β
β (Claude, Local Agent, etc.) β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
MCP Protocol
(Streamable HTTP)
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β File Manager MCP Server β
β (FastMCP + Uvicorn on Port 8000) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
β βFile Service β βSearch Serviceβ βBatch Service β β
β β(CRUD, I/O) β β(Find, Tree) β β(Bulk Ops) β β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
β β ZIP Service β βUtility Serviceβ βSecurity Service β β
β β(Archive) β β(Hash, Clean) β β(Path Validation)β β
β βββββββββββββββ βββββββββββββββ ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Filesystem (Local/Remote) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββService Architecture
File Service: Core file I/O operations with path validation
Search Service: Pattern matching and tree generation
Batch Service: Optimized bulk operations with rollback capability
ZIP Service: Archive creation and extraction
Utility Service: Hashing, deduplication, cleanup, and comparison
Security Service: Path traversal prevention and permission checks
π Project Structure
file-manager-mcp/
βββ main.py # Entry point, MCP server initialization
βββ server.py # FastMCP server configuration
βββ auth.py # Authentication & authorization
βββ config.py # Configuration management
βββ requirements.txt # Python dependencies
βββ README.md # This file
β
βββ services/ # Core business logic
β βββ file_service.py # File CRUD operations
β βββ search_service.py # Search and discovery tools
β βββ batch_service.py # Bulk operations
β βββ zip_service.py # Archive operations
β βββ utility_service.py # Hash, cleanup, comparison tools
β βββ security_service.py # Security validations
β
βββ server.log # Application logsπ Installation
Prerequisites
Python: 3.11 or higher
UV: Package manager (recommended) or pip
Git: For cloning the repository
Quick Setup
# Clone the repository
git clone https://github.com/parthRana26/file-manager-mcp.git
cd file-manager-mcp
# Create virtual environment
uv venv
# Activate environment
# On Linux/macOS:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txtDependencies
Key dependencies (see requirements.txt for complete list):
fastmcp: FastMCP framework for MCP server implementation
uvicorn: ASGI web server for HTTP transport
pydantic: Data validation and configuration management
aiofiles: Async file I/O operations
python-dotenv: Environment variable management
π» Local Development
Running the Server
# Start the MCP server
uv run python main.pyExpected output:
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: File Manager MCP Server initialized
INFO: 34 tools registered
INFO: Ready to accept connectionsThe server will be available at: http://localhost:8000/mcp
Development Environment Variables
Create a .env file in the project root:
# Server configuration
MCP_HOST=0.0.0.0
MCP_PORT=8000
LOG_LEVEL=DEBUG
# Optional: Set allowed base directories
ALLOWED_BASE_DIRS=/path/to/workspace
# Optional: Enable security features
ENABLE_PATH_VALIDATION=true
ENABLE_REQUEST_LOGGING=trueLogging & Debugging
Enable debug logging:
# Run with debug logging
LOG_LEVEL=DEBUG uv run python main.pyLogs are written to server.log and console. Each request/response is logged with:
Timestamp
Tool name
Parameters
Result status
Execution time
π§ͺ Testing with MCP Inspector
The MCP Inspector is an interactive testing tool for MCP servers.
Setup & Connection
# Terminal 1: Start the File Manager MCP server
uv run python main.py
# Terminal 2: Open MCP Inspector
npx @modelcontextprotocol/inspectorConnecting to the Server
In the Inspector UI:
Transport: Select
Streamable HTTPURL: Enter
http://localhost:8000/mcpConnect: Click the connect button
Testing Tools
Once connected, you can:
Browse Tools: View all 34 available tools with their specifications
Execute Tools: Call any tool with custom parameters
View Results: See tool outputs, errors, and execution details
Inspect Resources: Access resource definitions if applicable
Example Test Workflow
1. Call: health_check_tool
β Verify server is running
2. Call: available_tools_tool
β List all registered tools
3. Call: list_files_tool with path: "."
β List current directory contents
4. Call: tree_view_tool with path: "." and max_depth: 3
β Generate directory tree
5. Call: search_files_tool with pattern: "*.py" and path: "."
β Find all Python filesπ Deployment
Prefect Horizon (Recommended)
Prefect Horizon is the official hosting platform for MCP servers with built-in scaling, monitoring, and management.
Deployment Steps
Push to GitHub
git push origin mainAccess Prefect Horizon
Navigate to Prefect Horizon
Sign in with your account
Create Hosted MCP Server
Click "Create" β "Hosted MCP Server"
Select "File Manager MCP" or your forked repository
Configure Deployment
Repository:
parthRana26/file-manager-mcpBranch:
main(or your desired branch)Entrypoint:
main.pyPort:
8000
Set Environment Variables
LOG_LEVEL=INFO ENABLE_PATH_VALIDATION=trueDeploy
Click "Deploy"
Wait for deployment confirmation
Access your server via provided URL
Monitoring & Logs
In Prefect Horizon:
View real-time server logs
Monitor tool execution statistics
Track request/response times
Set up alerts for errors
Alternative Deployment Platforms
Docker
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]docker build -t file-manager-mcp .
docker run -p 8000:8000 file-manager-mcpRailway, Render, or VPS
These platforms support Python ASGI applications. Ensure:
Python 3.11+ runtime
Port 8000 exposure
Environment variables configured
Health check endpoint:
GET /health
π Usage Examples
Basic File Operations
# Using Python client
from mcp import Client
client = Client("http://localhost:8000/mcp")
# List files in directory
result = await client.call_tool("list_files_tool", {
"path": "/home/user/documents"
})
# Create a new file
result = await client.call_tool("create_file_tool", {
"path": "/home/user/documents/notes.txt",
"content": "Hello, World!"
})
# Read file content
result = await client.call_tool("read_file_tool", {
"path": "/home/user/documents/notes.txt"
})
# Update file
result = await client.call_tool("update_file_tool", {
"path": "/home/user/documents/notes.txt",
"content": "Updated content"
})
# Delete file
result = await client.call_tool("delete_file_tool", {
"path": "/home/user/documents/notes.txt"
})Search Operations
# Find all Python files
result = await client.call_tool("search_files_tool", {
"path": "/home/user/projects",
"pattern": "*.py"
})
# Get file information
result = await client.call_tool("get_file_info_tool", {
"path": "/home/user/projects/main.py"
})
# Generate directory tree
result = await client.call_tool("tree_view_tool", {
"path": "/home/user/projects",
"max_depth": 3
})Batch Operations
# Batch create multiple files
result = await client.call_tool("batch_create_files_tool", {
"files": [
{"path": "/tmp/file1.txt", "content": "File 1"},
{"path": "/tmp/file2.txt", "content": "File 2"},
{"path": "/tmp/file3.txt", "content": "File 3"}
]
})
# Batch delete files
result = await client.call_tool("batch_delete_files_tool", {
"paths": [
"/tmp/file1.txt",
"/tmp/file2.txt",
"/tmp/file3.txt"
]
})
# Batch move files
result = await client.call_tool("batch_move_files_tool", {
"operations": [
{"source": "/tmp/src1.txt", "destination": "/home/user/dst1.txt"},
{"source": "/tmp/src2.txt", "destination": "/home/user/dst2.txt"}
]
})Archive Operations
# Create ZIP archive
result = await client.call_tool("create_zip_tool", {
"source_path": "/home/user/documents",
"zip_path": "/home/user/backup.zip"
})
# Extract ZIP archive
result = await client.call_tool("extract_zip_tool", {
"zip_path": "/home/user/backup.zip",
"extract_path": "/home/user/restored"
})
# List ZIP contents
result = await client.call_tool("list_zip_contents_tool", {
"zip_path": "/home/user/backup.zip"
})Utility Operations
# Find large files
result = await client.call_tool("find_large_files_tool", {
"path": "/home/user",
"size_mb": 100
})
# Generate file hash
result = await client.call_tool("file_hash_tool", {
"path": "/home/user/file.bin",
"algorithm": "sha256"
})
# Find duplicate files
result = await client.call_tool("duplicate_file_finder_tool", {
"path": "/home/user/documents"
})
# Compare files
result = await client.call_tool("compare_files_tool", {
"path1": "/home/user/file1.txt",
"path2": "/home/user/file2.txt"
})
# Compare directories
result = await client.call_tool("compare_directories_tool", {
"path1": "/home/user/backup1",
"path2": "/home/user/backup2"
})
# Clean temporary files
result = await client.call_tool("clean_temp_files_tool", {
"path": "/home/user"
})
# Clean empty directories
result = await client.call_tool("clean_empty_directories_tool", {
"path": "/home/user"
})π Example MCP Workflow
Scenario: Automated Backup & Cleanup System
import asyncio
from mcp import Client
async def backup_and_cleanup():
"""
Automated workflow:
1. Find large files that aren't backed up
2. Create ZIP archive of important directories
3. Identify and remove duplicate files
4. Clean up temporary files
5. Verify backup integrity with hashing
"""
client = Client("http://localhost:8000/mcp")
# Step 1: Find large files
print("π Analyzing large files...")
large_files = await client.call_tool("find_large_files_tool", {
"path": "/home/user/documents",
"size_mb": 50
})
print(f"Found {len(large_files['files'])} files > 50MB")
# Step 2: Create backup
print("π¦ Creating backup archive...")
backup = await client.call_tool("create_zip_tool", {
"source_path": "/home/user/documents",
"zip_path": "/backups/documents-latest.zip"
})
print(f"Backup created: {backup['zip_path']}")
# Step 3: Find duplicates
print("π Detecting duplicate files...")
duplicates = await client.call_tool("duplicate_file_finder_tool", {
"path": "/home/user/documents"
})
print(f"Found {len(duplicates['duplicates'])} duplicate sets")
# Step 4: Remove duplicates (keep one of each)
for dup_group in duplicates['duplicates'][1:]: # Keep first, delete rest
for dup_file in dup_group[1:]:
await client.call_tool("delete_file_tool", {
"path": dup_file
})
print("β
Removed duplicate files")
# Step 5: Clean temporary files
print("π§Ή Cleaning temporary files...")
cleaned = await client.call_tool("clean_temp_files_tool", {
"path": "/home/user"
})
print(f"Removed {cleaned['count']} temporary files")
# Step 6: Verify backup integrity
print("π Verifying backup integrity...")
hash_result = await client.call_tool("file_hash_tool", {
"path": "/backups/documents-latest.zip",
"algorithm": "sha256"
})
print(f"Backup hash: {hash_result['hash']}")
print("\n⨠Backup and cleanup workflow completed!")
# Run the workflow
asyncio.run(backup_and_cleanup())π― All Available Tools (34 Total)
File Management (11 tools)
Tool | Purpose |
| List files and directories |
| Create new file with content |
| Read file contents |
| Replace entire file content |
| Append content to file |
| Delete a file |
| Rename file |
| Move file to new location |
| Copy file to destination |
| Create new directory |
| Delete directory (recursive) |
Search & Discovery (4 tools)
Tool | Purpose |
| Find files by name pattern |
| Get detailed file metadata |
| Get directory statistics |
| Generate directory tree |
Batch Operations (7 tools)
Tool | Purpose |
| Create multiple files |
| Delete multiple files |
| Move multiple files |
| Copy multiple files |
| Rename multiple files |
| Create multiple directories |
| Delete multiple directories |
Archive Operations (3 tools)
Tool | Purpose |
| Create ZIP archive |
| Extract ZIP archive |
| List ZIP contents |
Utilities (7 tools)
Tool | Purpose |
| Generate file hash (MD5, SHA-1, SHA-256) |
| Find duplicate files |
| Compare two files |
| Compare two directories |
| Find files exceeding size threshold |
| Remove empty directories |
| Remove temporary files |
System & Metadata (2 tools)
Tool | Purpose |
| Check server health |
| Get server configuration |
| List all available tools |
π Security Considerations
File Manager MCP implements multiple security layers to prevent misuse and unauthorized access:
Path Validation
Path Traversal Prevention: All paths are validated to prevent
../escape sequencesSymbolic Link Protection: Symlinks are resolved and validated against allowed base directories
Absolute Path Enforcement: All paths are converted to absolute paths for consistency
Access Control
Base Directory Restriction: Operations are restricted to configured allowed directories
Permission Checks: Filesystem permissions are respected before operations
Request Authentication: Authentication headers can be validated via
auth.py
Data Safety
Atomic Operations: File operations use atomic writes to prevent corruption
Backup Before Delete: Critical operations can be logged for audit trails
Error Handling: Detailed error messages without exposing sensitive paths
Best Practices
# β
DO: Validate user input
result = await client.call_tool("create_file_tool", {
"path": secure_path_join(base_dir, user_input),
"content": sanitized_content
})
# β DON'T: Trust user paths directly
result = await client.call_tool("create_file_tool", {
"path": user_provided_path, # Potential traversal attack!
"content": content
})Deployment Security
When deploying to production:
Enable Path Validation: Set
ENABLE_PATH_VALIDATION=trueConfigure Allowed Directories: Set
ALLOWED_BASE_DIRSenvironment variableEnable Request Logging: Set
ENABLE_REQUEST_LOGGING=trueUse HTTPS: Deploy behind reverse proxy with TLS
Restrict Network Access: Use firewall rules to limit access
Implement Rate Limiting: Prevent abuse through request throttling
Monitor Logs: Set up alerting for suspicious activities
β‘ Performance Considerations
Optimization Strategies
1. Batch Operations
Use batch operations for better performance:
# β Inefficient: Multiple individual calls
for file in files:
await client.call_tool("create_file_tool", {"path": file, "content": content})
# β
Efficient: Single batch call
await client.call_tool("batch_create_files_tool", {"files": files})Performance Impact: Batch operations are 5-10x faster for multiple files.
2. Search Optimization
Limit search scope to improve performance:
# β
Better: Narrow search scope
await client.call_tool("search_files_tool", {
"path": "/home/user/documents", # Specific directory
"pattern": "*.pdf"
})
# β Slower: Full filesystem search
await client.call_tool("search_files_tool", {
"path": "/", # Entire filesystem
"pattern": "*.pdf"
})3. Large File Operations
For large directories or files:
# When listing directories with thousands of files
# Use pagination and limit results
result = await client.call_tool("list_files_tool", {
"path": "/large/directory",
"max_results": 1000
})4. Hashing Performance
Use faster algorithms for large files:
# β Slower: Full SHA-256 hash
result = await client.call_tool("file_hash_tool", {
"path": "/large/file.iso",
"algorithm": "sha256"
})
# β
Faster: Quick MD5 for deduplication
result = await client.call_tool("file_hash_tool", {
"path": "/large/file.iso",
"algorithm": "md5"
})Benchmarks
Typical performance metrics on modern hardware:
Operation | Time | Notes |
List 10,000 files | ~500ms | Single directory, no recursion |
Create file | ~5ms | Includes I/O |
Batch create 100 files | ~50ms | ~0.5ms per file |
Create ZIP (1GB) | ~2-5s | Depends on I/O speed |
Hash large file (1GB) | ~3-8s | Algorithm and disk speed dependent |
Find duplicates | Linear | Proportional to total file size |
Tree view (10 levels) | ~200ms | Depends on directory breadth |
Recommended Settings
# Server configuration for optimal performance
MAX_CONCURRENT_OPERATIONS=10
REQUEST_TIMEOUT_SECONDS=300
BATCH_OPERATION_SIZE=1000
LOG_LEVEL=INFO # Use INFO in production, not DEBUGπΊοΈ Roadmap
Phase 1: Core Foundation β
Basic CRUD operations
Directory management
File search and discovery
Archive operations
Utility tools (hash, cleanup)
Health checks and metadata
Phase 2: Advanced Features (Current)
Batch operations with rollback
Duplicate file detection
Directory comparison
Detailed logging and monitoring
Phase 3: Enterprise Features (Planned)
File watch/monitoring service
Encryption support (AES-256)
Database integration for metadata
Advanced permission models
Distributed operations support
Phase 4: Integration & Expansion (Planned)
Cloud storage backends (S3, GCS, Azure)
Database file operations
Media file processing
Advanced analytics dashboard
π Future Enhancements
Planned Improvements
1. File Monitoring & Watching
# Future: Watch files for changes
await client.call_tool("watch_directory_tool", {
"path": "/home/user/documents",
"callback_url": "https://your-api.com/file-changes",
"filter": "*.pdf"
})2. Encryption Support
# Future: Encrypt/decrypt files
await client.call_tool("encrypt_file_tool", {
"path": "/home/user/sensitive.txt",
"algorithm": "aes-256",
"password": "secure-password"
})3. Cloud Storage Backends
# Future: Seamless cloud integration
await client.call_tool("upload_to_s3_tool", {
"local_path": "/home/user/backup.zip",
"s3_path": "s3://my-bucket/backups/",
"region": "us-west-2"
})4. Media Processing
# Future: Image/video operations
await client.call_tool("create_thumbnail_tool", {
"image_path": "/home/user/photo.jpg",
"output_path": "/home/user/thumb.jpg",
"size": "256x256"
})5. Sync Operations
# Future: Two-way sync between directories
await client.call_tool("sync_directories_tool", {
"source": "/home/user/local",
"destination": "/mnt/nas/backup",
"bidirectional": True,
"ignore_patterns": ["*.tmp", "node_modules"]
})π€ Contributing
We welcome contributions from the community! Whether it's bug reports, feature requests, or code improvements, your help makes File Manager MCP better.
Getting Started
Fork the repository
git clone https://github.com/your-username/file-manager-mcp.gitCreate a feature branch
git checkout -b feature/your-feature-nameMake your changes
Follow PEP 8 style guidelines
Write descriptive commit messages
Add tests for new functionality
Update documentation as needed
Commit and push
git commit -am "Add your feature description" git push origin feature/your-feature-nameOpen a Pull Request
Describe your changes in detail
Reference related issues
Ensure all tests pass
Development Guidelines
Code Style: Follow PEP 8 and use
blackfor formattingTesting: Write unit tests for new features
Documentation: Update docstrings and README
Error Handling: Provide meaningful error messages
Logging: Add appropriate log statements for debugging
Report Issues
Found a bug? Please open an issue with:
Detailed description of the problem
Steps to reproduce
Expected vs actual behavior
Environment details (Python version, OS, etc.)
Relevant logs or error messages
Feature Requests
Have an idea for improvement? Create an issue with:
Clear description of the feature
Use cases and benefits
Suggested implementation approach
Any relevant examples
π License
File Manager MCP is licensed under the MIT License.
See the LICENSE file for full details.
Summary
The MIT License permits you to:
β Use, modify, and distribute this software
β Use it for commercial and private purposes
β Include it in proprietary applications
With the conditions:
π Include a copy of the license and copyright notice
π State significant changes made to the software
π€ Author
Parth Rana
GitHub: github.com/parthRana26
Repository: github.com/parthRana26/file-manager-mcp
Email: [contact via GitHub]
About
Parth Rana is a software engineer passionate about building robust, scalable systems for AI applications. File Manager MCP represents the intersection of practical filesystem management and modern AI agent architectures.
π Support & Community
GitHub Issues: Report bugs or request features
GitHub Discussions: Ask questions and discuss ideas
MCP Documentation: modelcontextprotocol.io
FastMCP Guide: FastMCP Documentation
π Learning Resources
Getting Started with MCP
Python & Async Programming
File System Best Practices
π Project Statistics
Metric | Value |
Total Tools | 34 |
Lines of Code | ~3,000+ |
Service Modules | 6 |
Python Version | 3.11+ |
License | MIT |
Status | Production Ready |
Last Updated | 2024 |
β Show Your Support
If you find File Manager MCP useful, please:
β Star this repository
π Share it with your network
π¬ Provide feedback and suggestions
π€ Contribute to the project
π Write about it in your blog
Made with β€οΈ by Parth Rana
Last Updated: 2024 | Version: 1.0.0 | Status: Production Ready
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/parthRana26/file-manager-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server