mcp_server_filesystem
MCP File System Server: A secure Model Context Protocol server that provides file operations for AI assistants. Enables Claude and other assistants to safely read, write, and list files in a designated project directory with robust path validation and security controls.
claude mcp add --transport stdio marcusjellinghaus-mcp_server_filesystem mcp-server-filesystem --project-dir /path/to/your/project \ --env LOG_DIR="Path to logs directory (optional). If not set, defaults to project_dir/logs." \ --env LOG_FORMAT="Format for structured logs (optional)."
How to use
This MCP server provides a clean API for interacting with a local file system within a specified project directory. It exposes operations such as listing directories, reading files, saving or appending content atomically, deleting files, and performing precise edits or moves. It also supports repository-style reference browsing via read-only access to reference projects, enabling an AI assistant to analyze code and project structure without modifying the main workspace. Use the available capabilities to read codebases, generate new files, modify existing content with exact string matches, and perform guided refactors or debugging tasks. When integrated with an MCP client, you can describe the desired file system changes in natural language and the server will execute them inside the restricted project directory, maintaining security and isolation.
How to install
Prerequisites:
- Python 3.8+ installed on your system
- Git installed
- Optional: virtual environment tool (venv) available
Installation steps:
- Clone the repository:
git clone https://github.com/MarcusJellinghaus/mcp_server_filesystem.git
cd mcp_server_filesystem
- Create and activate a virtual environment (recommended):
python -m venv venv
# macOS/Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
- Install dependencies in editable mode (via pyproject.toml):
pip install -e .
- Start the server (example):
mcp-server-filesystem --project-dir /path/to/your/project
Note: The server requires that you specify a project directory with --project-dir for security. You can also add optional reference projects at runtime with --reference-project NAME=PATH and adjust logging with --log-level and --log-file if needed.
Additional notes
Tips and caveats:
- Security: All file operations are restricted to the provided --project-dir. Attempts to escape this directory will be blocked.
- Reference projects: Use --reference-project to provide read-only context from additional directories. Duplicates are auto-renamed (docs, docs_2, docs_3, ...).
- Logging: Structured JSON logs are written to project_dir/logs by default. Use --log-file to override the path. You can enable console-only mode if you do not want file logs.
- Reference discovery: The server supports auto-discovery of reference projects and validates paths on startup.
- CLI usage: The canonical command to run is mcp-server-filesystem with the required --project-dir argument. Other options (like --reference-project and --log-level) are documented in the README.
- Claude Desktop integration: If you integrate with Claude Desktop, ensure the CLI is in PATH and that explicit project paths are provided in the configuration.
- Environment variables: You can customize logging behavior via environment variables (e.g., LOG_DIR, LOG_FORMAT) if supported by your deployment environment.
Related MCP Servers
mcp -tree-sitter
MCP Server for Tree-sitter
Gitingest
mcp server for gitingest
caltrain
A Model Context Protocol (MCP) server for Caltrain schedules. Get real-time train departures using GTFS data, designed for Claude Desktop and other MCP clients.
microsoft
A Microsoft Graph API integration MCP server that provides AI assistants with comprehensive access to Microsoft 365 services through the Model Context Protocol (MCP). It enables natural language automation of email, calendar, file management, and contact operations across multiple Microsoft accounts.
cc-session-search
MCP server for searching and analyzing Claude Code conversation history
aws
MCP (Model context protocol) server to connect MCP client such as Claude Desktop.