MCP server by louiemontes
Containerized Claude Code with MCP
Sandboxed Claude Code environment with MCP server support.
Prerequisites
Docker & Docker Compose
You need Docker installed and running on your machine:
- Mac/Windows: Docker Desktop
- Linux: Docker Engine + Docker Compose
Verify installation:
docker --version
docker-compose --version
Anthropic API Key
You need an API key from Anthropic Console (not a Claude subscription):
- Go to Anthropic Console
- Sign up or log in
- Navigate to API Keys
- Click "Create Key"
- Copy your key (starts with
sk-ant-...)
Note: This uses pay-as-you-go API billing, not your Claude.ai subscription. Make sure to monitor usage in the console to avoid unexpected charges.
WARNING: Never share or check in your API key. Treat it like a password.
BIGGER WARNING: This setup bypasses all permissions for Claude inside the container. Do not run this on a production machine or with sensitive data. Use at your own risk.
EVEN BIGGER WARNING: Set a limit on your API key in the Anthropic Console to prevent runaway costs. For example, set a daily limit of $5 or 1000 tokens.
Setup
- Set your Anthropic API key in
.zshrc(or.bashrc):
export ANTHROPIC_API_KEY=sk-ant-...
- Reload your shell:
source ~/.zshrc
- Add alias to
.zshrc:
alias cdev='docker-compose down && docker-compose build && docker-compose up -d && docker-compose exec claude-code bash'
- Clone this repo and run:
cdev
- Inside container:
c # Starts Claude Code
- Say "Yes" to API key prompt (one time per rebuild)
Features
- ✅ Isolated sandbox (only accesses
./workspacedirectory) - ✅ MCP server example (echo tool)
- ✅ Permissions bypassed via
--dangerously-skip-permissions - ✅ Non-root user for security
- ✅ One-command rebuild and exec
Testing MCP
Inside Claude Code:
/mcp # View MCP servers
Use the echo tool to say hi! # Test the echo tool
Adding More MCP Servers
Edit the mcpServers section in Dockerfile's .claude.json creation.