claude-tmux-bridge

claude-tmux-bridge

An MCP server that connects Claude Desktop to an interactive Claude Code session running in a tmux terminal.

Category
访问服务器

README

Claude Code MCP — tmux Bridge

An MCP server that connects Claude Desktop to an interactive Claude Code session running in a tmux terminal. Instead of spawning a one-shot process per prompt, it communicates with a persistent, visible session — so you can watch Claude work in real time while Desktop orchestrates the tasks.

How It Works

Claude Desktop  →  claude_code MCP tool  →  tmux session  →  Claude Code (interactive)
                        (this repo)
  • Claude Desktop holds your project context, design decisions, and task history. It generates prompts and knows what needs to be done next.
  • Claude Code runs interactively in a tmux terminal you can watch. It has access to all your configured MCP tools and retains full conversation history between calls.
  • This server is the pipe between them — it delivers Desktop's prompts to Code's session and brings the response back.

Requirements

  • macOS
  • Node.js v20 or later
  • tmuxbrew install tmux
  • Claude Code CLI — npm install -g @anthropic-ai/claude-code

Setup

1. Install this server

git clone https://github.com/DaRealDaHoodie/claude-tmux-bridge.git
cd claude-tmux-bridge
npm install
npm run build

2. Configure Claude Desktop

Add this server to your Claude Desktop MCP config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "claude-tmux-bridge": {
      "command": "node",
      "args": ["/path/to/claude-tmux-bridge/dist/server.js"]
    }
  }
}

Restart Claude Desktop after saving.

Using the Tool

Once configured, Claude Desktop has access to the claude_code tool. When sending a prompt tell Desktop:

  • What to do — the task or question for Claude Code
  • Which project — pass workFolder as the absolute path to your project directory

Example instruction to Desktop:

Use the claude_code tool with workFolder /Users/you/my-project and ask Claude Code to implement the feature we just designed.

Everything else is automatic — the tmux session and Claude Code instance are created on first use.

Session Naming

The tmux session name is derived from your project folder's basename:

workFolder Session name
/Users/you/my-project claude-my-project
/Users/you/other-project claude-other-project
(not provided) claude-code

Watching Claude Work

Sessions run in the background automatically. Attach any time to watch:

tmux attach -t claude-my-project
# Detach with Ctrl+B D

Tool Parameters

Parameter Type Required Description
prompt string yes The prompt to send to Claude Code
workFolder string no Absolute path to project — determines the session
timeout number no Max seconds to wait for a response (default: 300)

Behaviour

  • Session not found — auto-creates the tmux session rooted at workFolder
  • Claude Code not running — auto-launches claude in the session and waits up to 30s for it to be ready
  • Session busy — rejects with a "still busy" message; does not queue
  • Timeout — auto-recovers on next call by checking if Claude has since finished
  • Conversation history — fully preserved between calls (same interactive session)

Environment Variables

Variable Default Description
MCP_CLAUDE_DEBUG false Set to true for verbose debug logging
MCP_STARTUP_DELAY_MS 1000 Wait after sending prompt before polling starts
MCP_POLL_INTERVAL_MS 1500 How often to poll the pane for output changes
MCP_STABLE_THRESHOLD_MS 3000 Fallback: ms of no change before declaring done
MCP_CLAUDE_READY_TIMEOUT 30000 Max ms to wait for Claude Code to start up

Multiple Projects

Each project gets its own named tmux session. You can have multiple sessions open simultaneously — just pass the correct workFolder and Desktop will target the right one.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选