MCP Filesystem Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Filesystem Server
A Model Context Protocol (MCP) server that provides secure file and directory operations for Claude Desktop.
Features
π List directory contents with detailed information
π Read text files safely (with size limits)
βοΈ Write content to files
ποΈ Create directories
ποΈ Delete files and directories
π Get detailed file/directory information
π Built-in security with path restrictions
Related MCP server: Python MCP Custom Server
Security Features
β Path Restrictions: Only allows access to safe, predefined directories
β File Size Limits: Won't read files larger than 1MB to prevent memory issues
β Permission Handling: Gracefully handles permission denied errors
β Path Validation: Prevents directory traversal attacks
β Safe Operations: All file operations are validated before execution
Tools Available
list_directory
List the contents of a directory with file sizes, types, and modification dates.
Parameters:
path(required): Directory path to list
Example: "List the contents of my Documents folder"
read_file
Read the contents of a text file (up to 1MB).
Parameters:
path(required): File path to read
Example: "Read the file at D:\Projects\README.md"
write_file
Write content to a file, creating directories if needed.
Parameters:
path(required): File path to write tocontent(required): Content to write
Example: "Write 'Hello World' to a file called hello.txt in my Documents"
create_directory
Create a new directory, including parent directories if needed.
Parameters:
path(required): Directory path to create
Example: "Create a new directory called 'projects' in my Documents"
delete_file
Delete a file or directory (with all contents).
Parameters:
path(required): Path to delete
Example: "Delete the old test.txt file in my Documents"
get_file_info
Get detailed information about a file or directory.
Parameters:
path(required): Path to get information about
Example: "Get information about my Downloads folder"
Prerequisites
Python 3.7+
Claude Desktop application
MCP Python package
Installation
Clone the repository:
git clone https://github.com/nandarizkika/mcp-filesystem-server.git cd mcp-filesystem-serverCreate a virtual environment:
python -m venv .venv .venv\Scripts\activate # On Windows # or source .venv/bin/activate # On macOS/LinuxInstall dependencies:
pip install -r requirements.txt
Configuration
Default Allowed Directories
The server restricts access to these safe directories by default:
User home directory and subdirectories
Documents, Desktop, Downloads folders
Custom project directories (configurable)
Custom Directory Configuration
You can modify the allowed directories in the MCPFilesystemServer constructor:
# Example: Add custom allowed directories
server = MCPFilesystemServer(allowed_directories=[
"C:\\Users\\YourName\\Documents",
"C:\\Users\\YourName\\Desktop",
"C:\\Users\\YourName\\Downloads",
"D:\\YourProjectFolder",
# Add more as needed
])Claude Desktop Setup
Locate your Claude Desktop config file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add the filesystem server configuration:
{ "mcpServers": { "filesystem": { "command": "path/to/your/project/.venv/Scripts/python.exe", "args": ["path/to/your/project/filesystem_server.py"] } } }Restart Claude Desktop
Testing
Test the server independently:
python test_filesystem.pyUsage Examples
Once configured with Claude Desktop, you can ask natural language questions:
Directory Operations
"List the contents of my Documents folder"
"Show me what's in my Downloads directory"
"What files are in my project folder?"
File Reading
"Read the file at D:\Projects\README.md"
"Show me the contents of my config.txt file"
"What's in my notes.txt file?"
File Writing
"Write 'Hello World' to a file called hello.txt in my Documents"
"Create a new file called notes.txt with my project ideas"
"Save my meeting notes to a file in my Desktop"
Directory Management
"Create a new directory called 'backup' in my Documents"
"Make a new folder called 'projects' in my home directory"
"Create a directory structure for my new project"
File Information
"Get information about my Downloads folder"
"Show me the size and details of my project directory"
"When was my README.md file last modified?"
File Cleanup
"Delete the old test.txt file in my Documents"
"Remove the temporary directory I created"
"Clean up the old backup files"
Project Structure
mcp-filesystem-server/
βββ filesystem_server.py # Main MCP server
βββ test_filesystem.py # Test script
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore rules
βββ LICENSE # MIT License
βββ README.md # This fileSecurity Considerations
Path Restrictions
Only predefined directories are accessible
No access to system directories (C:\Windows, /etc, etc.)
No access to other users' directories
Path traversal attempts are blocked
File Size Limits
Text files are limited to 1MB to prevent memory issues
Binary files are rejected for reading operations
Large directory listings are handled efficiently
Permission Handling
Permission denied errors are handled gracefully
No sensitive error information is exposed
Operations fail safely without crashing
Troubleshooting
Common Issues
"Access denied" errors:
Check if the path is in the allowed directories list
Verify you have proper permissions to the directory
Ensure the path exists and is accessible
"Server disconnected" in Claude:
Check that file paths in the config are correct
Ensure Python executable path is accurate
Restart Claude Desktop after config changes
"File too large" errors:
The server limits text files to 1MB for safety
Use external tools for larger files
Consider processing files in chunks
Debug Steps
Test the server independently:
python test_filesystem.pyCheck server logs in Claude Desktop
Verify file permissions on your system
Test with simple operations first
Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Projects
MCP Weather Server - Weather information MCP server
MCP Specification - Official MCP documentation
Acknowledgments
Anthropic for Claude and the MCP specification
MCP community for protocol documentation and examples
Contributors and users providing feedback and improvements
β οΈ Important: This server provides file system access. Always review and understand the security implications before use in production environments.
Made with β€οΈ for the MCP community
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Your own computer's files from ChatGPT or Claude: folder rules, confirmations and undo.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Manage files and folders directly from your workspace. Read and write files, list directories, creβ¦
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides secure file system operations for AI assistants including directory listing, file reading/writing, deletion, searching, and copying. Features safety controls like path validation, permission checks, and file size limits.-
- FlicenseNot gradedqualityNot gradedmaintenanceExtends Claude Desktop with custom tools for file management, system operations, and command execution. Supports creating/reading/deleting files, directory listing, system information retrieval, and file searching capabilities.-
- AlicenseNot gradedqualityDmaintenanceProvides Claude with complete file system integration including directory management, file operations, Office document creation/editing, and advanced file tree visualization.3MIT
- FlicenseBqualityDmaintenanceEnables local file reading and writing for your project via Claude Desktop, with tools to read, write, and list files in a specified root path.71-