Filesystem MCP Server
Provides file system access and operations, enabling AI assistants to read, write, list, search, and manage files and directories through a standardized interface.
README
Filesystem MCP Server
A Model Context Protocol (MCP) server that provides comprehensive file system access and operations. This server allows AI assistants to interact with your file system through a standardized interface.
Features
Resources (Read-only access)
- file://{path} - Read file contents
- directory://{path} - List directory contents with metadata
Tools (File Operations)
- read_file_tool - Read file contents with encoding support
- write_file_tool - Create or overwrite files
- list_directory_tool - List directory contents (recursive option)
- create_directory_tool - Create directories with parent creation
- delete_file_tool - Delete files
- delete_directory_tool - Delete directories (recursive option)
- move_file_tool - Move or rename files/directories
- copy_file_tool - Copy files or directories
- search_files_tool - Search for files by pattern (supports wildcards)
- get_file_info_tool - Get detailed file/directory metadata
Prompts
- analyze_directory_prompt - Template for directory analysis
- find_and_read_prompt - Template for finding and reading files
Security
By default, the server restricts access to your home directory. You can modify the ALLOWED_PATHS list in server.py to change this.
ALLOWED_PATHS = [str(Path.home())] # Modify this to add more paths
- Access is limited to a configured root directory
- No access to system paths
- User must explicitly grant permissions
Server Versions
server.py - Pure MCP SDK implementation (currently active)
- Uses
mcp.server.Serverdirectly - Better compatibility with Claude Desktop
- Lower-level control
Using with Claude Desktop
To use this server with Claude Desktop, add it to your Claude configuration file.
-
Open your Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Windows:
-
Add the server configuration:
{
"mcpServers": {
"filesystem": {
"command": "python",
"args": ["C:\\Users\\<username>\\filesystem-mcp-server\\server.py"]
}
}
}
- Restart Claude Desktop
Using with MCP Inspector
You can test and debug your server with the MCP Inspector:
npx @modelcontextprotocol/inspector python server.py
Example Usage
Once connected to an MCP client (like Claude Desktop), you can:
List files in a directory
Can you list the files in my Documents folder?
Read a file
Read the contents of C:\Users\<username>\test.txt
Search for files
Find all Python files in my projects directory
Create and write to a file
Create a new file called notes.txt with the content "Hello World"
Get file information
Get detailed information about myfile.pdf
Project Structure
filesystem-mcp-server/
└── src/
├── __init__.py
├── config.py ← ALLOWED_PATHS + is_path_allowed()
├── tools.py ← all 10 tool implementations
├── tool_schemas.py ← the Tool(...) schema definitions for list_tools()
├── resources.py ← list_resources() + read_resource()
└── prompts.py ← list_prompts() + get_prompt()
├── server.py # Main MCP server implementation
├── requirements.txt # Python dependencies
├── test_server # Test file
└── README.md # This file
Extending the Server
You can easily add more tools by following the existing patterns:
@mcp.tool()
def your_custom_tool(param: str) -> dict:
"""Description of your tool"""
# Your implementation
return {"result": "success"}
Troubleshooting
Permission Errors
If you get permission errors, check that the path is within ALLOWED_PATHS in server.py.
Server Not Responding
Check that the server is running with stdio transport and that your client is properly configured.
Requirements
- Python 3.8 or higher
- Windows (adaptable to Linux/macOS by changing path separators)
- MCP Python SDK 1.25 or higher
Resources
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。