Token导航 LogoToken导航TokenDH.com
MCP Multi-Language Sandbox logo
运维云端未说明官方级别未说明来源级核验

MCP Multi-Language Sandbox

MCP Server

一个本地MCP服务器,允许在隔离的Docker容器中执行多种编程语言代码,提供快速、私密且可定制的代码执行环境。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
代码执行TypeScriptClaude本地开发Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Pit-CL

提供方

Pit-CL

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP多语言沙盒

![TypeScript](https://www.typescriptlang.org/) ![MCP](https://modelcontextprotocol.io/) ![License: MIT](https://opensource.org/licenses/MIT) ![Tests](<>)

这是什么?

一个本地MCP服务器,允许Claude在隔离的Docker容器中执行代码。把它想象成你自己的私人代码沙箱- 100%免费, 100%本地,不依赖云。

为什么使用这个而不是云沙盒?

  • 自由:无每次执行成本(与云服务上约0.10美元/次运行相比)
  • 快速:0ms容器采集与池化(与2-5s冷启动相比)
  • 私人:代码永远不会离开你的机器
  • 可定制的:添加您自己的语言、软件包、安全规则

特性

  • 6种语言:Python、TypeScript、JavaScript、Go、Rust、Bash
  • 容器池:预热容器,便于即时执行
  • 包缓存:安装一次,永远重复使用(基于SHA256)
  • ML运行时:numpy、pandas、sklearn、torch、mlx预装
  • 安全:Seccomp配置文件、功能删除、审计日志记录
  • 会话:具有TTL和自动清理功能的持久状态

快速开始

先决条件

安装

# Clone the repository
git clone https://github.com/Pit-CL/mcp-multilang-sandbox.git
cd mcp-multilang-sandbox

# Install dependencies
npm install

# Build
npm run build

# Run tests (optional)
npm run test:mcp

添加到克劳德代码

# Add as MCP server
claude mcp add multilang-sandbox node /path/to/mcp-multilang-sandbox/dist/mcp/server.js

# Verify it's connected
claude mcp list
# Should show: multilang-sandbox ✓ Connected

手动配置

添加到您的Claude设置(~/.claude.json 或VS代码设置):

{
  "mcpServers": {
    "multilang-sandbox": {
      "command": "node",
      "args": ["/path/to/mcp-multilang-sandbox/dist/mcp/server.js"],
      "env": {
        "LOG_LEVEL": "info"
      }
    }
  }
}

用法

配置后,Claude可以使用这些工具:

执行代码

// Python
sandbox_execute({ language: 'python', code: 'print("Hello!")' })

// TypeScript
sandbox_execute({ language: 'typescript', code: 'console.log("Hello!")' })

// With ML libraries (numpy, pandas, sklearn, torch)
sandbox_execute({
  language: 'python',
  code: 'import numpy as np; print(np.array([1,2,3]))',
  ml: true
})

持续会话

// Create a session
sandbox_session({ action: 'create', name: 'my-project', language: 'python' })

// Execute in session (state persists)
sandbox_execute({ language: 'python', code: 'x = 42', session: 'my-project' })
sandbox_execute({ language: 'python', code: 'print(x)', session: 'my-project' })  // prints 42

// Install packages
sandbox_install({ session: 'my-project', packages: ['pandas', 'requests'] })

// Cleanup
sandbox_session({ action: 'destroy', name: 'my-project' })

文件操作

// Write a file
sandbox_file_ops({ session: 'my-project', operation: 'write', path: 'data.csv', content: 'a,b\n1,2' })

// Read it back
sandbox_file_ops({ session: 'my-project', operation: 'read', path: 'data.csv' })

系统统计信息

// View pool, cache, and session stats
sandbox_inspect({ target: 'all' })

// Security audit
sandbox_security({ action: 'stats' })

MCP工具参考

工具说明
sandbox_execute以任何支持的语言执行代码
sandbox_session创建/列出/暂停/恢复/销毁会话
sandbox_install安装带有缓存的软件包
sandbox_file_ops在会话中读/写/列出/删除文件
sandbox_inspect查看系统统计数据(池、缓存、会话)
sandbox_security查看审核日志和安全事件

建筑

┌─────────────────────────────────────────────────────────┐
│                    Claude / MCP Client                   │
└───────────────────────────┬─────────────────────────────┘
                            │ JSON-RPC (stdio)
┌───────────────────────────▼─────────────────────────────┐
│                    MCP Sandbox Server                    │
│  ┌────────────────────────────────────────────────────┐ │
│  │  Tools: execute | session | install | file_ops     │ │
│  │         inspect | security                          │ │
│  ├────────────────────────────────────────────────────┤ │
│  │  Core: ContainerPool | PackageCache | Sessions     │ │
│  ├────────────────────────────────────────────────────┤ │
│  │  Security: Seccomp | Capabilities | AuditLogger    │ │
│  ├────────────────────────────────────────────────────┤ │
│  │  Runtimes: Python | TS | JS | Go | Rust | Bash     │ │
│  └────────────────────────────────────────────────────┘ │
└───────────────────────────┬─────────────────────────────┘
                            │ Dockerode
┌───────────────────────────▼─────────────────────────────┐
│                      Docker Engine                       │
│    [Container Pool]  [Active Sessions]  [Image Cache]   │
└─────────────────────────────────────────────────────────┘

安全

6层保护

  1. 代码验证 -模式块列表(操作系统、子进程、eval、exec)
  2. Seccomp配置文件 -按语言筛选系统调用
  3. 能力下降 -CAP_全部删除
  4. 网络隔离 -网络模式:无
  5. 资源限制 -内存、CPU、PID、ulimits
  6. 审计日志 -跟踪所有操作

被阻止的系统调用

ptrace, mount, umount, kexec_load, init_module, delete_module, reboot, bpf, userfaultfd,以及 更多

演出

度量
泳池冲击(温暖)0ms
池漏(冷)~80-100ms
会话创建~85ms
包缓存命中\<1ms
Python执行~60ms
Bash执行~35ms

发展

# Watch mode (auto-rebuild)
npm run dev

# Type checking
npm run typecheck

# Run tests
npm run test:all        # All tests
npm run test:mcp        # MCP tools (19 tests)
npm run test:runtimes   # Language runtimes

# Clean build
npm run clean && npm run build

项目结构

src/
├── mcp/server.ts           # MCP server & tool handlers
├── core/
│   ├── ContainerPool.ts    # Pre-warmed container pooling
│   ├── PackageCache.ts     # SHA256-based package caching
│   └── SessionManager.ts   # Persistent sessions with TTL
├── security/
│   ├── seccomp.ts          # Syscall filtering profiles
│   └── AuditLogger.ts      # Operation audit logging
├── runtimes/
│   ├── PythonRuntime.ts    # + PythonMLRuntime for ML
│   ├── TypeScriptRuntime.ts
│   ├── JavaScriptRuntime.ts
│   ├── GoRuntime.ts
│   ├── RustRuntime.ts
│   └── BashRuntime.ts
└── docker/
    ├── DockerClient.ts     # Dockerode wrapper
    └── Container.ts        # Container abstraction

贡献

问题和PR欢迎!这最初是一个个人项目,用本地和免费的东西取代云沙盒。

许可证

麻省理工学院

鸣谢

目录标签

目录标签

代码执行TypeScriptClaude本地开发本地部署Docker隔离多语言支持安全沙箱

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

session

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明sessionlocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP