devcontainer-dev
FreeNo executable scriptsNot checkedSpin up and interact with ToolHive Studio's containerized dev environment (Xvfb + noVNC + DinD). Use when running, testing, or debugging the app in isolation…
by stacklok★ 173 GitHub starsAbout this skill
Containerized Dev Environment
An isolated, cross-platform test environment for ToolHive Studio. The whole Electron app — including its backend thv binary and the MCP-server containers it spawns — runs inside a single devcontainer. You interact with the UI via a noVNC browser tab.
The entire stack (Node, Electron, display server, window manager, VNC server, Docker-in-Docker, DBus, keyring) lives in the container. Nothing is installed on the host. That's the whole point: every worktree can have its own container and its own experiments, with zero risk of contaminating the user's global installs.
Entry point
pnpm devContainer:dev
runs scripts/devcontainer-dev.sh on the host. The script is "smart":
- If executed on the host: runs
devcontainer upto build/start the container, thendevcontainer execto run the entrypoint inside it. - If executed inside a container (detected via
/.dockerenv): skips the build step and just runs the entrypoint directly. This path is used by GitHub Codespaces.
The three scripts
| Script | Runs on | Purpose |
|---|---|---|
scripts/devcontainer-dev.sh |
host | Picks a host port, kills stale processes, starts readiness poller, opens browser when ready, devcontainer execs the entrypoint. |
scripts/devcontainer-entrypoint.sh |
in container | Cleans stale X/VNC state, starts Xvfb, fluxbox, x11vnc, websockify/noVNC, dbus, gnome-keyring, then runs pnpm start. |
scripts/devcontainer-post-start.sh |
in container | postStartCommand in devcontainer.json. In Codespaces (detected via $CODESPACES) it nohup-launches the entrypoint in the background so the noVNC preview pane opens without user action. |
What the container runs
- Node 24 (matches
.nvmrc) - Electron + runtime deps — GTK, NSS, X11, etc. (see
.devcontainer/Dockerfile) - Display stack — Xvfb (virtual framebuffer at 1920×1200), fluxbox (window manager, auto-fullscreens windows with
WM_CLASS=ToolHive), x11vnc (VNC server), noVNC + websockify (browser client on port 6080) - Secret provider stack — dbus + gnome-keyring. Required by ToolHive's secret API; without them the backend returns 500 on secrets endpoints. Mirrors the setup in
.github/workflows/_e2e.yml. - Docker-in-Docker via the
docker-in-docker:2devcontainer feature. Supplies/var/run/docker.sockinside the container so the bundledthvCLI can spawn MCP-server containers.
Finding the URL (the logs are very long)
pnpm start + electron-forge + Vite + Electron + HMR produce a lot of output. The terminal scrollback often exhausts. Three recovery mechanisms are built in:
- Written to a file by the launcher:
~/.cache/toolhive-studio-url. Survives any amount of output.cat ~/.cache/toolhive-studio-url - Set as the terminal tab title via OSC escape. Visible in the tab bar of most terminals regardless of scrollback state.
- Prominent banners in the output — a green initial block right after
devcontainer up, plus an inverse-video✓ ToolHive ready — <URL>banner that fires only once the app is actually usable.
If you're piping the output:
pnpm devContainer:dev 2>&1 | tee /tmp/dev.log
# later:
grep -E 'ToolHive ready|vnc\.html' /tmp/dev.log
The readiness banner is what you care about. It gates on three signals simultaneously:
- noVNC's HTTP endpoint answers (the browser tab will actually load)
- The Electron binary is running (matched via
pgrep -f 'electron/dist/electron') thv serveis running (matched viapgrep -f 'thv serve'— notpgrep -x thv, because the short-lived version-check invocation also matches on bare name)
Only once all three are true does the banner fire and the host's browser auto-open.
Per-worktree isolation
Each git worktree gets its own independent devcontainer:
- Container identity — labelled with
devcontainer.local_folder=<absolute-worktree-path>. The devcontainer CLI uses this to decide which container to reuse vs create fresh. - Node modules — volume named
toolhive-node-modules-<basename>, scoped to the worktree's basename. No cross-worktree install pollution. - Host port — the primary clone uses
:6080; additional worktrees try:6080first and fall back to a Docker-assigned random port if it's taken. So multiple worktrees can run simultaneousl
Install devcontainer-dev in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
ReadGrepGlobBashFAQ
What does the devcontainer-dev skill do?
Spin up and interact with ToolHive Studio's containerized dev environment (Xvfb + noVNC + DinD). Use when running, testing, or debugging the app in isolation — locally, in a git worktree, or in GitHub Codespaces; when touching `.devcontainer/*`, `scripts/devcontainer-*.sh`, or the `devContainer:dev` npm script; or when debugging "blank white window", "Docker daemon failed to start", or "Missing X server" errors in the devcontainer. The container is fully isolated: no host pnpm install, no host Docker socket, no host X11/GPU — experiment freely without contaminating the host.
How do I install the devcontainer-dev skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the devcontainer-dev skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic