Code Executor MCP Server
由 MEOK AI Labs 提供 — 为每个人打造的主权 AI 工具。
代码执行器 MCP 服务器
为 AI 智能体提供的沙盒代码执行环境。运行 Python、JavaScript 和 shell 命令,具备全面的安全防护、输出捕获、超时保护和文件访问限制。专为生产环境构建,内置破坏性模式拦截和可配置的限制。
工具
工具 | 描述 |
| 运行带有安全检查和输出捕获的 Python 或 JavaScript 代码 |
| 执行带有破坏性模式拦截的 shell 命令 |
| 运行测试套件(pytest、jest 等)并提供通过/失败摘要 |
| 读取允许目录内的文件 |
| 列出执行沙盒中的文件 |
| 查看当前拦截模式和安全配置 |
安全特性
拦截破坏性 shell 命令:
rm -rf /、fork 炸弹、管道到 shell拦截危险的 Python 操作:
os.system、subprocess、eval(input)、原始套接字拦截危险的 JavaScript 操作:
child_process、require('fs')、eval()文件访问限制在 Desktop、Documents、Downloads 和 /tmp 目录
所有执行均在隔离的临时目录中进行
强制超时上限为 60 秒
输出截断为 10KB 以防止内存问题
安装
pip install mcpJavaScript 支持(可选):
brew install node # or: apt install nodejs使用方法
运行服务器
python server.pyClaude Desktop 配置
{
"mcpServers": {
"code-executor": {
"command": "python",
"args": ["/path/to/code-executor-mcp/server.py"]
}
}
}调用示例
执行 Python:
Tool: execute_code
Input: {"code": "import math\nprint(f'Pi = {math.pi:.10f}')\nprint(f'e = {math.e:.10f}')", "language": "python"}
Output: {"output": "Pi = 3.1415926536\ne = 2.7182818285\n", "exit_code": 0, "elapsed_seconds": 0.045}运行 shell 命令:
Tool: run_command
Input: {"command": "ls -la /tmp | head -20"}
Output: {"output": "total 128\ndrwxrwxrwt ...", "exit_code": 0, "elapsed_seconds": 0.012}运行测试:
Tool: run_tests
Input: {"test_command": "python -m pytest tests/ -v", "working_dir": "/path/to/project"}
Output: {"passed": true, "summary": "12 passed in 1.34s", "exit_code": 0}拦截命令示例:
Tool: run_command
Input: {"command": "rm -rf /"}
Output: {"error": "Command blocked by safety filter (matches: rm\\s+-rf\\s+/)"}定价
层级 | 限制 | 价格 |
免费版 | 每天 50 次执行,30 秒超时 | $0 |
专业版 | 无限制,120 秒超时,Docker 隔离 | $9/月 |
企业版 | 定制 + 网络访问 + GPU 执行 | 联系我们 |
许可证
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/CSOAI-ORG/code-executor-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server