npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tmux-mcp-server

v1.3.0

Published

A simplified and elegant MCP server for persistent shell execution via tmux.

Readme

Tmux MCP Server

⚠️ WARNING: EXPERIMENTAL SOFTWARE - NOT FOR PRODUCTION USE ⚠️

This is experimental software intended for testing and development purposes only. Do not use in production environments or with sensitive data.

A simplified Model Context Protocol (MCP) server that provides persistent shell execution through tmux sessions. This server enables AI assistants to execute shell commands with session persistence, dual-window architecture, and workspace isolation.

Features

  • Dual-Window Architecture: Each workspace has two windows - exec for command execution and ui for clean output display
  • Persistent Workspaces: Execute commands in tmux sessions that persist across MCP client restarts
  • Interactive Process Support: Handle long-running processes, REPLs, and interactive commands
  • Workspace Isolation: Multiple isolated workspaces for different projects or tasks
  • Clean UI Management: Separate windows for execution and user-facing output
  • Automatic Session Management: Create, destroy, and monitor workspaces seamlessly

Installation

🚨 SECURITY WARNING: This software allows AI assistants to execute arbitrary shell commands on your system. Only install and use in isolated testing environments. Never use on systems with sensitive data or in production environments.

Prerequisites

  • Node.js 18.0.0 or higher
  • tmux installed on your system
    • Ubuntu/Debian: sudo apt install tmux
    • macOS: brew install tmux
    • CentOS/RHEL: sudo yum install tmux

Install from npm

npm install -g tmux-mcp-server

Install from source

git clone https://github.com/TNTisdial/persistent-shell-mcp.git
cd persistent-shell-mcp
npm install
npm link

Usage

MCP Client Configuration

Add to your MCP client configuration:

{
  "mcpServers": {
    "tmux-shell": {
      "command": "tmux-mcp-server"
    }
  }
}

Available Tools

Core Execution Tools

execute_command

Execute commands that complete quickly and return full output. Uses the exec window.

execute_command({
  command: "ls -la", 
  workspace_id: "my-project"
})

start_process

Start long-running or interactive processes. Can target either window:

  • exec window (default): For background processes
  • ui window: For interactive applications that need user visibility
start_process({
  command: "python3", 
  workspace_id: "dev",
  target_window: "ui"  // For interactive apps like vim, python REPL
})

get_output

Capture current terminal output from either window:

  • ui window (default): Clean user-facing output
  • exec window: Raw shell with all commands
get_output({
  workspace_id: "dev",
  window_name: "ui"  // or "exec" for raw output
})

send_input

Send input to running processes in either window.

send_input({
  text: "print('Hello World')", 
  workspace_id: "dev",
  target_window: "ui"
})

stop_process

Stop the currently running process in the exec window (sends Ctrl+C).

stop_process({workspace_id: "dev"})

Workspace Management Tools

create_workspace

Create a new isolated workspace with dual windows.

destroy_workspace

Destroy a workspace and all its processes.

list_workspaces

List all active workspaces.

Architecture

Dual-Window Design

Each workspace consists of two tmux windows:

  1. exec window: Raw shell for command execution

    • Handles all command execution
    • Shows full shell history and prompts
    • Used for background processes
  2. ui window: Clean output display

    • Shows clean output for user interaction
    • Used for interactive applications
    • Provides better user experience

Workspace Isolation

  • Each workspace is a separate tmux session
  • Independent working directories and environments
  • Processes don't interfere between workspaces
  • Clean separation of different projects/tasks

Common Workflows

Quick Command Execution

// Execute and get results immediately
execute_command({command: "npm install", workspace_id: "frontend"})
execute_command({command: "git status", workspace_id: "frontend"})

Interactive Development

// Start Python REPL in UI window
start_process({
  command: "python3", 
  workspace_id: "python-dev",
  target_window: "ui"
})

// Send Python commands
send_input({text: "import os", workspace_id: "python-dev", target_window: "ui"})
send_input({text: "print(os.getcwd())", workspace_id: "python-dev", target_window: "ui"})

// Check output
get_output({workspace_id: "python-dev", window_name: "ui"})

Background Process Management

// Start server in background
start_process({command: "npm run dev", workspace_id: "server"})

// Check server status
get_output({workspace_id: "server", window_name: "exec"})

// Stop server when done
stop_process({workspace_id: "server"})

Multi-Project Development

// Frontend workspace
create_workspace({workspace_id: "frontend"})
execute_command({command: "cd /path/to/frontend", workspace_id: "frontend"})

// Backend workspace  
create_workspace({workspace_id: "backend"})
execute_command({command: "cd /path/to/backend", workspace_id: "backend"})

// Database workspace
create_workspace({workspace_id: "database"})
start_process({command: "mysql -u root -p", workspace_id: "database", target_window: "ui"})

Key Advantages

Simplified Architecture

  • Clean dual-window design vs complex multi-tool approaches
  • Intuitive separation between execution and display
  • Reduced complexity while maintaining full functionality

Session Persistence

  • Workspaces survive MCP client restarts
  • Working directory and environment preserved
  • Long-running processes continue uninterrupted

Interactive Command Support

  • Proper handling of REPLs and interactive tools
  • Real-time input/output interaction
  • Support for complex interactive workflows

Project Structure

tmux-mcp/
├── src/
│   ├── server.js          # Main MCP server and tool definitions
│   ├── tmux-manager.js    # Tmux session and window management
│   └── index.js           # Entry point
├── bin/
│   └── tmux-mcp-server    # Executable script
├── package.json
└── README.md

Troubleshooting

Tmux Not Found

Error: tmux command not found

Install tmux: sudo apt install tmux (Ubuntu/Debian) or brew install tmux (macOS)

Workspace Creation Failed

Error: Failed to create workspace

Check if tmux server is running and you have permissions to create sessions

Commands Not Responding

Check workspace status with get_output

Use get_output with window_name: "exec" to see raw shell state

Process Stuck

Use stop_process to send Ctrl+C

Send interrupt signal with stop_process to terminate hanging processes

License

MIT