tulasi-das/MCP-FileSytem-Server
If you are the rightful owner of MCP-FileSytem-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The MCP File System Server is a secure server that provides file system operations using the Model Context Protocol.
MCP File System Server
A Model Context Protocol (MCP) server that provides secure file system operations.
Features
- ✅ Read files
- ✅ Write/create files
- ✅ Delete files
- ✅ List directory contents
- ✅ Create directories
- ✅ Delete directories
- ✅ Move/rename files and directories
- ✅ Get file/directory information
- 🔒 Path traversal protection
Installation
- Clone the repository
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Usage
Run the server:
python src/server.py
The server will create a workspace directory at ~/mcp_workspace where all file operations are scoped.
Configuration
To change the base directory, modify the BASE_DIR variable in src/server.py:
BASE_DIR = Path.home() / "mcp_workspace" # Change this path
Available Tools
read_file
Read contents of a file.
- Parameters:
path(string)
write_file
Write content to a file (creates or overwrites).
- Parameters:
path(string),content(string)
delete_file
Delete a file.
- Parameters:
path(string)
list_directory
List contents of a directory.
- Parameters:
path(string, optional)
create_directory
Create a new directory.
- Parameters:
path(string)
delete_directory
Delete a directory and its contents.
- Parameters:
path(string)
move_item
Move or rename a file or directory.
- Parameters:
source(string),destination(string)
get_file_info
Get information about a file or directory.
- Parameters:
path(string)
Security
All file operations are restricted to the configured base directory to prevent directory traversal attacks.
Testing
Run tests:
pytest tests/
License
MIT