filesystem-mcp

SylphxAI/filesystem-mcp

3.4

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 secure and efficient server for AI agents to perform filesystem operations, optimized for token usage and batch processing.

Tools
5
Resources
0
Prompts
0

Filesystem MCP ๐Ÿ“

Secure filesystem operations for AI agents - Token-optimized with batch processing

npm version Docker Pulls License

Batch operations โ€ข Project root safety โ€ข Token optimized โ€ข Zod validation

Quick Start โ€ข Installation โ€ข Tools

Filesystem MCP Server

๐Ÿš€ 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.


โšก Performance Advantages

Token & Latency Optimization

MetricIndividual Shell CommandsFilesystem MCPImprovement
Operations/Request1 file10+ files10x reduction
Round TripsN operations1 requestNร— fewer
LatencyShell spawn per opDirect API5-10ร— faster
Token UsageHigh overheadBatched context50-70% less
Error Reportingstderr parsingPer-item statusDetailed

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 cwd at 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/bunx for 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": ["@sylphlab/filesystem-mcp"],
      "name": "Filesystem (npx)"
    }
  }
}

Using bunx:

{
  "mcpServers": {
    "filesystem-mcp": {
      "command": "bunx",
      "args": ["@sylphlab/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",
        "sylphlab/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 dev

MCP 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

ToolDescriptionBatch Support
read_contentRead file contentsโœ… Multiple files
write_contentWrite/append to filesโœ… Multiple files
edit_fileSurgical edits with diff outputโœ… Multiple files
search_filesRegex search with contextโœ… Multiple files
replace_contentMulti-file search & replaceโœ… Multiple files

Directory Operations

ToolDescriptionBatch Support
list_filesList files/directories recursivelySingle path
stat_itemsGet detailed file/directory statusโœ… Multiple items
create_directoriesCreate directories with parentsโœ… Multiple paths

Management Operations

ToolDescriptionBatch Support
delete_itemsRemove files/directoriesโœ… Multiple items
move_itemsMove/rename files/directoriesโœ… Multiple items
copy_itemsCopy files/directoriesโœ… Multiple items

Permission Operations

ToolDescriptionBatch Support
chmod_itemsChange POSIX permissionsโœ… Multiple items
chown_itemsChange ownershipโœ… Multiple items

Key Benefit: Tools supporting batch operations process each item individually and return detailed per-item status reports.


๐Ÿ’ก Design Philosophy

Core Principles

  1. Security First

    • All operations confined to project root
    • Path traversal prevention
    • Permission controls built-in
  2. Efficiency Focused

    • Batch processing reduces token usage
    • Direct API calls (no shell overhead)
    • Minimal communication round trips
  3. Robustness

    • Per-item success/failure reporting
    • Detailed error messages
    • Zod schema validation
  4. Simplicity

    • Clear, consistent API
    • MCP standard compliance
    • Easy integration

๐Ÿ“Š Comparison with Alternatives

FeatureFilesystem MCPShell CommandsOther 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

ComponentTechnology
LanguageTypeScript (strict mode)
RuntimeNode.js / Bun
ProtocolModel Context Protocol (MCP)
ValidationZod schemas
Package Managerpnpm
Distributionnpm + 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_files
  • Performance benchmarks
  • Compression/decompression tools
  • Symlink management

๐Ÿค Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch - git checkout -b feature/my-feature
  3. Write tests - Ensure good coverage
  4. Follow TypeScript strict mode - Type safety first
  5. Add documentation - Update README if needed
  6. 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

npm GitHub Issues

Show Your Support: โญ Star โ€ข ๐Ÿ‘€ Watch โ€ข ๐Ÿ› Report bugs โ€ข ๐Ÿ’ก Suggest features โ€ข ๐Ÿ”€ Contribute


๐Ÿ“„ License

MIT ยฉ Sylphx


๐Ÿ™ Credits

Built with:

Special thanks to the MCP community โค๏ธ


๐Ÿ“š Publishing

This repository uses GitHub Actions to automatically publish to:

Triggered on version tags (v*.*.*) pushed to main branch.

Required secrets: NPM_TOKEN, DOCKERHUB_USERNAME, DOCKERHUB_TOKEN


Secure. Efficient. Token-optimized.
The filesystem MCP server that saves tokens and keeps your projects safe

sylphx.com โ€ข @SylphxAI โ€ข hi@sylphx.com