The tmux-mcp server integrates Claude Desktop with your tmux terminal sessions, allowing AI assistants to view, control, and interact with your terminal environment. This powerful tool enables Claude to read terminal content, execute commands, manage tmux sessions, and observe your workflow in real-time.
Before getting started, ensure you have:
To use the tmux-mcp server with Claude Desktop, you need to configure your Claude Desktop settings to include the MCP server.
Edit your Claude Desktop configuration file to include the tmux MCP server:
"mcpServers": {
"tmux": {
"command": "npx",
"args": ["-y", "tmux-mcp"]
}
}
By default, the server uses bash as the shell. If you're using a different shell, specify it in the configuration:
"mcpServers": {
"tmux": {
"command": "npx",
"args": ["-y", "tmux-mcp", "--shell-type=fish"]
}
}
This configuration is necessary for properly interpreting command exit statuses when Claude executes commands.
The tmux-mcp server provides various resources and tools that Claude can use to interact with your tmux sessions.
These endpoints expose information about your tmux environment:
tmux://sessions
- Lists all tmux sessionstmux://pane/{paneId}
- Views content of a specific tmux panetmux://command/{commandId}/result
- Retrieves results from executed commandsClaude can manage your tmux sessions with these tools:
list-sessions
tool to view all active tmux sessionsfind-session
to locate a tmux session by namecreate-session
to start a new tmux sessionkill-session
to terminate a tmux session by IDClaude can help you organize your terminal workspace:
list-windows
, create-window
, and kill-window
to manage tmux windowslist-panes
, split-pane
(horizontally or vertically with customizable sizes), and kill-pane
Claude can read terminal output from any pane using the capture-pane
tool. This allows Claude to see command results, logs, or any text displayed in your terminal.
Claude can run commands in your terminal and observe the results:
execute-command
to run a command in a specific tmux paneget-command-result
to retrieve the output of the executed command⚠️ Note: Exercise caution when allowing command execution, as Claude will be able to run any command in your terminal environment.
Here's a typical workflow Claude might use:
This integration enables a seamless collaboration between you and Claude within your terminal environment.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "tmux" '{"command":"npx","args":["-y","tmux-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"tmux": {
"command": "npx",
"args": [
"-y",
"tmux-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"tmux": {
"command": "npx",
"args": [
"-y",
"tmux-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect