A simple Model Context Protocol (MCP) server providing file system operations. This server offers a clean API for performing file system operations within a specified project directory, following the MCP protocol design.
This MCP server enables AI assistants like Claude (via Claude Desktop) or other MCP-compatible systems to interact with your local file system. With these capabilities, AI assistants can:
All operations are securely contained within your specified project directory, giving you control while enabling powerful AI collaboration on your local files.
By connecting your AI assistant to your filesystem, you can transform your workflow from manual coding to a more intuitive prompting approach - describe what you need in natural language and let the AI generate, modify, and organize code directly in your project files.
list_directory
: List all files and directories in the project directoryread_file
: Read the contents of a filesave_file
: Write content to a file atomicallyappend_file
: Append content to the end of a filedelete_this_file
: Delete a specified file from the filesystemedit_file
: Make selective edits using advanced pattern matchingStructured Logging
: Comprehensive logging system with both human-readable and JSON formats# Clone the repository
git clone https://github.com/MarcusJellinghaus/mcp_server_filesystem.git
cd mcp-server-filesystem
# Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies using pip with pyproject.toml
pip install -e .
python -m src.main --project-dir /path/to/project [--log-level LEVEL] [--log-file PATH]
Alternatively, you can add the current directory to your PYTHONPATH and run the script directly:
set PYTHONPATH=%PYTHONPATH%;.
python .\src\main.py --project-dir /path/to/project [--log-level LEVEL] [--log-file PATH]
--project-dir
: (Required) Directory to serve files from--log-level
: (Optional) Set logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)--log-file
: (Optional) Path for structured JSON logs. If not specified, only console logging is used.The server uses FastMCP for operation. The project directory parameter (--project-dir
) is required for security reasons. All file operations will be restricted to this directory. Attempts to access files outside this directory will result in an error.
The server provides flexible logging options:
--log-file
This server can be integrated with different Claude interfaces. Each requires a specific configuration.
The Cline extension for VSCode allows you to use Claude directly in your code editor. For more information about configuring MCP servers with Cline, see the Cline MCP Servers documentation.
Locate the Cline MCP configuration file:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Add the MCP server configuration (create the file if it doesn't exist):
{
"mcpServers": {
"filesystem": {
"command": "C:\\path\\to\\mcp_server_filesystem\\.venv\\Scripts\\python.exe",
"args": [
"C:\\path\\to\\mcp_server_filesystem\\src\\main.py",
"--project-dir",
"C:\\Users\\YourUsername\\Documents\\Projects\\MyProject",
"--log-level",
"INFO"
],
"env": {
"PYTHONPATH": "C:\\path\\to\\mcp_server_filesystem\\"
},
"disabled": false,
"autoApprove": [
"list_directory",
"read_file"
]
}
}
}
Important VSCode/Cline-specific notes:
${workspaceFolder}
with the actual full path to your project directory"C:\\Users\\YourUsername\\Documents\\Projects\\MyProject"
C:\\path\\to\\
instances with your actual paths\\
) in paths on Windows, forward slashes (/
) on macOS/LinuxautoApprove
array that you want to be executed without requiring your approval each timelist_directory
and read_file
Restart VSCode and test by asking Claude to "List the files in my current project directory"
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\logs
(Windows) or ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/logs
(macOS)The Claude Desktop app can also use this file system server.
Locate the Claude Desktop configuration file:
%APPDATA%\Claude\claude_desktop_config.json
~/Library/Application Support/Claude/claude_desktop_config.json
Add the MCP server configuration (create the file if it doesn't exist):
{
"mcpServers": {
"filesystem": {
"command": "C:\\path\\to\\mcp_server_filesystem\\.venv\\Scripts\\python.exe",
"args": [
"C:\\path\\to\\mcp_server_filesystem\\src\\main.py",
"--project-dir",
"C:\\path\\to\\your\\specific\\project",
"--log-level",
"INFO"
],
"env": {
"PYTHONPATH": "C:\\path\\to\\mcp_server_filesystem\\"
},
"disabled": false,
"autoApprove": [
"list_directory",
"read_file"
]
}
}
}
Important Claude Desktop-specific notes:
--project-dir
C:\\path\\to\\
instances with your actual pathsautoApprove
array that you want to be executed without requiring your approval each timelist_directory
and read_file
Restart the Claude Desktop app to apply changes
%APPDATA%\Claude\logs
(Windows) or ~/Library/Application Support/Claude/logs
(macOS)MCP Inspector allows you to debug and test your MCP server:
npx @modelcontextprotocol/inspector \
uv \
--directory C:\path\to\mcp_server_filesystem \
run \
src\main.py
In the MCP Inspector web UI, configure with the following:
C:\path\to\mcp_server_filesystem\.venv\Scripts\python.exe
C:\path\to\mcp_server_filesystem\src\main.py --project-dir C:\path\to\your\project --log-level DEBUG
PYTHONPATH
C:\path\to\mcp_server_filesystem\
This will launch the server and provide a debug interface for testing the available tools.
The server exposes the following MCP tools:
Operation | Description | Example Prompt |
---|---|---|
list_directory | Lists files and directories in the project directory | "List all files in the src directory" |
read_file | Reads the contents of a file | "Show me the contents of main.js" |
save_file | Creates or overwrites files atomically | "Create a new file called app.js" |
append_file | Adds content to existing files | "Add a function to utils.js" |
delete_this_file | Removes files from the filesystem | "Delete the temporary.txt file" |
edit_file | Makes selective edits using pattern matching | "Fix the bug in the fetch function" |
file_path
(string): Path to the file to read (relative to project directory)file_path
(string): Path to the file to write tocontent
(string): Content to write to the filefile_path
(string): Path to the file to append tocontent
(string): Content to append to the filesave_file
to create new filesfile_path
(string): Path to the file to deletefile_path
(string): File to editedits
(array): List of edit operations, each containing:
old_text
(string): Text to be replacednew_text
(string): Replacement textdry_run
(boolean, optional): Preview changes without applyingoptions
(object, optional): Formatting settingsREM Clone the repository
git clone https://github.com/MarcusJellinghaus/mcp_server_filesystem.git
cd mcp-server-filesystem
REM Create and activate a virtual environment
python -m venv .venv
.venv\Scripts\activate
REM Install dependencies
pip install -e .
REM Install development dependencies
pip install -e ".[dev]"
The project includes pytest-based unit tests in the tests/
directory. See tests/README.md for details on test structure and execution.
For LLM-based testing, see tests/LLM_Test.md. This file contains test instructions that can be directly pasted to an LLM to verify MCP server functionality.
# Set the PYTHONPATH and run the server module using mcp dev
set PYTHONPATH=. && mcp dev src/server.py
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is a permissive license that allows reuse with minimal restrictions. It permits use, copying, modification, and distribution with proper attribution.
Seamless access to top MCP servers powering the future of AI integration.