Tmux MCP MCP server

Interact with and view tmux session content.
Back to servers
Setup instructions
Provider
Nicola Giancecchi
Release date
Mar 17, 2025
Language
TypeScript
Package
Stats
2.6K downloads
127 stars

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.

Prerequisites

Before getting started, ensure you have:

  • Node.js installed
  • tmux installed and running

Installation

To use the tmux-mcp server with Claude Desktop, you need to configure your Claude Desktop settings to include the MCP server.

Adding to Claude Desktop Configuration

Edit your Claude Desktop configuration file to include the tmux MCP server:

"mcpServers": {
  "tmux": {
    "command": "npx",
    "args": ["-y", "tmux-mcp"]
  }
}

Configuring Shell Type

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.

Using tmux-mcp

The tmux-mcp server provides various resources and tools that Claude can use to interact with your tmux sessions.

Available Resources

These endpoints expose information about your tmux environment:

  • tmux://sessions - Lists all tmux sessions
  • tmux://pane/{paneId} - Views content of a specific tmux pane
  • tmux://command/{commandId}/result - Retrieves results from executed commands

Working with Sessions

Claude can manage your tmux sessions with these tools:

  • Listing sessions: Use the list-sessions tool to view all active tmux sessions
  • Finding sessions: Use find-session to locate a tmux session by name
  • Creating sessions: Use create-session to start a new tmux session
  • Deleting sessions: Use kill-session to terminate a tmux session by ID

Managing Windows and Panes

Claude can help you organize your terminal workspace:

  • Window management: Use list-windows, create-window, and kill-window to manage tmux windows
  • Pane operations: Use list-panes, split-pane (horizontally or vertically with customizable sizes), and kill-pane

Viewing Terminal Content

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.

Executing Commands

Claude can run commands in your terminal and observe the results:

  1. Use execute-command to run a command in a specific tmux pane
  2. Use get-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.

Example Workflow

Here's a typical workflow Claude might use:

  1. List all current tmux sessions
  2. Select a session and list its windows
  3. Choose a window and list its panes
  4. Capture content from a pane to understand what you're working on
  5. Execute helpful commands based on the context
  6. Create new sessions or windows as needed for different tasks

This integration enables a seamless collaboration between you and Claude within your terminal environment.

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later