devcontainer-mcp
Allows executing bash commands inside a devcontainer using Docker, providing access to the container's environment for command execution with stdout/stderr and exit code.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@devcontainer-mcprun 'npm test' in the devcontainer"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
devcontainer-mcp
A minimal Model Context Protocol server that
exposes exactly one tool — bash — which mimics Claude Code's built-in
Bash tool but executes every command inside a devcontainer instead of on
the host.
The command runs via:
devcontainer exec --workspace-folder <folder> [--remote-env K=V ...] bash -lc "<command>"and the tool returns the command's real combined stdout/stderr and exit code — not a static "Executed command …" string.
Addressed as
mcp__devcontainer__bash(server namedevcontainer, tool namebash).
Why
This is a Python rewrite of the TypeScript
mcp-devcontainers
server, trimmed to a single Bash-like tool and fixing its main defect: the
original returned a fixed string and tee'd output to a file, so the model never
saw what actually happened. Here, stdout/stderr and the exit status flow back in
the tool result, and a non-zero exit (or a timeout) flags the result as an
error.
It deliberately does not expose up, run-user-commands, or a generic
exec — bringing the container up is out of scope for v1.
Related MCP server: Bash MCP Server
Requirements
Python ≥ 3.10
The
@devcontainers/cliavailable asdevcontaineronPATH(or override viaDEVCONTAINER_CLI, e.g.npx @devcontainers/cli)A running devcontainer for the target workspace (start it yourself with
devcontainer up --workspace-folder .)
Install / run
Run straight from the repo with uvx — no install
step:
uvx --from git+https://github.com/vovayartsev-dice/devcontainer-mcp devcontainer-mcpThe server speaks MCP over stdio.
.mcp.json
Add it to your project's .mcp.json (the server key is what produces the
mcp__devcontainer__* tool prefix):
{
"mcpServers": {
"devcontainer": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/vovayartsev-dice/devcontainer-mcp",
"devcontainer-mcp"
],
"env": {
"DEVCONTAINER_WORKSPACE_FOLDER": "${workspaceFolder}"
}
}
}
}Configuration (environment variables)
Variable | Default | Purpose |
|
| CLI invocation; shell-split, so |
| current dir | Default host workspace folder when the |
The bash tool
Field | Type | Required | Default | Notes |
| string | ✅ | — | Run via |
| string | workspace root | Working dir inside the container: | |
| object | — | Forwarded as repeated | |
| integer (ms) |
| On timeout the process group is killed; result flagged as error. | |
| string | — | Logged for observability; otherwise unused. | |
| string | cwd / env var | Host path holding the |
Result
Content is the combined stdout + stderr (interleaved), truncated to ~30 000 chars with a
[output truncated]marker if longer.On a non-zero exit, the exit code is appended and
isErroristrue.On a timeout, a timeout note is appended and
isErroristrue.
Security / scope
The command string is interpreted by bash only inside the container. The host process is launched argv-only (never
shell=True, never a hostsh -c), so host-side shell injection isn't possible.The container is the blast radius — this server does not mount the Docker socket, add
--privileged, or expose any tool other thanbash.v1 intentionally skips background execution / streaming and container bring-up.
Development
uv run devcontainer-mcp # run the server from a checkout
uv build # build wheel + sdistMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
- bashA
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vovayartsev-dice/devcontainer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server