Rust MCP API
tmux-mcp 0.1.2 · Source
For MCP client requests, use the tool reference. This page covers language APIs for embedding or extending the server.
The tmux_mcp crate exports the tool surface for applications that need
a custom policy or transport. Its executable supplies the stdio launcher.
Rust types¶
TmuxTools::builder(server) constructs a tool surface over a libtmux
Server. Pass a Selection through .selection(), then build it. offered() reports
the definitions available under that selection.
The resulting type integrates with rmcp’s server machinery; the
embedding example uses
ServiceExt
and a stdio transport.
The crate API documents the Rust exports.
Protocol contract¶
The tool reference describes MCP names and schemas. Registered tools provide structured results and output schemas. Errors distinguish stale objects, retryable failures, and partial effects.
The static tmux://capabilities resource reports the startup-frozen
surface. Inspect tools read live tmux state. The current surface has no
workflow prompts or dynamic resource templates.
Workspace builder API describes the separate workspace parser, builder, and live-session export.
API declarations
Follow a declaration for its signature, members, documentation, and source.
Tools
mcp.model.CapturePaneArgs- Arguments for reading a pane.
mcp.model.CaptureSinceArgs- Arguments for reading what a pane wrote since last time.
mcp.model.ChannelArgs- Arguments naming a wait-for channel.
mcp.model.CreateSessionArgs- Arguments for creating a session.
mcp.model.OptionArgs- Arguments for reading a tmux option.
mcp.model.PaneArgs- Arguments naming one pane.
mcp.model.PasteTextArgs- Arguments for putting text into a pane without typing it.
mcp.model.ResizePaneArgs- Arguments for resizing a pane.
mcp.model.RunCommandArgs- Arguments for running a command and waiting for it.
mcp.model.SearchPanesArgs- Arguments for searching what panes are showing.
mcp.model.SelectLayoutArgs- Arguments for arranging a window's panes.
mcp.model.SelectPaneArgs- Arguments for moving focus between panes.
mcp.model.SelectWindowArgs- Arguments for moving focus between windows.
mcp.model.SendKeysArgs- Arguments for sending input to a pane.
mcp.model.SessionArgs- Arguments naming one session.
mcp.model.ShowEnvironmentArgs- Arguments for reading a tmux environment.
mcp.model.ShowHooksArgs- Arguments for reading the hooks set at a scope.
mcp.model.SnapshotArgs- Arguments for reading a pane's whole state.
mcp.src.TmuxTools- A tmux server presented as MCP tools.
mcp.tools.contract.VariablesArgsmcp.model.WaitForTextArgs- Arguments for waiting until a pane says something.
mcp.model.WindowArgs- Arguments naming one window.
Resources and URIs
mcp.resources.capabilities- Serialize the effective capability report.
mcp.resources.CAPABILITIES_URI- The only public resource URI.
mcp.manifest.CapabilityReport- The frozen, effective MCP surface reported at tmux://capabilities.
mcp.resources.listed- List the static capability report.
mcp.resources.templates- Dynamic resources are outside the shared cross-port contract.
Views and results
mcp.views.Branch- One session with everything under it.
mcp.views.BranchPane- One pane inside a described window.
mcp.views.BranchWindow- One window inside a described session.
mcp.views.Capture- What a pane is showing.
mcp.views.ChannelSignal- A channel that was signalled.
mcp.views.ChannelWait- How a wait on a channel finished.
mcp.tail.Cursor- A place in one pane's output.
mcp.views.Environment- A tmux environment, server-wide or for one session.
mcp.views.EnvironmentEntry- One tmux environment entry.
mcp.views.EnvironmentState- What tmux holds under one environment name.
mcp.views.Hook- One tmux hook.
mcp.views.Hooks- The hooks set at one scope.
mcp.views.Killed- An object that was destroyed.
mcp.views.Layout- A window whose layout was set.
mcp.views.Marks- Whether tmux knew where the last command's output began.
mcp.views.Matches- Where a pattern was found.
mcp.views.MatchView- One line of one pane that matched a search.
mcp.views.OptionValue- The value of one tmux option.
mcp.views.PaneChanged- A pane that was cleared, respawned, or retitled.
mcp.views.Panes- Every pane asked for.
mcp.views.PaneView- One pane, as the protocol sees it.
mcp.views.Pasted- Text that was pasted into a pane.
mcp.exec.RunOutcome- How a run finished.
mcp.exec.RunView- What a command did.
mcp.views.Sent- Keys that were sent.
mcp.views.Sessions- Every session on the server.
mcp.views.SessionView- One session, as the protocol sees it.
mcp.views.Since- What a pane wrote since a cursor.
mcp.views.Size- A pane's size after being resized.
mcp.views.Snapshot- A pane's contents and the state a capture leaves out.
mcp.views.Tree- The whole hierarchy, in one answer.
mcp.tools.contract.VariablesValuemcp.exec.WaitOutcome- How a wait for text finished.
mcp.exec.WaitView- What a pane said while it was watched for a pattern.
mcp.views.Windows- Every window asked for.
mcp.views.WindowView- One window, as the protocol sees it.
Server and setup
mcp.policy.Builder- Assembles a TmuxTools with the parts the environment usually supplies.
mcp.caller.CallerIdentity- The tmux pane hosting this process, as its environment describes it.
mcp.cli.HELP- The help text, which is also the documentation for the flags.
mcp.cli.Options- What the binary was asked to do.
mcp.caller.Relation- How a pane relates to the process answering the request.
mcp.cli.Stop- Why the binary is stopping before it serves anything.
Configuration and environment
mcp.policy.ENVIRONMENT_VALUES_ENV- The tmux environment variables whose values tools may return.
mcp.policy.environment_values_from_env- Read ENVIRONMENT_VALUES_ENV before serving MCP.
mcp.policy.EXCLUDE_TOOLS_ENV- Individual tools removed after every inclusion path.
mcp.policy.parse_environment_values- Parse the operator's allowed environment names.
mcp.policy.Reporter- Whoever asked to be told how a long call is getting on.
mcp.policy.RETIRED_RUST_SAFETY_ENV- The older Rust-specific safety setting, rejected rather than ignored.
mcp.policy.RETIRED_SAFETY_ENV- The retired ordered-safety setting, rejected rather than ignored.
mcp.policy.Selection- The startup-frozen request for one MCP tool surface.
mcp.policy.SocketProvenance- What startup can honestly claim about the selected tmux daemon.
mcp.policy.TOOLS_ENV- Individual tools added after toolset expansion.
mcp.policy.Toolset- One mechanical group in the advertised MCP tool inventory.
mcp.policy.TOOLSETS_ENV- The unordered toolsets enabled for this process.
Errors
mcp.policy.SurfaceError- A startup configuration or manifest error.
mcp.tools.error.ToolError- A tool-execution failure, reported as isError tool content.