Drive one tmux server: sessions, windows, panes, and the output they produce.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Alpha software. Releases carry an -alpha prerelease tag, the API is not settled, and any release may change or remove exported identifiers without a deprecation period. Pin an exact version. Not recommended for production.
Drive tmux from Go: sessions, windows, and panes as typed values, every tmux option and hook as a typed accessor, and errors classified by what tmux actually refused.
Session you hold is what tmux said
when you asked, not a live handle that changes underneath.Modules are tagged per directory, so each consumer carries its own version:
the tags are mcp/vN and workspace/vN beside the core's plain vN. Pin the
exact ones you want in your own go.mod; the commands here fetch the newest.
Contents β Quick start Β· Querying Β· Choosing a mode Β· Watching tmux Β· Packages Β· For agents Β· Testing your code Β· Documentation
Make a window, split it, send a command into the new pane:
Every Go block below marked this way is generated from a program in
examples/ that is compiled, linted, run against a real tmux, and
swept across every supported release β so none of it can drift from code that
works.
Runnable: examples/quickstart β go -C examples run ./quickstart.
Two ways to ask, and they answer the same question at different costs.
Let tmux filter, which sends one command and gets back only matches:
Or read once and filter in Go, when you want several answers from one read:
Typed filters compose, and the generated ones push down into tmux's own -f
where tmux can evaluate them:
Runnable: examples/filter-query.
A plain Server uses the executable, environment, working directory, and
socket selection frozen by NewServer. Values derived from it retain that
subprocess binding. Guards on materialized values assume stable, trusted tmux
parser primitives and aliases. Establish a connection before socket
replacement when exact-daemon ownership is required.
| Path | Construct it with | Cost | Reach for it |
|---|---|---|---|
| process | NewServer | one tmux process per operation | one-shot commands |
| connection | Session.OpenControl | one tmux client per lane | repeated commands |
| concurrent | ConnectionOptions{Lanes: N} | N tmux clients | parallel readers |
| chained | NewPlan then Run | fewer process starts | builds and layouts |
| streaming | Session.OpenNotifications(ctx, NotificationOptions{}) | one tmux client | watching what tmux does |
Plans run over either a plain server or a connection-bound server. Unsupported
capability policy is separate: ServerOptions.Unsupported decides whether a
request naming an unavailable tmux flag is refused β the default β or
carried out without it and reported to a warning handler.
A connection carries commands without starting a process for each. It appears
in list-clients and counts toward session_attached, which is why opening one
is explicit:
Once established, connection.Server() and connection.Session() are bound
to that exact daemon. Values derived from them retain that owner. The binding
is terminal: closing the connection makes later operations return
ErrControlClosed, and an operation that needs a separate process returns
ErrConnectionRequiresProcess. It never falls back or rebinds. The original
session remains on its frozen subprocess binding.
Server.NewSessionConnection creates a session and retains its creating
control process as the first lane. It returns the ordinary created session and
an owned connection; use connection.Session() for connected operations.
A plan records commands instead of running them, sends the ones needing no answer together, and hands back a reference to what a step will create β so a build is written in one pass:
Runnable: examples/fast-path and
examples/planned-build.
BENCHMARKS.md is what each path costs, measured on every
supported tmux.
Session.OpenNotifications and Server.OpenNotifications return owned
streams. Zero options retain tmux changes but suppress pane output; set
IncludePaneOutput when watching pane content. tmux pushes each change when it
happens rather than making a poll guess how often to ask. Before tmux 3.6,
destroying the attached session follows its detach-on-destroy policy and may
end the stream:
Runnable: examples/control-mode-subscribe.
| Package | Source | Reference | What it is |
|---|---|---|---|
tmux | tmux/ | pkg.go.dev | The library. Sessions, windows, panes, options, hooks, formats, filters, snapshots, plans. |
tmuxtest | tmux/tmuxtest/ | pkg.go.dev | Run your program in a real tmux and assert on what it drew. |
tmuxq | tmuxq/ | pkg.go.dev | Model-free generic helpers for slices and iter.Seq. |
Three more ship as separate modules, so go get on the library pulls in
none of them:
| Module | Source | Reference | What it is |
|---|---|---|---|
mcp | mcp/ | pkg.go.dev | A tmux server for AI agents over the Model Context Protocol. Install it as a binary. |
workspace | workspace/ | pkg.go.dev | Loads tmuxp-style YAML workspaces and builds them. |
benchmarks | benchmarks/ | β | Prints what each way of reaching tmux costs. |
mcp/ is a standalone Model Context Protocol server that gives an agent
one tmux server: create panes, send keys, read output, wait for text.
See mcp/README.md for client configuration, and
mcp/TOOLS.md for the tool reference.
tmux/tmuxtest runs your program inside a real tmux and lets
a test assert on what it drew, with no sleeps. Run it, wait for what it draws,
type at it:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/tmux)<a href="https://allmcps.com/mcp/tmux"><img src="https://allmcps.com/api/badge/tmux?style=directory" alt="Tmux on AllMCPs" /></a>