tmux-mcp
Allows executing shell commands in a persistent tmux session from GitHub Copilot CLI, including reading terminal output and sending control signals.
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., "@tmux-mcprun the smoke test suite and show results"
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.
Project BareMetal-Tmux
A decoupled, stateful, interactive MCP (Model Context Protocol) Tmux tool.
It exposes a persistent host tmux session to MCP clients — GitHub Copilot CLI,
ForgeCode, VS Code — over the stdio transport. No containers, no network: raw
JSON-RPC text streams straight into bare-metal shell execution.
Interactive terminal state survives agent crashes, context compaction reloads,
and framework restarts, because the shell lives in a detached tmux session
(local_agent_workspace) owned by the host — not by the agent process.
Architecture
Upstream Client (Copilot CLI / ForgeCode / VS Code)
│ spawns subprocess, speaks JSON-RPC over stdio
▼
Local MCP Server (server.py — Python 3.11+, fastmcp)
│ validates schemas, applies SR-01 safety checks, strips ANSI
▼
Host OS Shell (persistent detached tmux session, 20k-line scrollback)Related MCP server: codex-mcp-server
MCP Tools
Tool | Arguments | Purpose |
|
| Dispatch a literal shell command into the persistent pane, followed by a carriage return ( |
|
| Capture trailing scrollback from the pane, with ANSI/OSC/control sequences stripped so payloads always encode cleanly into JSON-RPC. |
|
| Send |
The session is created lazily on first tool invocation (FR-01) with a 20,000-line history limit.
Safety Guardrails (SR-01)
Execution is un-sandboxed on the host, so the server refuses destructive commands before they reach the tmux buffer:
Recursive
rmaimed at/or top-level system roots (/usr,/etc, …), includingsudo-wrapped and&&/;-chained variants--no-preserve-root,mkfs.*,dd of=/dev/..., redirects onto block devices, fork-bomb signatures
Workspace-scoped destruction (e.g. rm -rf ./build, /tmp/...) passes through.
Requirements
Windows host: WSL distro
Ubuntu-24.04withtmuxinstalled (the server runs inside WSL; clients launch it viawsl.exe)Linux/macOS host: just
tmuxonPATH— drop thewsl.exewrapper and runuv run python server.pydirectlyuv (installed user-locally, e.g.
curl -LsSf https://astral.sh/uv/install.sh | sh)Python ≥ 3.11 (resolved by uv)
Setup
Dependencies are isolated in a uv-managed venv. On WSL, keep the venv on ext4
(not /mnt/c) for speed:
cd /mnt/c/Users/troll/Python/tmux-harness
export UV_PROJECT_ENVIRONMENT="$HOME/.venvs/tmux-harness"
uv syncRun the smoke test (28 checks: ANSI stripping, SR-01 guardrails, live tmux round-trips against a throwaway session):
TMUX=harness_smoke_test uv run python tests/smoke_test.pyClient Integration
GitHub Copilot CLI
Two options:
Custom agent (recommended) — .github/agents/tmux.agent.md is a self-contained agent profile: it defines the MCP server in its frontmatter and allowlists only the three harness tools (no shell, no file edits, no web). Use it with:
/agent # pick "tmux" interactively copilot --agent=tmux -p "run the test suite and watch for failures"Global MCP server — merge mcp-config.copilot.json into
~/.copilot/mcp-config.jsonto expose the harness tools in every session (all built-in tools remain available).
ForgeCode
.mcp.json sits at the project root and is picked up automatically when ForgeCode runs from this directory.
VS Code
Add the same server block from .mcp.json to .vscode/mcp.json.
Configuration
Variable | Default | Effect |
|
| Name of the persistent tmux session |
|
| Venv location (keep on ext4 under WSL) |
Project Layout
server.py MCP server (tools, SR-01 checks, ANSI stripping)
pyproject.toml uv project: mcp[cli] + fastmcp
tests/smoke_test.py 28-check verification suite
.github/agents/tmux.agent.md Copilot CLI custom agent (harness tools only)
mcp-config.copilot.json Copilot CLI global MCP config
.mcp.json ForgeCode project-root MCP configThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/trolleydodger1988/tmux-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server