devcontainer-mcp
45+ first-class, OS and backend specific MCP tools that let AI coding agents create, manage, read, edit, and write files inside dev containers, keeping your machine clean and your environment reproducible and deploy-friendly. Use local Docker, GitHub Codespaces, Azure, AWS, Google Cloud or Kubernetes seamlessly!
README
devcontainer-mcp
Give your AI agent its own dev environment — not yours.
devcontainer-mcp is an MCP server that lets AI coding agents create, manage, and work inside dev containers across three backends: local Docker, DevPod, and GitHub Codespaces. The agent builds, tests, and ships code in an isolated container — your laptop stays clean.
<p align="center"> <img src="https://raw.githubusercontent.com/aniongithub/devcontainer-mcp/gh-pages/screengrabs/devcontainer-mcp-local-docker.gif" alt="devcontainer-mcp local Docker demo" width="720"> </p>
Works with GitHub Copilot, Claude, Cursor, and any MCP-compatible client.
The Problem
When AI agents write code, they need to run it somewhere. Today that means your host machine:
- 🔴 Host contamination — agents install packages, modify PATH, leave behind build artifacts
- 🔴 "Works on my machine" — agents assume your local toolchain matches production
- 🔴 No isolation — one project's dependencies break another
- 🔴 Security risk — agents run arbitrary commands with your user privileges
- 🔴 Hardware constraints — you're limited to your local machine's resources
The Solution
The devcontainer spec already defines reproducible, container-based dev environments. Every major project ships a .devcontainer/devcontainer.json. But AI agents can't use them — until now.
devcontainer-mcp exposes 45 MCP tools that let any AI agent:
- Spin up a dev container from any repo — locally, on a cloud VM, or in Codespaces
- Run commands inside the container — builds, tests, linting, anything
- Manage the lifecycle — stop, restart, delete when done
- Authenticate against cloud providers — GitHub, AWS, Azure, GCP — without ever seeing a raw token
Agent: "Let me build this project..."
→ auth_status("github") → picks account
→ codespaces_create(auth: "github-you", repo: "your/repo")
→ codespaces_ssh(auth: "github-you", codespace: "...", command: "cargo build")
→ ✅ Built in the cloud. Your laptop did nothing.
Quick Install
<p align="center"> <img src="https://raw.githubusercontent.com/aniongithub/devcontainer-mcp/gh-pages/screengrabs/devcontainer-mcp-install.gif" alt="devcontainer-mcp install demo" width="720"> </p>
Linux / macOS
curl -fsSL https://raw.githubusercontent.com/aniongithub/devcontainer-mcp/main/install.sh | bash
Windows (via WSL)
Invoke-RestMethod https://github.com/aniongithub/devcontainer-mcp/releases/latest/download/install.ps1 | Invoke-Expression
How it works: The binary runs inside WSL; MCP clients on Windows launch it via
wsl ~/.local/bin/devcontainer-mcp serve. The stdio transport works transparently across the WSL boundary. WSL 2 is required — install it withwsl --installif you haven't already.
Backend CLIs (devpod, devcontainer, gh) are detected at runtime — if one is missing, the MCP server returns a helpful error with install instructions.
Binaries available for linux-x64, linux-arm64, darwin-x64, and darwin-arm64.
Architecture
graph TD
A[AI Agent / MCP Client] -->|stdio JSON-RPC| B[devcontainer-mcp]
subgraph "devcontainer-mcp"
B --> C[33 MCP Tools]
C --> D[Auth Broker]
C --> E[devcontainer-mcp-core]
end
D -->|opaque handles| C
E -->|subprocess| F[DevPod CLI]
E -->|subprocess| G[devcontainer CLI]
E -->|subprocess| H[gh CLI]
E -->|bollard API| I[Docker Engine]
F --> J[Docker / K8s / Cloud VMs]
G --> K[Local Docker]
H --> L[GitHub Codespaces]
Three Backends, One Interface
<p align="center"> <img src="https://raw.githubusercontent.com/aniongithub/devcontainer-mcp/gh-pages/screengrabs/devcontainer-mcp-codespaces.gif" alt="devcontainer-mcp Codespaces demo" width="720"> </p>
| Backend | Best for | Requires | Auth needed? |
|---|---|---|---|
devcontainer CLI (devcontainer_*) |
Local Docker — fast, simple | @devcontainers/cli + Docker | No |
DevPod (devpod_*) |
Multi-cloud: Docker, K8s, AWS, Azure, GCP | DevPod CLI | Optional (cloud providers) |
Codespaces (codespaces_*) |
GitHub-hosted cloud environments | gh CLI | Yes (auth handle) |
Auth Broker
The agent never sees raw tokens. Instead:
auth_status(provider)— list available accounts and scopesauth_login(provider, scopes?)— initiate login, opens browser, handles device codesauth_select(id)— switch the active accountauth_logout(id)— revoke credentials
Codespaces tools require an auth handle (e.g. "github-aniongithub"). The MCP server resolves it to the real token on each call via the CLI's native keyring.
Supported providers: GitHub, AWS, Azure, GCP, Kubernetes
MCP Tools (45 total)
Auth (4 tools)
| Tool | Description |
|---|---|
auth_status |
Check auth for a provider — returns handles, accounts, scopes |
auth_login |
Initiate login or refresh scopes — browser + device code flow |
auth_select |
Switch the active account for a provider |
auth_logout |
Revoke credentials for an account |
DevPod (19 tools)
| Tool | Description |
|---|---|
devpod_up |
Create and start a workspace from a git URL, local path, or image |
devpod_stop |
Stop a running workspace |
devpod_delete |
Delete a workspace and its resources |
devpod_build |
Build a workspace image without starting it |
devpod_status |
Get workspace state (Running, Stopped, Busy, NotFound) |
devpod_list |
List all workspaces with IDs, sources, providers, and status |
devpod_ssh |
Execute a command inside a workspace via SSH |
devpod_logs |
Get workspace logs |
devpod_provider_list |
List all configured providers |
devpod_provider_add |
Add a new provider |
devpod_provider_delete |
Remove a provider |
devpod_context_list |
List all contexts |
devpod_context_use |
Switch to a different context |
devpod_container_inspect |
Docker inspect — labels, ports, mounts, state |
devpod_container_logs |
Stream container logs via Docker API |
devpod_file_read |
Read file content with optional line range |
devpod_file_write |
Create or overwrite a file (auto-creates parent dirs) |
devpod_file_edit |
Surgical string replacement — old_str → new_str |
devpod_file_list |
List directory contents (non-hidden, 2 levels deep) |
devcontainer CLI (11 tools)
| Tool | Description |
|---|---|
devcontainer_up |
Create and start a local dev container |
devcontainer_exec |
Execute a command inside a running dev container |
devcontainer_build |
Build a dev container image |
devcontainer_read_config |
Read merged devcontainer configuration as JSON |
devcontainer_stop |
Stop a dev container (via Docker API) |
devcontainer_remove |
Remove a dev container and its resources |
devcontainer_status |
Get dev container state by workspace folder |
devcontainer_file_read |
Read file content with optional line range |
devcontainer_file_write |
Create or overwrite a file (auto-creates parent dirs) |
devcontainer_file_edit |
Surgical string replacement — old_str → new_str |
devcontainer_file_list |
List directory contents (non-hidden, 2 levels deep) |
GitHub Codespaces (11 tools) — require auth handle
| Tool | Description |
|---|---|
codespaces_create |
Create a new codespace for a repository |
codespaces_list |
List your codespaces with state and machine info |
codespaces_ssh |
Execute a command inside a codespace via SSH |
codespaces_stop |
Stop a running codespace |
codespaces_delete |
Delete a codespace |
codespaces_view |
View detailed codespace info (state, machine, config) |
codespaces_ports |
List forwarded ports with visibility and URLs |
codespaces_file_read |
Read file content with optional line range |
codespaces_file_write |
Create or overwrite a file (auto-creates parent dirs) |
codespaces_file_edit |
Surgical string replacement — old_str → new_str |
codespaces_file_list |
List directory contents (non-hidden, 2 levels deep) |
MCP Server Configuration
Linux / macOS
{
"mcpServers": {
"devcontainer-mcp": {
"command": "devcontainer-mcp",
"args": ["serve"]
}
}
}
Windows (WSL bridge)
{
"mcpServers": {
"devcontainer-mcp": {
"command": "wsl",
"args": ["~/.local/bin/devcontainer-mcp", "serve"]
}
}
}
Prerequisites
Install backend CLIs as needed — the MCP server detects them at runtime and returns helpful errors if missing:
- devcontainer CLI:
npm install -g @devcontainers/cli+ Docker - DevPod: DevPod CLI + Docker (or another provider)
- Codespaces: GitHub CLI — auth is handled by the
auth_logintool
Self-Healing
When devcontainer_up, devpod_up, or codespaces_create fails, the full build output (including errors) is returned to the agent. The agent can read the error, fix the Dockerfile or devcontainer.json, and retry — making the dev environment a dynamic, agent-managed asset rather than a static prerequisite.
Development
This project eats its own dogfood — development happens inside its own devcontainer.
# Using the devcontainer CLI
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . cargo build --workspace
devcontainer exec --workspace-folder . cargo test --workspace
devcontainer exec --workspace-folder . cargo build --release -p devcontainer-mcp
# Or using DevPod
devpod up . --id devcontainer-mcp --provider docker --open-ide=false
devpod ssh devcontainer-mcp --command "cd /workspaces/devcontainer-mcp && cargo build --workspace"
CI/CD
- Pull Requests —
cargo check,cargo test,cargo clippy,cargo fmtrun automatically - Releases — Creating a GitHub release builds binaries for all 4 platforms
License
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。