Rust MCP Filesystem Server
Rust MCP Filesystem Server is a high-performance filesystem MCP server built with Rust, providing fast and secure file operations.
Features
- 🚀 High Performance - Rust-powered high-performance file operations
- 🔒 Secure Access - Configurable access control
- 📁 File Operations - File read/write, directory traversal
- 🔍 File Search - Fast file searching
- 📊 File Info - File metadata queries
- ⚡ Async I/O - Asynchronous file I/O operations
Environment Variables
| Variable | Default | Description |
|---|---|---|
RUST_MCP_FILESYSTEM_VERSION |
latest |
Docker image version |
RUST_MCP_FILESYSTEM_PORT_OVERRIDE |
8000 |
Service port |
ALLOWED_PATHS |
/projects |
Allowed access paths |
HOST_WORKSPACE_PATH |
./workspace |
Host workspace path to mount |
TZ |
UTC |
Timezone |
Quick Start
1. Configure Environment
Create a .env file:
RUST_MCP_FILESYSTEM_VERSION=latest
RUST_MCP_FILESYSTEM_PORT_OVERRIDE=8000
ALLOWED_PATHS=/projects
HOST_WORKSPACE_PATH=/path/to/your/workspace
TZ=Asia/Shanghai
2. Configure File Access
In docker-compose.yaml, configure directories to access:
volumes:
# Read-only access
- /path/to/workspace:/projects/workspace:ro
# Read-write access (remove :ro)
- /path/to/data:/projects/data
3. Start Service
docker compose up -d
4. Verify Service
curl http://localhost:8000/health
Security Features
The service implements multiple layers of security:
- Read-only Filesystem: Container filesystem set to read-only
- Permission Restrictions: Minimized container permissions
- Path Restrictions: Only configured paths can be accessed
- No Privilege Escalation: Prevents privilege escalation
- Capability Restrictions: Only necessary Linux capabilities retained
Performance Characteristics
- ✅ Zero-copy: Leverages Rust's zero-copy features
- ✅ Async I/O: High-concurrency file operations
- ✅ Memory Safety: Memory safety guaranteed by Rust
- ✅ Low Resource Usage: Minimum 64MB memory
Resource Requirements
- Minimum memory: 64MB
- Recommended memory: 256MB
- CPU: 0.25-1.0 cores
Common Use Cases
- Code Repository Access - Allow AI to access and analyze codebases
- Document Processing - Read and process document files
- Log Analysis - Analyze log files
- Configuration Management - Read and update configuration files
Security Recommendations
⚠️ Important: When using:
- Only mount necessary directories
- Prefer read-only mode (
:ro) - Do not mount sensitive system directories
- Regularly audit access logs
- Use firewall to restrict network access
Comparison with Other Implementations
| Feature | Rust Implementation | Node.js Implementation |
|---|---|---|
| Performance | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
| Memory Usage | 64MB+ | 128MB+ |
| Concurrency | Excellent | Good |
| Startup Speed | Fast | Medium |
References
License
MIT License