Installation
Content Details
Alternatives
Installation
{
"mcpServers": {
"mcp-workspace": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-filesystem",
"run",
"run_server.py",
"/path/to/allowed/dir1",
"/path/to/allowed/dir2"
]
}
}
}๐ MCP Workspace Server
Achieve full Agent capabilities with just one MCP!
The MCP Workspace Server is an AI development environment that goes beyond the traditional file system. It enables comprehensive web development, data processing, and code execution, similar to what Claude Code can do.
๐ก Core Value: Instead of integrating multiple MCP tools, a single MCP server provides complete Agent capabilities, including file operations, code execution, web deployment, data processing, and image generation. It's an out-of-the-box, one-stop solution.
This powerful MCP (Model Context Protocol) server not only offers secure file system operations but also serves as a complete AI development workspace. It supports enterprise-level capabilities such as code execution, one-click web application deployment, wildcard domain access, Excel processing, and image generation.
๐ Quick Start
Docker Deployment (Recommended)
# Clone the project
git clone <repository-url>
cd mcp-filesystem
# First deployment: Build the image and start the container
docker-compose up -d --build
> If you can't use the Docker image source, run export DOCKER_BUILDKIT=0 first.
# Restart after code updates
git pull && docker-compose restart
# View logs
docker-compose logs -f
# Rebuild only when dependencies change
docker-compose up -d --build
๐ก The image includes the runtime environment, and the code is mounted via volume. You can update the code with
git pull && docker-compose restart.
โ ๏ธ Important Note: This project highly depends on the Docker base image, which includes a complete Python 3.12, Node.js 20 runtime environment, and all system dependencies (e.g., Tesseract OCR, image processing libraries). We strongly recommend using Docker for deployment. Running directly with local Python is not recommended. If you need local development, make sure all system dependencies are installed.
Quick Configuration Reference
๐ Detailed Integration Guide: Refer to the ๐ Integration with AI Platforms section above for complete configuration steps for Dify, FastGPT, and Cherry Studio.
Quick Connection Information:
- SSE Address:
http://your-server:8000/sse - Request Headers (for multi-tenant isolation):
X-User-ID:{{userId}}or a fixed user IDX-Chat-ID:{{chatId}}or a fixed session ID
Claude Desktop (STDIO Mode):
Edit the configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-workspace": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-filesystem",
"run",
"run_server.py",
"/path/to/allowed/dir1",
"/path/to/allowed/dir2"
]
}
}
}
โจ Features
๐ฏ One MCP, Full Agent Capabilities
Traditional Approach: Multiple MCP tools need to be integrated to achieve full functionality.
- โ File operations โ One MCP required
- โ Code execution โ Another MCP required
- โ Web deployment โ A third MCP required
- โ Data processing โ A fourth MCP required
- โ Image generation โ A fifth MCP required
- Result: Complex configuration, difficult maintenance, and scattered functionality.
Our Approach: One MCP provides all capabilities out of the box.
- โ File operations + Code execution + Web deployment + Data processing + Image generation
- โ Unified Configuration: Configure once, enable all.
- โ Unified Management: One service, centralized management.
- โ Unified Security: One security policy, comprehensive protection.
We offer a complete AI development workspace with capabilities far beyond traditional file system servers:
- ๐ Web Development: AI can create complete web applications (HTML/CSS/JS) and deploy them to the production environment with one click.
- ๐ Wildcard Domain Deployment: Supports
*.your-domain.comwildcard domains. Each session automatically gets an independent subdomain for access. - ๐ป Code Execution: Built-in Python 3.12 and Node.js 20 sandbox environments support real-time code execution and debugging.
- ๐ Data Processing: Full Excel/CSV processing capabilities, supporting templates, formulas, and formatting.
- ๐จ Image Generation: Supports various image generation methods such as Mermaid flowcharts, data charts, and HTML rendering.
- ๐ Intelligent Search: Advanced capabilities such as file content search, knowledge base retrieval, and web page scraping.
- ๐ Enterprise-Level Security: Multi-tenant isolation, path security protection, resource limits, and sandbox execution.
๐ All-in-One Advantages
| Traditional Approach | Our Approach |
|---|---|
| Requires 5+ MCP tools | Only 1 MCP needed |
| Complex configuration, requires individual integration | Out-of-the-box, one-click configuration |
| Scattered functionality, difficult to manage uniformly | Centralized functionality, unified management |
| Inconsistent security policies | Unified security policy |
| High maintenance cost | Easy to maintain |
In a nutshell: One MCP server = A complete Agent capability stack ๐
๐ก Typical Use Cases
Case 1: AI-Driven Web Development
AI creates a complete front-end application โ One-click deployment โ Get an independent domain for access
Example: https://user123_chat456.your-domain.com
Case 2: Data Analysis and Visualization
Read Excel โ Data processing โ Generate charts โ Create reports โ Deploy a presentation page
Case 3: Code Development and Testing
Write a Python script โ Execute tests โ Fix bugs โ Deploy an API service
๐ Multi-Tenant Session Isolation
Each user/session has an independent virtual workspace, completely isolated from others.
Working Directory Naming Rules:
| X-User-ID | X-Chat-ID | Working Directory |
|---|---|---|
user123 |
chat456 |
user_data/user123_chat456/ |
user123 |
(Empty) | user_data/user123/ |
| (Empty) | chat456 |
user_data/chat456/ |
| (Empty) | (Empty) | Use the default global mode |
Pass the identity information through HTTP request headers:
X-User-ID: Unique user identifier (optional)X-Chat-ID: Unique session identifier (optional)
๐ก๏ธ Virtual Path System
Completely Virtual from the LLM Perspective: The AI model sees a clean virtual file system with / as the root directory.
LLM-Visible Path Actual Physical Path
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/ โ /server/user_data/user123_chat456/
/todo.txt โ /server/user_data/user123_chat456/todo.txt
/docs/readme.md โ /server/user_data/user123_chat456/docs/readme.md
Advantages:
- โ Does not expose the real directory structure of the server.
- โ The AI platform cannot obtain physical path information.
- โ Simplifies file operation instructions for AI.
- โ Improves security and privacy protection.
๐ Path Security Protection
Built-in multi-layer security mechanisms prevent path traversal attacks:
Attack Attempt Result
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
/../../../etc/passwd โ Blocked
../../../etc/passwd โ Blocked
/foo/../../../etc/passwd โ Blocked
/foo/bar/../../.. โ Blocked
Security Mechanisms:
- Path Resolution: Use
Path.resolve()to resolve all..and symbolic links. - Boundary Check: Verify that the resolved path is within the allowed range.
- Double Protection: Even if the path is resolved, it must still be within
allowed_dirs.
๐ก SSE Transmission Protocol
Supports Server-Sent Events (SSE) transmission, compatible with various AI platforms:
Client Server
โ โ
โโโโโ GET /sse โโโโโโโโโโโโโโโโโโโโโโโถโ Establish an SSE connection
โโโโโ SSE: endpoint=/messages?sid=xxx โ Return the message endpoint
โ โ
โโโโโ POST /messages?session_id=xxx โโถโ Send a tool call
โโโโโ SSE: message (Response) โโโโโโโโ Receive the result
๐ One-Click Deployment and Wildcard Domain Support
One-Click Deployment of Web Applications:
- Front-end projects created by AI can be deployed with one click using the
preview_frontendtool. - Automatically generate an accessible URL, supporting HTTPS.
- Supports custom entry files and directory structures.
Wildcard Domain Deployment (Production Environment):
{
"preview": {
"wildcard_domain": "*.proxy.your-domain.com",
"use_tls": true
}
}
After configuration, each session automatically gets an independent subdomain:
user123_chat456.proxy.your-domain.comuser789_chat012.proxy.your-domain.com
Advantages:
- โ No need to manually configure domains and ports.
- โ Automatic isolation, no interference.
- โ Supports HTTPS, ready for production.
- โ Single-port service, simplifies deployment.
๐ฆ Installation
Docker Deployment (Recommended)
# Clone the project
git clone <repository-url>
cd mcp-filesystem
# First deployment: Build the image and start the container
docker-compose up -d --build
> If you can't use the Docker image source, run export DOCKER_BUILDKIT=0 first.
# Restart after code updates
git pull && docker-compose restart
# View logs
docker-compose logs -f
# Rebuild only when dependencies change
docker-compose up -d --build
๐ป Usage Examples
๐ Complete Web Development Process
Step 1: Create a Front-End Project
Tool: fs_write
Arguments: {
"path": "/index.html",
"content": "<!DOCTYPE html>..."
}
Step 2: One-Click Deployment
Tool: preview_frontend
Arguments: {
"entry_file": "index.html"
}
Return Result:
{
"success": true,
"url": "https://user123_chat456.proxy.your-domain.com/index.html",
"subdomain": "user123_chat456"
}
Step 3: Access the Deployed Application
- Automatically get an independent subdomain.
- Supports HTTPS (if configured).
- No need to manually configure ports and domains.
๐ป Code Execution and Debugging
Read a File (Supporting Line Range)
Tool: fs_read
Arguments: {
"path": "/file.txt",
"line_range": "100:150" # Read lines 100-150
}
Read Multiple Files in Bulk
Tool: fs_read
Arguments: {
"path": ["/file1.txt", "/file2.json", "/data.xlsx"]
}
Search for Files
Tool: fs_search
Arguments: {
"search_type": "content", # glob=By file name, content=By content
"pattern": "function\\s+\\w+\\(",
"context_lines": 2 # Return 2 lines of context before and after the matching line
}
Precise File Editing
Tool: fs_replace
Arguments: {
"path": "/config.py",
"diff": "------- SEARCH\nDEBUG = True\n========\nDEBUG = False\n+++++++ REPLACE"
}
Execute Python Code
Tool: exec
Arguments: {
"code": "print('Hello, World!')"
}
Execute a Python File
Tool: exec
Arguments: {
"file": "/script.py",
"args": ["--verbose", "input.txt"]
}
Read an Excel File
Tool: fs_read
Arguments: {
"path": "/data.xlsx",
"sheet": "Sheet1", # Optional, specify the worksheet
"range": "A1:D100" # Optional, specify the reading range
}
Create an Excel File
Tool: fs_write
Arguments: {
"path": "/output.xlsx",
"content": [
["Name", "Age", "City"],
["Alice", 30, "Beijing"],
["Bob", 25, "Shanghai"]
]
}
Edit an Excel File
Tool: excel_edit
Arguments: {
"path": "/data.xlsx",
"edit_type": "cells",
"sheet": "Sheet1",
"updates": [
{"cell": "A1", "value": "Updated Value"}
]
}
๐จ Generate Charts and Flowcharts
Tool: generate_image
Arguments: {
"mermaid_code": "flowchart TD\nA[Start] --> B[Process] --> C[End]"
}
Or use HTML to render complex charts:
Tool: generate_image
Arguments: {
"html_code": "<html><body><h1>Data Visualization</h1>...</body></html>"
}
๐ Documentation
๐ป Web Development and Deployment
| Tool | Function | Highlights |
|---|---|---|
fs_write |
Create web files (HTML/CSS/JS) | Automatically recognize the format, support complete front-end projects |
preview_frontend |
One-click deployment of static front-ends | Supports wildcard domains, automatically generate independent subdomains |
exec |
Execute Python/Node.js code | Sandbox environment, supports real-time debugging |
generate_image |
Generate charts and flowcharts | Mermaid, data visualization, HTML rendering |
๐ File System Operations
| Tool | Function |
|---|---|
fs_read |
Read files (supporting bulk, Excel, line range) |
fs_write |
Create/overwrite files (automatically recognize the format) |
fs_ops |
File system operations (list/mkdir/move/info/delete) |
fs_replace |
Precise file editing based on SEARCH/REPLACE |
fs_search |
Search for files (glob=By file name, content=By content regex) |
๐ Excel Data Processing
| Tool | Function |
|---|---|
fs_read |
Read Excel files (supporting sheet and range parameters) |
fs_write |
Create/overwrite Excel files (automatically recognize the format) |
excel_edit |
Edit Excel (bulk update cells, formatting) |
list_excel_templates |
List available Excel templates |
create_excel_from_template |
Create an Excel file from a template |
๐ Advanced Capabilities (Optional)
| Tool | Function | Configuration Item |
|---|---|---|
kb_search |
Enterprise knowledge base glob search | kb.enabled=true |
kb_read |
Read knowledge base files (return Markdown) | kb.enabled=true |
crawl_url |
Scrape web pages and return Markdown | web_crawl.enabled=true |
web_search |
Internet search | web_search.enabled=true |
๐ Integration with AI Platforms
๐ฏ Why Choose Our MCP Server?
We are a powerful All-in-One MCP Server. With just one configuration, we can provide your AI platform with complete Agent capabilities:
- โ File Operations: Read, write, search, and edit files.
- โ Code Execution: Python/Node.js sandbox environment.
- โ Web Deployment: One-click deployment of front-end applications, supports wildcard domains.
- โ Data Processing: Full Excel/CSV processing capabilities.
- โ Image Generation: Mermaid flowcharts, data charts.
- โ Intelligent Search: Knowledge base retrieval, web page scraping (optional).
No need to integrate multiple MCP tools. One MCP Server meets all your needs!
๐ Supported AI Platforms
We integrate perfectly with mainstream AI platforms, with simple configuration and out-of-the-box functionality:
Dify
-
Enter the Dify workflow configuration
- Add an MCP Tool node.
- Select the SSE transmission protocol.
-
Configure the MCP Server connection
SSE Address: http://your-server:8000/sse -
Set the request headers (for multi-tenant isolation)
X-User-ID: {{user_id}} X-Chat-ID: {{conversation_id}} -
Done! Now your Dify Agent has complete file operation, code execution, web deployment, and other capabilities.
FastGPT
-
Enter the FastGPT knowledge base/application configuration
- Add an External Tool โ MCP.
- Select SSE as the transmission method.
-
Configure the connection information
MCP Server URL: http://your-server:8000/sse -
Configure the user identifier (optional, for multi-tenant isolation)
Custom Headers: X-User-ID: {{userId}} X-Chat-ID: {{chatId}} -
Enable the tools: All tools are automatically available, no need to configure them individually!
Cherry Studio
-
Enter the Cherry Studio settings
- Open the MCP Servers configuration.
- Add a new MCP Server.
-
Configure the connection
{ "name": "MCP Workspace Server", "transport": "sse", "url": "http://your-server:8000/sse" } -
Set the session identifier (for multi-tenant support)
- Cherry Studio will automatically pass the user and session information.
- Each session gets an independent workspace.
๐ก Integration Advantages
| Traditional Approach | Using Our All-in-One MCP |
|---|---|
| Need to configure 5+ different MCP tools | Only need to configure 1 MCP Server |
| Each tool needs separate connection and authentication | One configuration, all enabled |
| Scattered functionality among tools, difficult to manage uniformly | Centralized functionality, unified management |
| Inconsistent security policies for different tools | Unified security policy, comprehensive protection |
| High cost of maintaining multiple services | Easy to maintain, one service does it all |
๐ Out-of-the-Box Capabilities
After configuration, your AI Agent immediately has:
- ๐ File Operations: Create, read, edit, and search files.
- ๐ป Code Execution: Run Python/Node.js scripts, real-time debugging.
- ๐ Web Development: Create front-end applications and deploy them to the production environment with one click.
- ๐ Data Processing: Read, edit Excel, generate reports.
- ๐จ Image Generation: Create flowcharts, data visualization charts.
- ๐ Intelligent Search: File content search, knowledge base retrieval (if enabled).
One MCP Server = A complete Agent capability stack ๐
๐๏ธ Architecture Design
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Platform (Dify / FastGPT / Cherry Studio) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ SSE + HTTP POST
โ Headers: X-User-ID, X-Chat-ID
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Workspace Server (All-in-One) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Session Management & Identity Recognition โ โ
โ โ (user_id + chat_id โ workspace_name) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Virtual Path Conversion Layer โ โ
โ โ /todo.txt โ /user_data/xxx/todo.txt โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Path Security Verification โ โ
โ โ PathValidator + Path Traversal Protection โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ File Operation Execution โ โ
โ โ FileOperations / AdvancedFileOperations โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Physical File System โ
โ user_data/ โ
โ โโโ user1_chat1/ โ
โ โ โโโ todo.txt โ
โ โ โโโ docs/ โ
โ โโโ user1_chat2/ โ
โ โโโ user2_chat1/ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง Technical Details
๐ Authentication Configuration
The Admin API requires Bearer Token authentication. First, configure config.json:
# Copy the example configuration file
cp config.example.json config.json
# Edit the configuration and set your admin key
vim config.json
{
"admin_token": "your-secret-admin-token-here"
}
All Admin API requests must carry the Authorization header:
curl -H "Authorization: Bearer your-secret-admin-token-here" \
http://localhost:8000/admin/stats
โ ๏ธ Security Tip:
config.jsonhas been added to.gitignore. Do not commit it to the repository.
Get Server Statistics
GET /admin/stats
Authorization: Bearer <admin_token>
Response Example:
{
"success": true,
"user_data_dir": "/path/to/user_data",
"total_workspaces": 15,
"unique_users": 8,
"total_size_bytes": 1048576,
"total_size_human": "1.00 MB",
"active_sessions": 3
}
List All Workspaces
GET /admin/workspaces
GET /admin/workspaces?user_id=user123
Authorization: Bearer <admin_token>
Get Workspace Details
GET /admin/workspace/{workspace_id}
GET /admin/workspace/{workspace_id}/tree?max_depth=5
Authorization: Bearer <admin_token>
Delete a Workspace
DELETE /admin/workspace/{workspace_id}?confirm=yes
Authorization: Bearer <admin_token>
โ ๏ธ Warning: This operation is irreversible! You must add the ?confirm=yes parameter to execute the deletion.
๐ค User Workspace API
Provides a workspace directory tree query for users without the need for an admin token.
GET /api/workspace/tree?user_id={user_id}&chat_id={chat_id}&max_depth=5
- No
Authorizationheader is required. - Only returns the workspace corresponding to the
user_id + chat_idcombination. - Each directory level is sorted by the last modification time, and only the top 20 files/folders are retained. The rest are filtered directly to save bandwidth.
๐งฉ Excel Configuration
- Add an
excelsection toconfig.json/config.example.jsonto set the maximum file size, default number of rows to read, supported formats, and formula detection switch. - Template:
excel.templates_filepoints toexcel_templates/templates.jsonby default. The template source files are placed inexcel_templates/. Onlytitle/descare exposed externally.create_excel_from_templatewill automatically avoid duplicate names. When using it for the first time, copytemplates_example.jsonto createtemplates.jsonand configure the template paths according to your actual situation. - Environment variable override:
MCP_EXCEL_MAX_ROWS,MCP_EXCEL_MAX_SIZE_MB. - See
docs/EXCEL_TOOLS.mdfor detailed parameters and examples.
โ๏ธ Startup Configuration
- Add an
mcpsection toconfig.jsonto configuretransport(defaultsse),host(default0.0.0.0), andport(default18089). - CLI parameters
--transport/--host/--porthave higher priority than the configuration file. - Web management interface: Add an
admin_websection toconfig.json(enabledisfalseby default,passwordis123456by default). After enabling, accesshttp://<host>:<port>/admin, enter the password to view the file tree underuser_dataand preview text/Markdown/CSV.
๐ Security Best Practices
-
Production Environment Deployment
- Use a reverse proxy (Nginx) to handle HTTPS.
- Limit access IPs or use API key authentication.
- Set reasonable request rate limits.
-
Data Isolation
- Ensure that
X-User-IDandX-Chat-IDare generated from trusted sources. - Regularly clean up expired session work directories.
- Ensure that
-
Admin API Protection
location /admin/ { allow 10.0.0.0/8; deny all; proxy_pass http://localhost:8000; }
โ๏ธ Environment Variables
| Variable Name | Description | Default Value |
|---|---|---|
MCP_WORKSPACES_DIR |
Root directory of user workspaces | Project Directory/user_data |
MCP_ALLOWED_DIRS |
List of allowed directories (global mode) | Current working directory |
FASTMCP_PORT |
Server port | 8000 |
๐ License
Apache License 2.0
๐ค Contribution
Welcome to submit Issues and Pull Requests!
Alternatives








