MCP ToolKit
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP ToolKit list files in my working directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP ToolKit / MCP 工具集
基于 Model Context Protocol (MCP) 设计和实现的综合工具集,提供文件系统操作、命令执行、系统工具等多种功能,兼容 Windows、Linux 和 macOS。
A comprehensive MCP tools collection based on the Model Context Protocol (MCP), providing filesystem operations, command execution, system tools and more, compatible with Windows, Linux, and macOS.
项目简介 / Project Overview
MCP ToolKit 是一个功能丰富、安全可靠的 MCP 工具集合,旨在为 AI 模型提供强大的系统交互能力。项目采用模块化设计,支持灵活扩展,未来将持续集成更多实用工具。
MCP ToolKit is a feature-rich and secure MCP tools collection designed to provide powerful system interaction capabilities for AI models. The project adopts a modular design, supports flexible expansion, and will continue to integrate more practical tools in the future.
核心特性 / Core Features
🚀 多功能集成 - 文件系统、命令执行、系统工具等多种功能
🔒 安全可靠 - 沙箱隔离、黑名单机制、路径验证、频率限制等多重安全保障
⚡ 高性能 - Sonic JSON库、结构体预热等性能优化
🛡️ 稳定性强 - Panic Recovery机制、优雅关闭、并发安全保障
🔌 灵活传输 - 支持 Stdio、HTTP、SSE 多种传输方式
🌍 跨平台 - 完美支持 Windows、Linux、macOS
📦 模块化设计 - 易于扩展和维护
🔄 协议兼容 - 支持最新 MCP 协议版本,向后兼容旧版本
Related MCP server: FastMCP Multi-Tool Server
功能特性 / Features
文件操作 / File Operations
✅ 创建文件 / Create files
✅ 读取文件 / Read files
✅ 写入文件 / Write files
✅ 删除文件 / Delete files
✅ 复制文件 / Copy files
✅ 移动文件 / Move files
✅ 获取文件状态 / Get file status
✅ 检查文件是否存在 / Check file existence
目录操作 / Directory Operations
✅ 创建目录 / Create directories
✅ 列出目录内容 / List directory contents
✅ 删除目录 / Delete directories
✅ 复制目录 / Copy directories
✅ 移动目录 / Move directories
批量操作 / Batch Operations
✅ 批量删除 / Batch delete
✅ 文件搜索 / File search (支持通配符 / supports wildcards)
命令执行 / Command Execution
✅ 在沙箱内执行命令 / Execute commands within sandbox
✅ 工作目录管理 / Working directory management
✅ 命令黑名单保护 / Command blacklist protection
✅ 目录黑名单保护 / Directory blacklist protection
✅ 命令超时控制 / Command timeout control
✅ 输出捕获(stdout/stderr) / Output capture (stdout/stderr)
✅ 跨平台命令支持 / Cross-platform command support
✅ 异步命令执行 / Asynchronous command execution
✅ 命令执行历史记录 / Command execution history
✅ 权限级别控制 / Permission level control
✅ 环境变量配置 / Environment variable configuration
✅ 审计日志 / Audit logging
下载工具 / Download Tools
✅ HTTP/HTTPS 文件下载 / HTTP/HTTPS file download
✅ 支持 GET、POST 等多种 HTTP 方法 / Support GET, POST and other HTTP methods
✅ 自定义请求头和请求体 / Custom headers and request body
✅ 超时控制 / Timeout control
✅ 自动保存到沙箱 / Automatic save to sandbox
系统工具 / System Tools
✅ 获取当前系统时间 / Get current system time
✅ 获取系统信息 / Get system information (OS, CPU, Memory, GPU, Network)
安全特性 / Security Features
✅ 沙箱目录限制 / Sandbox directory restriction
✅ 路径遍历保护 / Path traversal protection
✅ 命令黑名单机制 / Command blacklist mechanism
✅ 命令参数路径验证 / Command argument path validation
✅ 系统目录保护 / System directory protection
✅ 危险命令拦截 / Dangerous command interception
稳定性保障 / Stability Assurance
✅ Panic Recovery 机制 / Panic recovery mechanism
工具层 panic 恢复 / Tool-level panic recovery
传输层 panic 恢复 / Transport-level panic recovery
完整的堆栈跟踪记录 / Complete stack trace logging
优雅的错误降级处理 / Graceful error degradation
✅ 多层防护确保服务稳定 / Multi-layer protection ensures service stability
✅ 单个工具异常不影响整体服务 / Individual tool exceptions don't affect overall service
性能优化 / Performance Optimization
✅ Sonic JSON库支持(高性能序列化/反序列化)
✅ 结构体预热机制(消除首次请求延迟)
✅ 多种JSON库可选(Sonic、go-json、jsoniter、标准库)
技术栈 / Tech Stack
语言 / Language: Go 1.25.5+
MCP SDK: github.com/modelcontextprotocol/go-sdk v1.2.0 (官方SDK / Official SDK)
JSON库 / JSON Library:
github.com/bytedance/sonic v1.14.2 (高性能 / High performance)
github.com/goccy/go-json v0.10.5 (备选 / Alternative)
github.com/json-iterator/go v1.1.12 (备选 / Alternative)
日志 / Logging: go.uber.org/zap v1.27.1
测试 / Testing: github.com/stretchr/testify v1.10.0
安装 / Installation
快速安装 / Quick Installation
使用 uv (推荐) / Using uv (Recommended)
# 安装 uv (如果还没有安装) / Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 使用 uv 安装 MCP Toolkit / Install MCP Toolkit using uv
uv tool install mcp-sandbox-toolkit
# 更新到最新版本 / Upgrade to the latest version
uv tool upgrade mcp-sandbox-toolkit
# 或使用 uvx 直接运行(无需安装)/ Or use uvx to run directly (no installation needed)
uvx mcp-sandbox-toolkit --help
# 或使用 uvx 运行最新版的工具 / Or use uvx to run the latest version of the tool
uvx --refresh mcp-sandbox-toolkit
# 运行程序(两个命令都可以)/ Run the program (both commands work)
mcp-sandbox-toolkit --help
mcp-toolkit --help配置 PATH (如果需要) / Configure PATH (if needed):
如果安装后无法直接运行 mcp-toolkit 命令,需要将 ~/.local/bin (Linux/macOS) 添加到 PATH:
# Bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Zsh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc详细的安装和配置说明请参考 INSTALLATION.md
使用安装脚本 / Using Installation Script
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/shibingli/mcp-toolkit/main/scripts/install.sh | bashWindows (PowerShell):
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/shibingli/mcp-toolkit/main/scripts/install.ps1" -OutFile "install.ps1"
.\install.ps1手动下载 / Manual Download
从 Releases 页面 下载对应平台的二进制文件。
Download the binary for your platform from the Releases page.
从源码编译 / Build from Source
# 克隆仓库 / Clone repository
git clone https://github.com/shibingli/mcp-toolkit.git
cd mcp-toolkit
# 安装依赖 / Install dependencies
go mod download
# 编译(使用sonic JSON库以获得最佳性能) / Build (using sonic JSON library for best performance)
go build -tags="sonic" -o mcp-toolkit main.go
# 或使用 Makefile / Or use Makefile
make build更多安装方式请参考 安装指南。
For more installation methods, see Installation Guide.
使用方法 / Usage
启动服务器 / Start Server
Stdio 传输 (默认) / Stdio Transport (Default)
# 使用默认沙箱目录和stdio传输 / Use default sandbox directory and stdio transport
./mcp-toolkit
# 指定自定义沙箱目录 / Specify custom sandbox directory
./mcp-toolkit -sandbox /path/to/sandboxHTTP 传输 / HTTP Transport
# 使用HTTP传输 / Use HTTP transport
./mcp-toolkit -transport http
# 自定义HTTP配置 / Customize HTTP configuration
./mcp-toolkit -transport http -http-host 0.0.0.0 -http-port 8080 -sandbox /path/to/sandboxStreamable HTTP 支持 / Streamable HTTP Support
HTTP 传输支持 MCP 规范的 Streamable HTTP 功能,包括会话管理和 SSE 流。
HTTP transport supports MCP specification's Streamable HTTP features, including session management and SSE streaming.
核心特性 / Core Features:
会话管理 / Session Management
自动生成加密安全的会话 ID
通过
Mcp-Session-Id头管理会话可配置的会话超时时间
支持会话终止
协议版本支持 / Protocol Version Support
支持
MCP-Protocol-Version头默认版本: 2025-12-26 (最新 / Latest)
兼容多个协议版本: 2025-12-26, 2025-06-18, 2025-03-26, 2024-11-05
向后兼容旧版本
SSE 流支持 / SSE Streaming Support
POST 请求支持 JSON 和 SSE 响应
GET 请求打开 SSE 流用于服务器推送
可配置的心跳间隔
自动连接保持
连接池管理和限制
自动清理过期连接
请求频率限制 / Rate Limiting
滑动窗口算法
每个客户端独立限制
可配置的请求数和时间窗口
防止滥用和 DDoS 攻击
优雅关闭 / Graceful Shutdown
等待正在处理的请求完成
清理所有会话和连接
资源正确释放
配置选项 / Configuration Options:
# 启用会话管理(默认启用) / Enable session management (enabled by default)
./mcp-toolkit -transport http -http-enable-session
# 禁用会话管理 / Disable session management
./mcp-toolkit -transport http -http-disable-session
# 设置会话超时(秒,默认1800秒/30分钟) / Set session timeout (seconds, default 1800s/30min)
./mcp-toolkit -transport http -http-session-timeout 1800
# 启用SSE流(默认启用) / Enable SSE streaming (enabled by default)
./mcp-toolkit -transport http -http-enable-sse
# 禁用SSE流 / Disable SSE streaming
./mcp-toolkit -transport http -http-disable-sse
# 设置SSE心跳间隔(秒) / Set SSE heartbeat interval (seconds)
./mcp-toolkit -transport http -http-sse-heartbeat 30
# 启用请求频率限制 / Enable rate limiting
./mcp-toolkit -transport http -http-enable-rate-limit
# 设置频率限制(100请求/60秒) / Set rate limit (100 requests/60 seconds)
./mcp-toolkit -transport http -http-rate-limit-requests 100 -http-rate-limit-window 60使用示例 / Usage Examples:
初始化会话 / Initialize Session:
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "MCP-Protocol-Version: 2025-12-26" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-12-26",
"capabilities": {},
"clientInfo": {
"name": "example-client",
"version": "1.0.0"
}
}
}'响应将包含 Mcp-Session-Id 头,后续请求需要使用此会话 ID。
Response will include Mcp-Session-Id header, which must be used in subsequent requests.
使用会话调用工具 / Call Tool with Session:
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Mcp-Session-Id: <session-id-from-initialize>" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}'使用 SSE 流 / Use SSE Streaming:
# 初始化并请求SSE流 / Initialize and request SSE stream
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "MCP-Protocol-Version: 2025-12-26" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-12-26"
}
}'
# 打开SSE流监听服务器消息 / Open SSE stream to listen for server messages
curl -X GET http://localhost:8080/mcp \
-H "Accept: text/event-stream" \
-H "Mcp-Session-Id: <session-id>"终止会话 / Terminate Session:
curl -X DELETE http://localhost:8080/mcp \
-H "Mcp-Session-Id: <session-id>"HTTP 方法支持 / HTTP Methods:
POST: 发送 JSON-RPC 消息,支持 JSON 和 SSE 响应
GET: 打开 SSE 流监听服务器推送消息
DELETE: 终止会话
OPTIONS: CORS 预检请求
测试脚本 / Test Scripts:
项目提供了完整的 Streamable HTTP 测试脚本:
The project provides complete Streamable HTTP test scripts:
# Linux/macOS
chmod +x examples/streamable_http_test.sh
./examples/streamable_http_test.sh
# Windows PowerShell
.\examples\streamable_http_test.ps1测试脚本会自动执行以下操作:
初始化会话并获取会话 ID
列出所有可用工具
调用示例工具
测试 SSE 流响应
终止会话
The test script automatically performs the following:
Initialize session and get session ID
List all available tools
Call example tool
Test SSE stream response
Terminate session
SSE 传输 / SSE Transport
# 使用SSE传输 / Use SSE transport
./mcp-toolkit -transport sse
# 自定义SSE配置 / Customize SSE configuration
./mcp-toolkit -transport sse -sse-host 0.0.0.0 -sse-port 8081 -sandbox /path/to/sandbox
# 设置最大连接数 / Set max connections
./mcp-toolkit -transport sse -sse-max-connections 100
# 启用频率限制 / Enable rate limiting
./mcp-toolkit -transport sse -sse-enable-rate-limit -sse-rate-limit-requests 100 -sse-rate-limit-window 60SSE 传输特性 / SSE Transport Features:
连接管理 - 连接池、最大连接数限制、自动清理
心跳机制 - 保持连接活跃,可配置心跳间隔
服务器推送 - 支持向客户端推送消息
频率限制 - 防止滥用和 DDoS 攻击
协议版本 - 支持最新 MCP 协议版本
详细的传输方式说明请参考:传输方式文档
For detailed transport documentation, see: Transport Documentation
MCP 客户端配置 / MCP Client Configuration
以下是在主流 MCP 客户端(如 Claude Desktop、Cline 等)中配置 MCP Toolkit 的方法。
Here are the methods to configure MCP Toolkit in mainstream MCP clients (such as Claude Desktop, Cline, etc.).
配置文件位置 / Configuration File Location
Claude Desktop:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Cline (VS Code Extension):
在 VS Code 设置中搜索 "MCP Servers" / Search for "MCP Servers" in VS Code settings
或编辑
settings.json文件 / Or editsettings.jsonfile
1. Stdio 传输配置 / Stdio Transport Configuration
Stdio 是最常用的传输方式,适合本地开发和桌面应用。
Stdio is the most common transport method, suitable for local development and desktop applications.
使用 uvx (推荐) / Using uvx (Recommended)
{
"mcpServers": {
"mcp-toolkit": {
"command": "uvx",
"args": [
"mcp-sandbox-toolkit",
"-sandbox",
"/path/to/your/sandbox"
],
"env": {}
}
}
}使用已安装的二进制文件 / Using Installed Binary
Linux/macOS:
{
"mcpServers": {
"mcp-toolkit": {
"command": "/usr/local/bin/mcp-toolkit",
"args": [
"-sandbox",
"/path/to/your/sandbox"
],
"env": {}
}
}
}Windows:
{
"mcpServers": {
"mcp-toolkit": {
"command": "C:\\Program Files\\mcp-toolkit\\mcp-toolkit.exe",
"args": [
"-sandbox",
"D:\\developer\\go_code\\mcp_demo"
],
"env": {}
}
}
}2. HTTP 传输配置 / HTTP Transport Configuration
HTTP 传输适合远程服务器部署和多客户端访问。
HTTP transport is suitable for remote server deployment and multi-client access.
服务器启动 / Server Startup
# 启动 HTTP 服务器 / Start HTTP server
./mcp-toolkit -transport http -http-host 0.0.0.0 -http-port 8080 -sandbox /path/to/sandbox客户端配置 / Client Configuration
{
"mcpServers": {
"mcp-toolkit-http": {
"url": "http://localhost:8080/mcp",
"transport": "http",
"headers": {
"Content-Type": "application/json"
}
}
}
}远程服务器配置 / Remote Server Configuration:
{
"mcpServers": {
"mcp-toolkit-remote": {
"url": "http://your-server.com:8080/mcp",
"transport": "http",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer your-token-here"
}
}
}
}3. Streamable HTTP 配置 / Streamable HTTP Configuration
Streamable HTTP 支持会话管理和 SSE 流,提供更好的实时性。
Streamable HTTP supports session management and SSE streaming for better real-time performance.
服务器启动 / Server Startup
# 启动支持 Streamable HTTP 的服务器 / Start server with Streamable HTTP support
./mcp-toolkit -transport http \
-http-host 0.0.0.0 \
-http-port 8080 \
-http-enable-session \
-http-enable-sse \
-http-session-timeout 1800 \
-http-sse-heartbeat 30 \
-sandbox /path/to/sandbox客户端配置 / Client Configuration
{
"mcpServers": {
"mcp-toolkit-streamable": {
"url": "http://localhost:8080/mcp",
"transport": "streamable-http",
"headers": {
"Content-Type": "application/json",
"MCP-Protocol-Version": "2025-12-26"
},
"sessionManagement": {
"enabled": true,
"timeout": 1800
},
"streaming": {
"enabled": true,
"heartbeat": 30
}
}
}
}启用频率限制 / With Rate Limiting:
./mcp-toolkit -transport http \
-http-enable-rate-limit \
-http-rate-limit-requests 100 \
-http-rate-limit-window 604. SSE 传输配置 / SSE Transport Configuration
SSE (Server-Sent Events) 传输专门用于服务器推送场景。
SSE (Server-Sent Events) transport is specifically designed for server push scenarios.
服务器启动 / Server Startup
# 启动 SSE 服务器 / Start SSE server
./mcp-toolkit -transport sse \
-sse-host 0.0.0.0 \
-sse-port 8081 \
-sse-max-connections 100 \
-sse-heartbeat-interval 30 \
-sandbox /path/to/sandbox启用频率限制 / With Rate Limiting:
./mcp-toolkit -transport sse \
-sse-enable-rate-limit \
-sse-rate-limit-requests 100 \
-sse-rate-limit-window 60 \
-sse-max-connections 100客户端配置 / Client Configuration
{
"mcpServers": {
"mcp-toolkit-sse": {
"url": "http://localhost:8081/sse",
"transport": "sse",
"headers": {
"MCP-Protocol-Version": "2025-12-26"
},
"connectionManagement": {
"maxConnections": 100,
"heartbeatInterval": 30
}
}
}
}配置示例汇总 / Configuration Examples Summary
完整的多服务器配置 / Complete Multi-Server Configuration
{
"mcpServers": {
"mcp-toolkit-local": {
"command": "uvx",
"args": [
"mcp-sandbox-toolkit",
"-sandbox",
"/path/to/local/sandbox"
],
"env": {}
},
"mcp-toolkit-http": {
"url": "http://localhost:8080/mcp",
"transport": "http",
"headers": {
"Content-Type": "application/json"
}
},
"mcp-toolkit-streamable": {
"url": "http://localhost:8080/mcp",
"transport": "streamable-http",
"headers": {
"Content-Type": "application/json",
"MCP-Protocol-Version": "2025-12-26"
},
"sessionManagement": {
"enabled": true,
"timeout": 1800
}
},
"mcp-toolkit-sse": {
"url": "http://localhost:8081/sse",
"transport": "sse",
"headers": {
"MCP-Protocol-Version": "2025-12-26"
}
}
}
}配置注意事项 / Configuration Notes
路径格式 / Path Format:
Windows: 使用双反斜杠
\\或正斜杠/Linux/macOS: 使用正斜杠
/
沙箱目录 / Sandbox Directory:
确保目录存在且有读写权限 / Ensure directory exists with read/write permissions
建议使用绝对路径 / Recommend using absolute paths
端口选择 / Port Selection:
确保端口未被占用 / Ensure port is not in use
HTTP 默认: 8080, SSE 默认: 8081
安全性 / Security:
生产环境建议启用认证 / Enable authentication in production
使用 HTTPS/TLS 加密传输 / Use HTTPS/TLS for encrypted transport
配置防火墙规则 / Configure firewall rules
性能优化 / Performance Optimization:
根据需求调整频率限制 / Adjust rate limiting based on needs
合理设置会话超时时间 / Set appropriate session timeout
监控连接数和资源使用 / Monitor connections and resource usage
JSON 结构体预热 / JSON Structure Preheating
程序启动时会自动预热所有注册的结构体(仅在使用Sonic时有效),以消除首次请求的延迟。
The program automatically preheats all registered structures at startup (only effective when using Sonic) to eliminate first request delays.
查看预热日志:
Check preheating logs:
{"level":"INFO","msg":"preheating JSON structures","json_library":"sonic"}
{"level":"INFO","msg":"JSON structures preheated successfully"}MCP 工具列表 / MCP Tools List
1. create_file
创建新文件并写入内容 / Create a new file and write content
参数 / Parameters:
path(必填 / required): 文件路径(相对于沙箱目录) / File path (relative to sandbox directory)content(可选 / optional): 文件内容 / File content
2. create_directory
创建新目录 / Create a new directory
参数 / Parameters:
path(必填 / required): 目录路径(相对于沙箱目录) / Directory path (relative to sandbox directory)
3. read_file
读取文件内容 / Read file content
参数 / Parameters:
path(必填 / required): 文件路径(相对于沙箱目录) / File path (relative to sandbox directory)
4. write_file
写入或覆盖文件内容 / Write or overwrite file content
参数 / Parameters:
path(必填 / required): 文件路径(相对于沙箱目录) / File path (relative to sandbox directory)content(必填 / required): 文件内容 / File content
5. delete
删除文件或目录 / Delete file or directory
参数 / Parameters:
path(必填 / required): 文件或目录路径(相对于沙箱目录) / File or directory path (relative to sandbox directory)
6. copy
复制文件或目录 / Copy file or directory
参数 / Parameters:
source(必填 / required): 源路径(相对于沙箱目录) / Source path (relative to sandbox directory)destination(必填 / required): 目标路径(相对于沙箱目录) / Destination path (relative to sandbox directory)
7. move
移动或重命名文件或目录 / Move or rename file or directory
参数 / Parameters:
source(必填 / required): 源路径(相对于沙箱目录) / Source path (relative to sandbox directory)destination(必填 / required): 目标路径(相对于沙箱目录) / Destination path (relative to sandbox directory)
8. list_directory
列出目录中的文件和子目录 / List files and subdirectories in a directory
参数 / Parameters:
path(必填 / required): 目录路径(相对于沙箱目录) / Directory path (relative to sandbox directory)
9. search_files
根据文件名模式搜索文件 / Search files by filename pattern
参数 / Parameters:
path(必填 / required): 搜索起始路径(相对于沙箱目录) / Search starting path (relative to sandbox directory)pattern(必填 / required): 文件名匹配模式(支持通配符*和?) / Filename pattern (supports wildcards * and ?)
10. batch_delete
批量删除多个文件或目录 / Batch delete multiple files or directories
参数 / Parameters:
paths(必填 / required): 要删除的文件或目录路径列表(相对于沙箱目录) / List of file or directory paths to delete (relative to sandbox directory)
11. file_stat
获取文件或目录的详细信息 / Get detailed information about a file or directory
参数 / Parameters:
path(必填 / required): 文件或目录路径(相对于沙箱目录) / File or directory path (relative to sandbox directory)
12. file_exists
检查文件或目录是否存在 / Check if a file or directory exists
参数 / Parameters:
path(必填 / required): 文件或目录路径(相对于沙箱目录) / File or directory path (relative to sandbox directory)
13. download_file
从互联网下载文件到沙箱目录 / Download file from internet to sandbox directory
参数 / Parameters:
url(必填 / required): 下载URL(必须是http://或https://) / Download URL (must be http:// or https://)path(必填 / required): 保存路径(相对于沙箱目录) / Save path (relative to sandbox directory)method(可选 / optional): HTTP方法(GET/POST/PUT等,默认GET) / HTTP method (GET/POST/PUT etc., default GET)headers(可选 / optional): 自定义请求头 / Custom headersbody(可选 / optional): 请求体(用于POST等方法) / Request body (for POST etc.)timeout(可选 / optional): 超时时间(秒,默认30,最大300) / Timeout in seconds (default 30, max 300)
详细文档 / Detailed Documentation: 下载工具指南
14. get_current_time
获取当前系统时间 / Get current system time
参数 / Parameters: 无 / None
15. execute_command
在沙箱目录内执行命令行命令 / Execute command line command within sandbox directory
参数 / Parameters:
command(必填 / required): 要执行的命令 / Command to executeargs(可选 / optional): 命令参数列表 / Command arguments listwork_dir(可选 / optional): 工作目录(相对于沙箱根目录) / Working directory (relative to sandbox root)timeout(可选 / optional): 超时时间(秒),0表示使用默认值 / Timeout in seconds, 0 for default
16. get_command_blacklist
获取命令和目录黑名单配置 / Get command and directory blacklist configuration
参数 / Parameters: 无 / None
17. update_command_blacklist
更新命令和目录黑名单 / Update command and directory blacklist
参数 / Parameters:
commands(可选 / optional): 要添加的黑名单命令列表 / Commands to add to blacklistdirectories(可选 / optional): 要添加的黑名单目录列表 / Directories to add to blacklist
18. get_working_directory
获取当前工作目录 / Get current working directory
参数 / Parameters: 无 / None
19. change_directory
切换当前工作目录 / Change current working directory
参数 / Parameters:
path(必填 / required): 目标目录路径(相对于沙箱根目录) / Target directory path (relative to sandbox root)
20. execute_command_async
异步执行命令,返回任务ID / Execute command asynchronously, returns task ID
参数 / Parameters:
command(必填 / required): 要执行的命令 / Command to executeargs(可选 / optional): 命令参数列表 / Command arguments listwork_dir(可选 / optional): 工作目录 / Working directorytimeout(可选 / optional): 超时时间(秒) / Timeout in secondsenvironment(可选 / optional): 环境变量 / Environment variablespermission_level(可选 / optional): 权限级别 / Permission leveluser(可选 / optional): 执行用户 / Executing user
21. get_command_task
获取异步命令任务状态 / Get async command task status
参数 / Parameters:
task_id(必填 / required): 任务ID / Task ID
21. cancel_command_task
取消正在执行的命令任务 / Cancel running command task
参数 / Parameters:
task_id(必填 / required): 任务ID / Task ID
22. get_command_history
获取命令执行历史记录 / Get command execution history
参数 / Parameters:
limit(可选 / optional): 返回记录数量限制 / Limit of returned recordsoffset(可选 / optional): 偏移量 / Offsetuser(可选 / optional): 按用户过滤 / Filter by user
23. clear_command_history
清空命令执行历史记录 / Clear command execution history
参数 / Parameters: 无 / None
24. set_permission_level
设置命令执行权限级别 / Set command execution permission level
参数 / Parameters:
level(必填 / required): 权限级别(0-3) / Permission level (0-3)
25. get_permission_level
获取当前权限级别 / Get current permission level
参数 / Parameters: 无 / None
26. get_system_info
获取系统信息 / Get system information
获取完整的系统信息,包括操作系统、CPU、内存、GPU、网络接口等详细信息。 Get complete system information including OS, CPU, memory, GPU, network interfaces and more.
参数 / Parameters: 无 / None
返回 / Returns:
os: 操作系统信息 / OS information (platform, architecture, hostname, uptime, etc.)cpu: CPU信息 / CPU information (model, cores, frequency, usage, etc.)memory: 内存信息 / Memory information (total, available, used, swap, etc.)gpus: GPU信息列表 / GPU information list (name, memory, temperature, utilization, etc.)networks: 网络接口信息列表 / Network interface list (name, MAC, IPs, speed, etc.)
文档 / Documentation
传输方式 / Transport
传输方式文档 - 详细的传输方式说明 (Stdio, HTTP, SSE)
Streamable HTTP 使用指南 - Streamable HTTP 功能详解
传输层改进文档 - 最新功能和改进说明
命令执行 / Command Execution
其他 / Others
Recovery 功能文档 - Panic 恢复机制和稳定性保障
安装指南 - 详细的安装说明
快速开始 - 快速入门指南
测试 / Testing
# 运行所有测试 / Run all tests
go test -v ./...
# 运行测试并生成覆盖率报告 / Run tests with coverage report
go test -v ./... -cover
# 生成详细的覆盖率报告 / Generate detailed coverage report
go test -v ./... -coverprofile=coverage.out
go tool cover -html=coverage.out当前测试覆盖率 / Current test coverage:
sandbox: 53.0%
client: 78.0%
transport: 85.0% (新增频率限制、连接管理等测试)
json: 86.1%
recovery: 100.0%
项目结构 / Project Structure
mcp-toolkit/
├── main.go # 主程序入口 / Main entry point
├── go.mod # Go 模块定义 / Go module definition
├── go.sum # 依赖校验和 / Dependency checksums
├── README.md # 项目文档 / Project documentation
├── pkg/
│ ├── types/ # 类型定义 / Type definitions
│ │ ├── common.go # 通用类型 / Common types
│ │ ├── file.go # 文件操作类型 / File operation types
│ │ ├── command.go # 命令执行类型 / Command execution types
│ │ ├── time.go # 时间类型 / Time types
│ │ ├── sysinfo.go # 系统信息类型 / System info types
│ │ ├── schema.go # JSON Schema 定义 / JSON Schema definitions
│ │ └── constants.go # 常量定义 / Constants
│ └── utils/
│ └── json/ # JSON 工具 / JSON utilities
│ ├── json.go # JSON 编解码 / JSON encoding/decoding
│ └── pretouch.go # 结构体预热 / Struct pretouch
└── internal/
└── services/
└── sandbox/ # 沙箱服务 / Sandbox service
├── service.go # 核心服务实现 / Core service implementation
├── service_test.go # 服务测试 / Service tests
├── sysinfo.go # 系统信息获取 / System info retrieval
├── sysinfo_test.go # 系统信息测试 / System info tests
├── mcp_tools.go # MCP 工具注册 / MCP tools registration
├── mcp_tools_test.go # 工具注册测试 / Tools registration tests
├── mcp_handlers.go # MCP 处理器 / MCP handlers
└── mcp_handlers_test.go # 处理器测试 / Handlers tests测试 / Testing
完整功能测试 / Complete Functionality Test
项目提供了完整的客户端测试工具,可以自动测试所有26个MCP工具。
The project provides a complete client testing tool that automatically tests all 26 MCP tools.
运行测试 / Run Tests
Linux/macOS:
# 编译服务器和客户端 / Build server and client
go build -tags="sonic" -o mcp-toolkit .
go build -tags="sonic" -o mcp-toolkit-client ./cmd/clientWindows:
# 编译服务器和客户端 / Build server and client
go build -tags="sonic" -o mcp-toolkit.exe .
go build -tags="sonic" -o mcp-toolkit-client.exe ./cmd/client手动测试 / Manual Testing
# 1. 启动服务器 / Start server
./mcp-toolkit -transport http -http-port 8080
# 2. 在新终端运行客户端测试 / Run client tests in new terminal
./mcp-toolkit-client
# 3. 使用详细日志 / Use verbose logging
./mcp-toolkit-client -verbose测试覆盖 / Test Coverage
✅ 26个MCP工具 / 26 MCP Tools
文件操作 (11个) / File Operations (11)
目录操作 (2个) / Directory Operations (2)
命令执行 (3个) / Command Execution (3)
异步操作 (3个) / Async Operations (3)
命令历史 (2个) / Command History (2)
权限管理 (2个) / Permission Management (2)
系统工具 (3个) / System Tools (3)
单元测试 / Unit Tests
# 运行所有单元测试 / Run all unit tests
go test -v ./...
# 运行特定包的测试 / Run tests for specific package
go test -v ./internal/services/sandbox/
# 查看测试覆盖率 / View test coverage
go test -cover ./...许可证 / License
本项目采用 Apache License 2.0 许可证。详情请参阅 LICENSE 文件。
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Copyright 2024 MCP Toolkit Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.第三方依赖 / Third-Party Dependencies
本项目使用了多个开源库,详情请参阅 NOTICE 文件。
This project uses several open-source libraries. See the NOTICE file for details.
Available Tools
33 toolsbatch_deleteA
Delete multiple files or directories in a single operation. Each path is processed independently, and the tool will report success/failure for each item. / 批量删除多个文件或目录。每个路径独立处理,工具会报告每个项目的成功/失败状态。
Inputs: paths (required). Returns: message, success
cancel_command_taskA
Cancel a running asynchronous command task. The task will be terminated if it's still running. / 取消正在运行的异步命令任务。如果任务仍在运行,将被终止。
Inputs: task_id (required). Returns: message, success
change_directoryA
Change the current working directory. Similar to 'cd' command. The new directory must exist and be within the sandbox. / 切换当前工作目录。类似 'cd' 命令。新目录必须存在且在沙箱范围内。
Inputs: path (required). Returns: message, success
clear_command_historyA
Clear all command execution history records. This action cannot be undone. / 清空所有命令执行历史记录。此操作不可撤销。
Inputs: no named parameters. Returns: message, success
copyA
[RECOMMENDED - PRIMARY COPY TOOL] COPY files or directories to new location. MAIN copy tool - use for ALL copy operations. Automatically detects file/directory type and handles appropriately. Performs recursive copy for directories. Keywords: copy, duplicate, clone, backup, cp. / [推荐 - 主要复制工具] 复制文件或目录到新位置。这是主要的复制工具 - 用于所有复制操作。自动检测文件/目录类型。对目录执行递归复制。关键词:复制、备份、克隆。
Inputs: source (required), destination (required). Returns: message, success
copy_directoryA
Copy directory and all contents to new location. Only works on directories, not files. Use 'copy' tool if unsure about path type. Keywords: copy directory, duplicate folder. / 复制目录及其所有内容到新位置。仅用于复制目录,不能复制文件。如果不确定路径类型,请使用 copy 工具。关键词:复制目录、备份文件夹。
Inputs: source (required), destination (required). Returns: message, success
copy_fileA
Copy specific file to new location. Only works on files, not directories. Use 'copy' tool if unsure about path type. Keywords: copy file, duplicate file. / 复制指定文件到新位置。仅用于复制文件,不能复制目录。如果不确定路径类型,请使用 copy 工具。关键词:复制文件、备份文件。
Inputs: source (required), destination (required). Returns: message, success
create_directoryA
CREATE NEW DIRECTORIES and folder structures. Automatically creates all parent directories (like 'mkdir -p'). Use for creating folders, setting up directory structures, organizing project layout. Keywords: create directory, mkdir, make folder, new folder. / 创建新目录和文件夹结构。自动创建所有父目录(类似 'mkdir -p')。关键词:创建目录、新建文件夹。
Inputs: path (required). Returns: message, success
create_fileA
CREATE A NEW FILE with specified content. Primary tool for file creation - use whenever you need to create or completely replace a file's content. Automatically creates parent directories. Keywords: create, new file, write file, save file, make file. / 创建新文件并写入内容。这是文件创建的主要工具。自动创建父目录。关键词:创建、新建文件、写入文件、保存文件。
Inputs: path (required), content (required). Returns: message, success
deleteA
[RECOMMENDED - PRIMARY DELETION TOOL] DELETE any file or directory automatically. MAIN deletion tool - use for ALL deletion operations. Intelligently detects file/directory type and handles appropriately. Performs recursive deletion for directories. Keywords: delete, remove, erase, clean, rm, unlink. / [推荐 - 主要删除工具] 自动删除任何文件或目录。这是主要的删除工具 - 用于所有删除操作。智能检测文件/目录类型并适当处理。对目录执行递归删除。关键词:删除、移除、清理。
Inputs: path (required). Returns: message, success
delete_directoryA
Delete a directory and optionally all its contents. Only works on directories, not files. Use 'delete' tool if you're unsure whether the path is a file or directory. / 删除目录及其所有内容。仅用于删除目录,不能删除文件。如果不确定是文件还是目录,请使用 delete 工具。
Inputs: path (required), recursive. Returns: message, success
delete_fileA
Delete a specific file. Only works on files, not directories. Use 'delete' tool if you're unsure whether the path is a file or directory. / 删除指定的文件。仅用于删除文件,不能删除目录。如果不确定是文件还是目录,请使用 delete 工具。
Inputs: path (required). Returns: message, success
download_fileA
DOWNLOAD FILES from the internet using HTTP/HTTPS protocols. Supports GET, POST, and other HTTP methods with custom headers and request body. Downloaded files are automatically saved to the sandbox directory. Use this tool when you need to: 1) Download files from URLs, 2) Fetch remote resources, 3) Download data files, images, documents, 4) Make HTTP requests with custom parameters, 5) Download API responses. All files are stored securely in the sandbox. Keywords: download, fetch, get file, http download, retrieve file, save from url, download from internet. / 从互联网下载文件,使用HTTP/HTTPS协议。支持GET、POST等HTTP方法,支持自定义请求头和请求体。下载的文件自动保存到沙箱目录。用于:1) 从URL下载文件,2) 获取远程资源,3) 下载数据文件、图片、文档,4) 使用自定义参数发起HTTP请求,5) 下载API响应。所有文件安全存储在沙箱中。关键词:下载、获取文件、HTTP下载、从URL保存。
Inputs: url (required), path (required), body, method, +3 more. Returns: size, message, success, content_type, +2 more
execute_commandA
EXECUTE SHELL COMMANDS synchronously and get output. Use for running CLI tools, build scripts, version control, package managers. Common uses: git commands, npm/pip/go commands, Python/Node.js scripts, build tools. IMPORTANT: Do NOT use for file operations - use dedicated file tools instead. Keywords: execute, run, command, shell, bash, terminal, cli, script, git, npm, python. / 同步执行shell命令并获取输出。用于运行CLI工具、构建脚本、版本控制、包管理器。常见用途:git命令、npm/pip/go命令、Python/Node.js脚本、构建工具。重要:不要用于文件操作 - 请使用专用的文件工具。关键词:执行、运行、命令、shell、终端、脚本。
Inputs: command (required), work_dir (required), args, timeout. Returns: stderr, stdout, message, success, +3 more
execute_command_asyncA
Execute a command asynchronously in the background. Returns a task ID immediately that can be used to check status, get output, or cancel the command. Use this for long-running commands. / 在后台异步执行命令。立即返回任务ID,可用于检查状态、获取输出或取消命令。用于长时间运行的命令。
Inputs: command (required), work_dir (required), args, user, +2 more. Returns: message, task_id
file_existsA
Check if a file or directory exists at the specified path. Returns true if exists, false otherwise. Useful for conditional operations. / 检查指定路径的文件或目录是否存在。存在返回 true,否则返回 false。用于条件操作。
Inputs: path (required). Returns: exists
file_statA
Get detailed information about a file or directory, including size, permissions, modification time, and type (file/directory/symlink). / 获取文件或目录的详细信息,包括大小、权限、修改时间和类型(文件/目录/符号链接)。
Inputs: path (required). Returns: mode, name, path, size, +2 more
get_command_blacklistA
Get the current command and directory blacklist. Returns lists of blocked commands and directories that cannot be executed or accessed. / 获取当前命令和目录黑名单。返回被阻止执行或访问的命令和目录列表。
Inputs: no named parameters. Returns: commands, directories, system_directories
get_command_historyA
Get the history of executed commands. Returns a list of previously executed commands with their results. / 获取命令执行历史记录。返回之前执行的命令及其结果列表。
Inputs: limit. Returns: total, history
get_command_taskA
Get detailed information about a specific asynchronous command task, including its status, output, start time, and duration. / 获取特定异步命令任务的详细信息,包括状态、输出、开始时间和持续时间。
Inputs: task_id (required). Returns: task
get_current_timeA
GET CURRENT DATE AND TIME with timezone support. Returns formatted datetime, timezone info, and Unix timestamp. Use for getting current time, checking time in different timezones, timestamps for logging. Keywords: time, date, now, current time, timestamp, timezone, clock. / 获取当前日期和时间,支持时区。返回格式化的日期时间、时区信息和Unix时间戳。用于获取当前时间、检查不同时区的时间、日志时间戳。关键词:时间、日期、当前时间、时间戳、时区。
Inputs: timezone. Returns: date, time, unix, is_dst, +5 more
get_permission_levelA
Get the current command execution permission level. Returns the current level (0-3) and its description. / 获取当前命令执行权限级别。返回当前级别(0-3)及其描述。
Inputs: no named parameters. Returns: level
get_system_infoA
GET COMPREHENSIVE SYSTEM INFORMATION about current machine. Returns OS details, CPU, memory, GPU, network interfaces. Use for checking system specs, verifying hardware capabilities, getting OS info, checking available resources. Keywords: system info, hardware, specs, os info, cpu, memory, ram, gpu. / 获取当前机器的全面系统信息。返回操作系统详情、CPU、内存、显卡、网卡信息。用于检查系统规格、验证硬件能力、获取操作系统信息、检查可用资源。关键词:系统信息、硬件、规格、操作系统信息、CPU、内存、显卡。
Inputs: no named parameters. Returns: os, cpu, gpus, memory, +1 more
get_working_directoryA
Get the current working directory path. Returns the absolute path of the current working directory. / 获取当前工作目录路径。返回当前工作目录的绝对路径。
Inputs: no named parameters. Returns: work_dir
list_directoryA
LIST AND EXPLORE directory contents. Shows all files and subdirectories with detailed information. Primary tool for directory exploration. Use for seeing what files are in a directory, exploring project structure. Keywords: list, ls, dir, show files, browse. / 列出和探索目录内容。显示所有文件和子目录的详细信息。这是目录探索的主要工具。关键词:列出、显示文件、浏览。
Inputs: path (required). Returns: files
moveA
[RECOMMENDED - PRIMARY MOVE/RENAME TOOL] MOVE or RENAME files and directories. MAIN move/rename tool - use for ALL move and rename operations. Automatically detects file/directory type and handles appropriately. Keywords: move, rename, mv, relocate. / [推荐 - 主要移动/重命名工具] 移动或重命名文件和目录。这是主要的移动/重命名工具 - 用于所有移动和重命名操作。自动检测文件/目录类型。关键词:移动、重命名、重定位。
Inputs: source (required), destination (required). Returns: message, success
move_directoryA
Move or rename directory. Only works on directories, not files. Use 'move' tool if unsure about path type. Keywords: move directory, rename folder. / 移动或重命名目录。仅用于移动目录,不能移动文件。如果不确定路径类型,请使用 move 工具。关键词:移动目录、重命名文件夹。
Inputs: source (required), destination (required). Returns: message, success
move_fileA
Move or rename specific file. Only works on files, not directories. Use 'move' tool if unsure about path type. Keywords: move file, rename file. / 移动或重命名指定文件。仅用于移动文件,不能移动目录。如果不确定路径类型,请使用 move 工具。关键词:移动文件、重命名文件。
Inputs: source (required), destination (required). Returns: message, success
read_fileA
READ AND RETRIEVE complete file content. Primary tool for reading files - use whenever you need to see what's inside a file. Use for viewing, inspecting, checking file contents before modification. Keywords: read, view, show, display, get content, inspect file, open file. / 读取并获取完整文件内容。这是读取文件的主要工具。关键词:读取、查看、显示、获取内容、检查文件。
Inputs: path (required). Returns: content
search_filesA
SEARCH AND FIND files matching patterns. Recursively searches through all subdirectories using glob patterns. Use for finding files by extension, locating specific files by name pattern. Keywords: search, find, locate, grep files, filter. / 搜索和查找匹配模式的文件。使用glob模式递归搜索所有子目录。用于按扩展名查找文件、按名称模式定位特定文件。关键词:搜索、查找、定位、过滤。
Inputs: path (required), pattern (required). Returns: files
set_permission_levelA
Set the command execution permission level. Higher levels allow more privileged operations. Level 0 is most restrictive, level 3 is least restrictive. / 设置命令执行权限级别。级别越高允许的操作越多。级别0最严格,级别3最宽松。
Inputs: level (required). Returns: message, success
update_command_blacklistB
Update the command and directory blacklist. Add commands or directories that should be blocked from execution or access. / 更新命令和目录黑名单。添加应被阻止执行或访问的命令或目录。
Inputs: commands, directories. Returns: message, success
write_fileA
WRITE OR UPDATE content to existing file, completely replacing current content. Workflow: read file first, modify content, then write back. For new files use 'create_file'. Keywords: write, update, modify, save, edit file, change file. / 写入或更新现有文件内容,完全替换当前内容。工作流程:先读取文件,修改内容,然后写回。新文件请使用 'create_file'。关键词:写入、更新、修改、保存、编辑文件。
Inputs: path (required), content (required). Returns: message, success
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 33 tools
Most tools have clearly distinct purposes, but there are overlapping variants like copy/copy_file/copy_directory. The 'primary' tool recommendations help reduce confusion, making selection mostly unambiguous.
Most tool names follow a verb_noun pattern (e.g., create_file, delete_directory). However, a few exceptions like 'file_exists' and 'file_stat' break the pattern, and single-verb tools 'copy', 'delete', 'move' stand out.
With 33 tools, this server is larger than typical MCP servers. The set includes many redundant variants (e.g., three flavors each for copy, delete, and move), which inflates the count without adding significant functional breadth.
The tool set covers most core file system and command execution workflows, including CRUD, directory management, search, and async command control. Minor gaps exist, such as no direct file content search or batch copy/move, but these can be worked around.
Maintenance
Related MCP Connectors
MCP registry & directory: search, find & install 31k+ MCP servers & tools. Catalog and marketplace.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Production-grade cryptography toolkit with 31 MCP tools for classical, PQC, and KMS workflows.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceCustom MCP tools for local development that enable file system access, shell command execution, and web resource browsing. Designed for local use with safety considerations for potentially destructive operations.-
- FlicenseNot gradedqualityDmaintenanceProvides comprehensive utility tools including file operations, weather information, system monitoring, mathematical calculations, text search, and safe command execution. Enables users to perform various system and data operations through a unified MCP interface with built-in security features.-
- AlicenseNot gradedqualityDmaintenanceProvides essential utility tools for text processing, file operations, hashing, temperature conversion, password generation, and date/time operations through a comprehensive MCP interface.MIT
- AlicenseNot gradedqualityDmaintenanceA modular framework for building and running multiple MCP servers with file operations, system information, and extensible tool/prompt/resource support.MIT