← ClaudeAtlas

testing-mcp-with-cli-agentslisted

Test an MCP server by driving real CLI agents (Claude, Codex, Cursor, Gemini, Grok, agy, opencode) against it, using isolated tmux sockets and send-keys instead of trusting unit tests alone. Use this whenever verifying MCP-server behavior end-to-end, checking that a local branch or checkout works across installed agent CLIs, comparing trunk-vs-branch MCP behavior, driving an interactive agent TUI to exercise approval flows or cancellation, reproducing a tmux-MCP bug through a live client, or wiring a checkout into the CLIs with mcp_swap. Reach for it even when the user only says "test the MCP", "does the branch work in the agents", "drive the CLI to call the tool", or "check it across Codex/Gemini/Cursor" without naming tmux or sockets explicitly.
tmux-python/libtmux-mcp · ★ 13 · AI & Automation · score 71
Install: claude install-skill tmux-python/libtmux-mcp
# Testing an MCP server through real CLI agents Unit tests prove the server's internals; they don't prove a real agent can discover a tool, get past its approval gate, call it, and survive cancelling it mid-flight. This skill exercises that whole path by pointing installed CLI agents at a checkout and driving them — with the tmux tool surface (libtmux-mcp) as the running example, though the shape generalizes to any MCP server. ## The core idea: three tmux servers, never one The single biggest mistake is running everything on one tmux socket. Keep three distinct servers, each on its own socket, and the whole thing becomes safe and observable: | Role | Socket | Who touches it | Why separate | |---|---|---|---| | Your real session | default | you, interactively | must never be mutated by a test | | Harness | `tmux -L cli-harness` | the driver: `send-keys` prompts in, `capture-pane` render out | isolates the CLI TUI you're driving | | MCP-target | `tmux -L mcp-target`, exported as `LIBTMUX_SOCKET=mcp-target` to the server | the MCP server, when the agent calls tmux tools | independent ground-truth; a destructive tool here can't kill the agent you're driving | The server resolves its socket from `LIBTMUX_SOCKET` and runs `tmux -L <name>` (`src/libtmux_mcp/_utils.py` builds argv with `-L server.socket_name`, defaulted from that env var). Exporting `LIBTMUX_SOCKET=mcp-target` into the server's config env fully sandboxes every tmux tool call onto a scratch server. Pre-create it