tiny-agent-sandbox
Run Python, JavaScript, or shell snippets in secure, resource-limited Docker containers with no network access, exposed as MCP tools.
README
Tiny Agent Sandbox
A small, inspectable Docker-backed sandbox that agents can call as an MCP tool.
It runs Python, JavaScript, or shell snippets in a new container with no network, no host mounts, a read-only root filesystem, a non-root user, dropped capabilities, and hard resource/output limits. Results are returned as structured data for an agent to reason about.
[!WARNING] This is a learning and local-development project, not a production multi-tenant security boundary. Docker containers share a kernel. Read SECURITY.md before using untrusted code.
What the agent sees
The MCP server exposes two tools:
sandbox_status()reports Docker readiness and missing runtime images.run_code(language, code, timeout_seconds)returnsstdout,stderr, exit status, timeout and truncation flags, duration, and the runtime image.
The agent cannot choose an image, command, mount, environment variable, network policy, or Docker flag. Those remain operator-controlled policy.
Quick start
Prerequisites: Docker, Python 3.11+, and uv.
git clone https://github.com/wesleyzhangwq/tiny-agent-sandbox.git
cd tiny-agent-sandbox
docker pull python:3.12-alpine
docker pull node:22-alpine
docker pull alpine:3.22
uv sync --no-editable
uv run --no-editable tas doctor
uv run --no-editable tas run python -c 'print(sum(range(10)))'
Start the MCP server over stdio:
uv run --no-editable tiny-agent-sandbox
Connect an MCP client
For clients that accept the common mcpServers JSON shape:
{
"mcpServers": {
"tiny-agent-sandbox": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/wesleyzhangwq/tiny-agent-sandbox",
"tiny-agent-sandbox"
]
}
}
}
Pull the three runtime images before starting the client. Tool calls use --pull=never, so an agent
cannot cause an image download.
Example tool input:
{
"language": "python",
"code": "import statistics\nprint(statistics.mean([2, 4, 9]))",
"timeout_seconds": 5
}
Example structured result:
{
"language": "python",
"image": "python:3.12-alpine",
"exit_code": 0,
"stdout": "5\n",
"stderr": "",
"timed_out": false,
"output_truncated": false,
"duration_ms": 180
}
Default policy
| Control | Default |
|---|---|
| Network | disabled |
| Root filesystem | read-only |
| Writable storage | 64 MiB ephemeral /tmp (noexec, nosuid) |
| User | UID/GID 65534 |
| Linux capabilities | all dropped |
| Privilege escalation | disabled |
| Memory / swap | 256 MiB / 256 MiB |
| CPU | 1 core |
| Processes | 64 |
| File descriptors | 64 |
| Wall time | 5 seconds default, 30 seconds maximum |
| Input / combined output | 64 KiB / 128 KiB |
The fixed policy is assembled in
src/tiny_agent_sandbox/runner.py. Timeout and output overflow
remove the named container rather than merely terminating the Docker client.
Development
uv sync --no-editable --extra dev
uv run --no-editable ruff check .
uv run --no-editable pytest -m "not integration"
docker pull python:3.12-alpine node:22-alpine alpine:3.22
uv run --no-editable pytest -m integration
The preliminary ecosystem notes and design tradeoffs are in
docs/research.md.
Roadmap
- Optional gVisor (
runsc) backend with explicit runtime detection. - Digest-pinned, operator-configurable runtime images.
- Per-session workspaces with strict size and lifetime limits.
- Egress proxy with destination allowlists and audit logs.
- Concurrency quotas and OpenTelemetry execution traces.
License
Apache-2.0
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。