filesystem-mcp
Filesystem MCP 📁
Secure filesystem operations for AI agents - Token-optimized with batch processing
Batch operations • Project root safety • Token optimized • Zod validation
Quick Start • Installation • Tools
🚀 Overview
Empower your AI agents (like Claude/Cline) with secure, efficient, and token-saving access to your project files. This Node.js server implements the Model Context Protocol (MCP) to provide a robust set of filesystem tools.
The Problem:
Traditional AI filesystem access:
- Shell commands for each operation ❌
- No batch processing (high token cost) ❌
- Unsafe (no project root boundaries) ❌
- High latency (shell spawn overhead) ❌The Solution:
Filesystem MCP Server:
- Batch operations (10+ files at once) ✅
- Token optimized (reduce round trips) ✅
- Secure (confined to project root) ✅
- Direct API (no shell overhead) ✅Result: Safe, fast, and token-efficient filesystem operations for AI agents.
Related MCP server: image-reader MCP Server
⚡ Performance Advantages
Token & Latency Optimization
Metric | Individual Shell Commands | Filesystem MCP | Improvement |
Operations/Request | 1 file | 10+ files | 10x reduction |
Round Trips | N operations | 1 request | N× fewer |
Latency | Shell spawn per op | Direct API | 5-10× faster |
Token Usage | High overhead | Batched context | 50-70% less |
Error Reporting | stderr parsing | Per-item status | Detailed |
Real-World Benefits
Batch file reads - Read 10 files in one request vs 10 requests
Multi-file edits - Edit multiple files with single tool call
Recursive operations - List entire directory trees efficiently
Detailed status - Per-item success/failure reporting
🎯 Why Choose This Server?
Security & Safety
🛡️ Project Root Confinement - All operations restricted to
cwdat launch🔒 Permission Control - Built-in chmod/chown tools
✅ Validation - Zod schemas validate all arguments
🚫 Path Traversal Prevention - Cannot escape project directory
Efficiency & Performance
⚡ Batch Processing - Process multiple files/directories per request
🎯 Token Optimized - Reduce AI-server communication overhead
🚀 Direct API - No shell process spawning
📊 Detailed Results - Per-item status for batch operations
Developer Experience
🔧 Easy Setup -
npx/bunxfor instant use🐳 Docker Ready - Official Docker image available
📦 Comprehensive Tools - 11+ filesystem operations
🔄 MCP Standard - Full protocol compliance
📦 Installation
Method 1: npx/bunx (Recommended)
The simplest way - always uses latest version from npm.
Using npx:
{
"mcpServers": {
"filesystem-mcp": {
"command": "npx",
"args": ["@sylphx/filesystem-mcp"],
"name": "Filesystem (npx)"
}
}
}Using bunx:
{
"mcpServers": {
"filesystem-mcp": {
"command": "bunx",
"args": ["@sylphx/filesystem-mcp"],
"name": "Filesystem (bunx)"
}
}
}Important: The server uses its own Current Working Directory (cwd) as the project root. Ensure your MCP host (e.g., Cline/VSCode) launches the command with cwd set to your project's root directory.
Method 2: Docker
Use the official Docker image for containerized environments.
{
"mcpServers": {
"filesystem-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/path/to/your/project:/app",
"sylphx/filesystem-mcp:latest"
],
"name": "Filesystem (Docker)"
}
}
}Remember to replace /path/to/your/project with your actual project path.
Method 3: Local Build (Development)
# Clone repository
git clone https://github.com/SylphxAI/filesystem-mcp.git
cd filesystem-mcp
# Install dependencies
pnpm install
# Build
pnpm run build
# Watch mode (auto-rebuild)
pnpm run devMCP Host Configuration:
{
"mcpServers": {
"filesystem-mcp": {
"command": "node",
"args": ["/path/to/filesystem-mcp/dist/index.js"],
"name": "Filesystem (Local Build)"
}
}
}🚀 Quick Start
Once configured in your MCP host (see Installation), your AI agent can immediately use the filesystem tools.
Example Agent Interaction
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>read_content</tool_name>
<arguments>{"paths": ["src/index.ts", "package.json"]}</arguments>
</use_mcp_tool>Server Response:
{
"results": [
{
"path": "src/index.ts",
"content": "...",
"success": true
},
{
"path": "package.json",
"content": "...",
"success": true
}
]
}📋 Features
File Operations
Tool | Description | Batch Support |
read_content | Read file contents | ✅ Multiple files |
write_content | Write/append to files | ✅ Multiple files |
edit_file | Surgical edits with diff output | ✅ Multiple files |
search_files | Regex search with context | ✅ Multiple files |
replace_content | Multi-file search & replace | ✅ Multiple files |
Directory Operations
Tool | Description | Batch Support |
list_files | List files/directories recursively | Single path |
stat_items | Get detailed file/directory status | ✅ Multiple items |
create_directories | Create directories with parents | ✅ Multiple paths |
Management Operations
Tool | Description | Batch Support |
delete_items | Remove files/directories | ✅ Multiple items |
move_items | Move/rename files/directories | ✅ Multiple items |
copy_items | Copy files/directories | ✅ Multiple items |
Permission Operations
Tool | Description | Batch Support |
chmod_items | Change POSIX permissions | ✅ Multiple items |
chown_items | Change ownership | ✅ Multiple items |
Key Benefit: Tools supporting batch operations process each item individually and return detailed per-item status reports.
💡 Design Philosophy
Core Principles
Security First
All operations confined to project root
Path traversal prevention
Permission controls built-in
Efficiency Focused
Batch processing reduces token usage
Direct API calls (no shell overhead)
Minimal communication round trips
Robustness
Per-item success/failure reporting
Detailed error messages
Zod schema validation
Simplicity
Clear, consistent API
MCP standard compliance
Easy integration
📊 Comparison with Alternatives
Feature | Filesystem MCP | Shell Commands | Other Scripts |
Security | ✅ Root confined | ❌ Full shell access | ⚠️ Variable |
Token Efficiency | ✅ Batching | ❌ One op/command | ⚠️ Variable |
Latency | ✅ Direct API | ❌ Shell spawn | ⚠️ Variable |
Batch Operations | ✅ Most tools | ❌ No | ⚠️ Maybe |
Error Reporting | ✅ Per-item detail | ❌ stderr parsing | ⚠️ Variable |
Setup | ✅ Easy (npx/Docker) | ⚠️ Secure shell setup | ⚠️ Custom |
MCP Standard | ✅ Full compliance | ❌ No | ⚠️ Variable |
🛠️ Tech Stack
Component | Technology |
Language | TypeScript (strict mode) |
Runtime | Node.js / Bun |
Protocol | Model Context Protocol (MCP) |
Validation | Zod schemas |
Package Manager | pnpm |
Distribution | npm + Docker Hub |
🎯 Use Cases
AI Agent Development
Enable AI agents to:
Read project files - Access code, configs, docs
Edit multiple files - Refactor across codebase
Search codebases - Find patterns and definitions
Manage project structure - Create, move, organize files
Code Assistants
Build powerful coding tools:
Cline/Claude integration - Direct filesystem access
Batch refactoring - Edit multiple files at once
Safe operations - Confined to project directory
Efficient operations - Reduce token costs
Automation & Scripting
Automate development tasks:
File generation - Create boilerplate files
Project setup - Initialize directory structures
Batch processing - Handle multiple files efficiently
Content transformation - Search and replace across files
🗺️ Roadmap
✅ Completed
Core filesystem operations (read, write, edit, etc.)
Batch processing for most tools
Project root security
Docker image
npm package
Zod validation
🚀 Planned
File watching capabilities
Streaming support for large files
Advanced filtering for
list_filesPerformance benchmarks
Compression/decompression tools
Symlink management
🤝 Contributing
Contributions are welcome! Please follow these guidelines:
Fork the repository
Create a feature branch -
git checkout -b feature/my-featureWrite tests - Ensure good coverage
Follow TypeScript strict mode - Type safety first
Add documentation - Update README if needed
Submit a pull request
Development Setup
# Clone and install
git clone https://github.com/SylphxAI/filesystem-mcp.git
cd filesystem-mcp
pnpm install
# Build
pnpm run build
# Watch mode (auto-rebuild)
pnpm run dev🤝 Support
Show Your Support: ⭐ Star • 👀 Watch • 🐛 Report bugs • 💡 Suggest features • 🔀 Contribute
📄 License
MIT © Sylphx
🙏 Credits
Built with:
Model Context Protocol - MCP standard
Zod - Schema validation
TypeScript - Type safety
pnpm - Package manager
Special thanks to the MCP community ❤️
📚 Publishing
This repository uses GitHub Actions to automatically publish to:
Docker Hub: sylphx/filesystem-mcp
Triggered on version tags (v*.*.*) pushed to main branch.
Required secrets: NPM_TOKEN, DOCKERHUB_USERNAME, DOCKERHUB_TOKEN
Available Tools
12 toolschmod_itemsC
Change permissions mode for multiple specified files/directories (POSIX-style).
Inputs: mode (required), paths (required).
chown_itemsC
Change owner (UID) and group (GID) for multiple specified files/directories.
Inputs: gid (required), paths (required), uid (required).
copy_itemsC
Copy multiple specified files/directories.
Inputs: operations (required).
create_directoriesC
Create multiple specified directories (including intermediate ones).
Inputs: paths (required).
delete_itemsC
Delete multiple specified files or directories.
Inputs: paths (required).
list_filesC
List files/directories. Can optionally include stats and list recursively.
Inputs: include_stats, path, recursive.
move_itemsC
Move or rename multiple specified files/directories.
Inputs: operations (required).
read_contentC
Read content from multiple specified files.
Inputs: paths (required).
replace_contentC
Replace content within files across multiple specified paths.
Inputs: operations (required), paths (required).
search_filesB
Search for a regex pattern within files in a specified directory (read-only).
Inputs: regex (required), file_pattern, path.
stat_itemsC
Get detailed status information for multiple specified paths.
Inputs: paths (required).
write_contentC
Write or append content to multiple specified files (creating directories if needed).
Inputs: items (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Every tool has a clearly distinct purpose with no ambiguity. Each tool targets a specific filesystem operation (e.g., copy_items vs. move_items, read_content vs. write_content), and the descriptions clearly differentiate their functions. There is no overlap that would cause an agent to misselect between tools.
All tool names follow a consistent verb_noun pattern with snake_case throughout (e.g., list_files, create_directories, delete_items). The naming is predictable and readable, with no deviations or mixed conventions, making it easy for agents to understand and use the tool set.
With 12 tools, the count is well-scoped for a filesystem server, covering essential operations without being overwhelming. Each tool earns its place by addressing a core filesystem task, such as file management, content handling, and metadata operations, making the set comprehensive yet manageable.
The tool set provides complete coverage for filesystem operations, including CRUD/lifecycle functions (create, read, update, delete), file manipulation (copy, move), permissions (chmod, chown), and search capabilities. There are no obvious gaps, and agents can perform typical filesystem workflows without dead ends.
Maintenance
Related MCP Connectors
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
An MCP server that used to create notes
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceA TypeScript-based MCP server that implements a simple notes system, allowing users to create, access, and generate summaries of text notes.123-
- FlicenseAqualityNot gradedmaintenanceA TypeScript-based MCP server that implements a simple notes system, allowing creation and management of text notes with URIs and metadata.4-
- FlicenseBqualityDmaintenanceA TypeScript-based MCP server that implements a simple notes system, allowing users to create, access, and generate summaries of text notes.23-
- FlicenseCqualityDmaintenanceA TypeScript-based MCP server implementing a simple notes system that allows users to create, access, and generate summaries of text notes.1-