anvil
A throwaway Docker sandbox for agents to run code and shell commands safely.
README
π¨ anvil
A throwaway Docker sandbox for agents.
Run code or shell commands in a resource-limited, network-isolated, single-use container and get back a structured result β stdout, stderr, exit_code, timed_out, duration_ms. So an agent can verify its work, reproduce a bug, or check output without ever touching the host.
Part of tools-for-agents. Zero npm dependencies β drives the docker CLI directly.
Safe by default
Every run is launched with:
--network noneβ no network unless you opt in (network: "on")--memory 512m --cpus 1 --pids-limit 512β bounded resources--cap-drop ALL --security-opt no-new-privilegesβ minimal privileges--rmephemeral container, work dir is a fresh temp mount, removed after- a hard timeout (default 30s, max 300s) that
docker kills the container - optional
secure: trueβ read-only rootfs + tmpfs/tmp
CLI
node src/cli.js check # docker version + presets
node src/cli.js run python 'print(2**10)' # β 1024
node src/cli.js run node 'console.log(6*7)' # β 42
echo 'print("hi")' | node src/cli.js run python -
node src/cli.js sh 'apk info 2>/dev/null | head'
MCP server (for agents)
{
"mcpServers": {
"anvil": { "command": "node", "args": ["/abs/path/to/anvil/mcp/mcp-server.js"] }
}
}
Tools
| Tool | Use it to⦠|
|---|---|
anvil_run_code |
Run a bash / node / python snippet, get structured output. |
anvil_run_command |
Run a shell command with supplied files and/or a host dir mounted read-only at /repo (e.g. run a test suite). |
anvil_check |
Docker availability + language presets. |
Example: verify a repo's syntax without copying it
{ "name": "anvil_run_command",
"arguments": { "image": "node:22-alpine", "mount": "/path/to/repo/src",
"cmd": "node --check /repo/core.js && echo OK" } }
Result shape
{ "ok": true, "exit_code": 0, "timed_out": false, "duration_ms": 178,
"image": "python:3.12-alpine", "stdout": "...", "stderr": "" }
The agent toolkit
anvil is the execute/verify leg of the tools-for-agents toolkit:
- π°οΈ agent-hq β coordinate (memory, kanban, dashboard)
- π lens β read efficiently (token-budgeted retrieval)
- π¨ anvil β run safely (sandboxed execution)
MIT licensed.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.