|
|
6 miesięcy temu | |
|---|---|---|
| .. | ||
| README.cn.md | 6 miesięcy temu | |
| README.md | 6 miesięcy temu | |
| init.go | 6 miesięcy temu | |
一个在 Docker 容器内执行代码的安全沙盒环境。此 MCP 服务器为 AI 应用程序提供了一个安全隔离的代码运行环境,通过容器化技术确保安全性。
curl -fsSL https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.sh | bash
# 在 PowerShell 中运行
irm https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.ps1 | iex
安装程序将:
使其可执行(仅限类 Unix 系统):
chmod +x code-sandbox-mcp
sandbox_initialize初始化用于代码执行的新计算环境。 基于指定的 Docker 镜像创建容器。
参数:
image(字符串,可选):用作基础环境的 Docker 镜像
返回:
container_id,可与其他工具一起使用来与此环境交互copy_project将目录复制到沙盒文件系统。
参数:
container_id(字符串,必需):初始化调用返回的容器 IDlocal_src_dir(字符串,必需):本地文件系统中目录的路径dest_dir(字符串,可选):在沙盒环境中保存源目录的路径write_file将文件写入沙盒文件系统。
参数:
container_id(字符串,必需):初始化调用返回的容器 IDfile_name(字符串,必需):要创建的文件名file_contents(字符串,必需):要写入文件的内容dest_dir(字符串,可选):创建文件的目录(默认:${WORKDIR})sandbox_exec在沙盒环境中执行命令。
参数:
container_id(字符串,必需):初始化调用返回的容器 IDcommands(数组,必需):在沙盒环境中运行的命令列表
copy_file将单个文件复制到沙盒文件系统。
参数:
container_id(字符串,必需):初始化调用返回的容器 IDlocal_src_file(字符串,必需):本地文件系统中文件的路径dest_path(字符串,可选):在沙盒环境中保存文件的路径sandbox_stop停止并移除正在运行的容器沙盒。
参数:
container_id(字符串,必需):要停止和移除的容器 ID描述: 优雅地停止指定容器(超时时间 10 秒)并移除它及其卷。
提供访问容器日志的动态资源。
资源路径: containers://{id}/logs
MIME 类型: text/plain
描述: 将指定容器的所有容器日志作为单个文本资源返回。
安装程序会自动创建配置文件。如果您需要手动配置:
// ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "/path/to/code-sandbox-mcp",
"args": [],
"env": {}
}
}
}
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "/path/to/code-sandbox-mcp",
"args": [],
"env": {}
}
}
}
// %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "C:\\path\\to\\code-sandbox-mcp.exe",
"args": [],
"env": {}
}
}
}
对于支持 MCP 服务器的其他 AI 应用程序,请将它们配置为使用 code-sandbox-mcp 二进制文件作为代码执行后端。