mdev

command module
v0.0.0-...-73ddf49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mdev

CI Release Go version

Run several git worktrees as live dev sandboxes in parallel. Each sandbox gets its own workloads and backing services, routed through a single reverse proxy, with no per-sandbox host ports to manage.

  • Workloads are the processes you develop (run:). Each declares the ports: it listens on and is served at http://<name>-<port>.<sandbox>.localhost.
  • Backing services (postgres, redis, or any container) come from your docker-compose files. mdev runs them with docker compose up --wait and routes every exposed port at http://<service>-<port>.<sandbox>.localhost — the same scheme as workloads.
flowchart LR
  browser -->|"http://api-8000.dev.localhost"| proxy
  proxy <-->|tunnel| agent
  subgraph host ["host · mdev daemon"]
    proxy[reverse proxy]
  end
  subgraph sandbox
    agent[mdev supervisor]
    agent --> workloads[workloads]
    agent --> services[(compose services)]
  end

Install

Prebuilt binaries for Linux and macOS are on the releases page. Or build with Go:

go install github.com/stupside/mdev@latest

Quick start

Daemon config at ~/.config/mdev/config.yml — only the token is required; the listen addresses default to :80 (http) and :14434 (admin):

daemon:
  token: <openssl rand -hex 16>
  listen: { http: ":80", admin: ":14434" }   # optional; these are the defaults

mdev.yaml in your project:

workloads:
  api: { run: bun run apps/api/serve.ts, ports: [8000], env: { DATABASE_URL: postgres://app:dev@postgres:5432/app } }
  web: { run: bun run apps/web/serve.ts, ports: [8080] }

sandboxes:
  dev:
    image: oven/bun:1     # toolchain image for process workloads
    workloads: [api, web]
    runtime:
      docker:
        compose: [docker-compose.yml]  # backing services

Run it:

mdev daemon                                       # host daemon (proxy + tunnel + MCP)
mdev up dev --worktree /path/to/worktree   # spawn a sandbox; Ctrl+C tears it down

Open http://api-8000.dev.localhost. Spin up more worktrees in parallel; still no host ports.

Each sandbox picks its backend with a runtime: block: Docker (default) or Kubernetes. Workloads and URLs are the same either way. See the usage guide for the full reference.

MCP

The daemon serves sandbox-control tools over HTTP at /mcp-admin on the admin port, authenticated with the daemon.token bearer token. Register it with Claude Code:

claude mcp add --transport http mdev \
  http://localhost:14434/mcp-admin \
  --header "Authorization: Bearer <your daemon.token>"

An installable agent skill drives these tools:

npx skills add stupside/mdev

License

MIT

Documentation

Overview

Package main is the mdev binary entrypoint. The full CLI tree lives in github.com/stupside/mdev/cmd.

Directories

Path Synopsis
Package cmd is the `mdev` command tree, one file per verb:
Package cmd is the `mdev` command tree, one file per verb:
internal
config
Package config loads mdev's two configuration files:
Package config loads mdev's two configuration files:
guest/process
Package process spawns and tracks the sandbox's local workload processes inside the supervisor's container.
Package process spawns and tracks the sandbox's local workload processes inside the supervisor's container.
host/controller
Package controller is the per-sandbox reconciliation loop that converges desired state (parsed mdev.yaml on disk) toward observed state (the tunnel session's currently-registered routes + the supervisor's actually-spawned workloads).
Package controller is the per-sandbox reconciliation loop that converges desired state (parsed mdev.yaml on disk) toward observed state (the tunnel session's currently-registered routes + the supervisor's actually-spawned workloads).
host/daemon
Package daemon is the mdev host control plane.
Package daemon is the mdev host control plane.
host/runtime
Package runtime is mdev's compute-backend seam: the contract every sandbox backend (Docker, Kubernetes, a cloud VM provider like Hetzner, …) satisfies.
Package runtime is mdev's compute-backend seam: the contract every sandbox backend (Docker, Kubernetes, a cloud VM provider like Hetzner, …) satisfies.
host/runtime/docker
Package docker is the local-Docker backend: a runtime.Compute (per-sandbox network + the main toolchain container the supervisor runs in, delivered via `docker cp` + `docker exec`) and a runtime.Backing (the compose engine).
Package docker is the local-Docker backend: a runtime.Compute (per-sandbox network + the main toolchain container the supervisor runs in, delivered via `docker cp` + `docker exec`) and a runtime.Backing (the compose engine).
host/runtime/k8s
Package k8s is the Kubernetes backend: a runtime.Compute (namespace + token Secret + a main Pod whose init container seeds the supervisor into a shared volume) and a runtime.Backing (apply the sandbox's manifests).
Package k8s is the Kubernetes backend: a runtime.Compute (namespace + token Secret + a main Pod whose init container seeds the supervisor into a shared volume) and a runtime.Backing (apply the sandbox's manifests).
host/sandboxmcp
Package sandboxmcp serves the sandbox-management MCP tools mdev exposes to Claude on the host: sandbox_up, sandbox_down, sandbox_exec, sandbox_status, sandbox_events.
Package sandboxmcp serves the sandbox-management MCP tools mdev exposes to Claude on the host: sandbox_up, sandbox_down, sandbox_exec, sandbox_status, sandbox_events.
version
Package version carries build metadata stamped in at link time via -ldflags -X (see the CD workflow and Dockerfile).
Package version carries build metadata stamped in at link time via -ldflags -X (see the CD workflow and Dockerfile).
wire
Package wire is the shared contract between the host daemon and the in-sandbox supervisor: the Authorization scheme and the resolved domain types (Workload, Remote) that cross the tunnel.
Package wire is the shared contract between the host daemon and the in-sandbox supervisor: the Authorization scheme and the resolved domain types (Workload, Remote) that cross the tunnel.
wire/filesync
Package filesync is mdev's one-way file sync: a Sender streams a host worktree to a Receiver that applies it to the sandbox's workspace.
Package filesync is mdev's one-way file sync: a Sender streams a host worktree to a Receiver that applies it to the sandbox's workspace.
wire/tunnel
Package tunnel is the wire between the host daemon and the in-sandbox supervisor.
Package tunnel is the wire between the host daemon and the in-sandbox supervisor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL