claude-sessions-mcp
Claude tmux Sessions
Linux上のClaude Desktopから、tmuxセッション内で長時間実行されるジョブを開始、監視、制御できるようにします。MLトレーニング、データパイプライン、その他単一の会話を超えて継続させたいあらゆるタスクのために設計されています。
Claudeはデタッチされたトレーニング実行を開始し、1時間後にペインの最後のN行を取得して状況を確認し、キー入力(Ctrl+Cを含む)を送信し、完了時にセッションを終了させることができます。任意のターミナルから tmux attach -t <name> を実行すれば、同じセッションをライブで監視できるため、Claudeと人間が同時に状況を確認可能です。
要件
tmuxがインストールされた Linux:sudo apt install tmuxデフォルトのユーザーごとのtmuxサーバーで動作します(共有サーバー設定は不要です)。
Related MCP server: Tmux MCP Server
インストール (Claude Desktop)
Releases ページから最新の
Sessions.mcpbをダウンロードします。Claude Desktopで、Settings → Extensions → Extension Developer → Install Extension を選択し、
.mcpbファイルを指定します。拡張機能を有効にします。
ツール
ツール | アノテーション | 機能 |
| 読み取り専用 | セッション名、ウィンドウ、作成/アクティビティのタイムスタンプ、アタッチ状態を含むすべてのtmuxセッション |
| 読み取り専用 | セッション名の完全一致チェック |
| 読み取り専用 | セッション内のウィンドウ(インデックス、名前、アクティブ状態、ペイン数) |
| 読み取り専用 | セッションのアクティブなペインの最後のN行(デフォルト100、最大10000) |
| 破壊的 | デタッチされたセッションを開始。オプションで初期シェルコマンドを実行 |
| 破壊的 | アクティブなペインにキーの組み合わせやテキストを送信(デフォルトでEnterが付与されます) |
| 破壊的 | セッションを終了(内部の全プロセスにSIGHUPを送信) |
ワークフローの例
トレーニング実行の開始:
"トレーニング実行
b8-c1を開始して:rdna4-trainvenvを有効化し、train.pyを実行して。"
new_session name=b8-c1 command="source ~/.venvs/rdna4-train/bin/activate && python /media/luke/Storage\ Device\ 1/NeuroForge/train.py b8-c1"
後で確認:
"トレーニング
b8-c1はまだ動いてる?最後の50行を見せて。"
capture_pane name=b8-c1 lines=50
ハングした実行の中断:
"トレーニングがスタックした — Ctrl+Cを送って。"
send_keys name=b8-c1 keys="C-c" enter=false
終了:
"セッションを終了して。"
kill_session name=b8-c1
キー表記
send_keys はリテラルテキスト(キー入力として送信)またはtmuxのキー名を受け付けます。一般的なものは以下の通りです:
キー | 効果 |
| Ctrl+C (割り込み) |
| Ctrl+D (EOF / ログアウト) |
| Escapeキー |
| 矢印キー |
| Enter ( |
| スペース |
生の組み合わせを送信する場合は、余分なEnterが付かないように enter: false を指定してください。
プライバシーポリシー
この拡張機能は完全にローカルマシン上で実行され、tmux バイナリのみを呼び出します。データがマシンから外部へ送信されることはありません。ネットワークI/Oもソケット通信もありません。tmux自身のユーザーごとのサーバーソケット(デフォルト /tmp/tmux-$UID/default)以外にファイルが書き込まれることもありません。
Claudeが参照できる情報は、セッション名、ペインの内容(あなたやプログラムが出力したテキスト)、セッションのメタデータ(作成/アクティビティのタイムスタンプ、ウィンドウ/ペイン数)のみです。send_keys と kill_session は管理下のセッション内で実行されているあらゆるプロセスに影響を与える可能性があるため、ターミナルに直接入力するユーザーと同等の信頼レベルで扱ってください。
トラブルシューティング
"tmux is not installed" — sudo apt install tmux を実行してください。
"can't find pane" エラー — 通常、操作中にセッションが終了されたことを意味します。最初に has_session を呼び出すか、list_sessions で現在実行中のものを確認してください。
セッション名の制限 — 名前には ., :, |, または空白を含めることはできません。. と : はtmuxのターゲット区切り文字、| はこのサーバーのフィールド区切り文字であり、空白は原則として拒否されます。
セッションが初期コマンドで終了してしまう — 設計上、new_session は常にシェルを開始し、command 引数はそのシェルへのキー入力として送信されます。これにより、コマンド終了後もセッションが維持されます。もし command を直接 tmux new-session に渡すと、コマンド終了時にセッションも終了してしまいます。
開発
約300行のNode.jsスクリプト単体で構成されており、npm依存関係はゼロです。.mcpb を再ビルドするには:
cd bundle-source
zip -j ../Sessions.mcpb manifest.json package.json server.js README.md LICENSE icon.png glama.jsonライセンス
MIT。 LICENSE を参照してください。
関連
claude-terminal-mcp — シェル、ファイルシステム、バックグラウンドジョブ(tmuxを使うほどではない短時間のコマンド用)。
claude-linux-mcp — X11デスクトップ制御。
claude-rocm-mcp — AMD GPU監視。トレーニング中のGPU健全性チェックに併用してください。
Available Tools
7 toolscapture_paneARead-only
Capture the last N lines visible in the session's active pane (default 100, max 10000). Returns the joined text. The primary primitive for "is my training still running? show me the latest output".
Inputs: name (required), lines.
has_sessionARead-only
Check whether a named tmux session exists. Cheap precondition for capture_pane, send_keys, or kill_session.
Inputs: name (required).
kill_sessionADestructive
Terminate a named tmux session. Any processes running inside are sent SIGHUP by tmux. Errors if the session does not exist.
Inputs: name (required).
list_sessionsARead-only
List all tmux sessions on the current user's tmux server. Returns name, window count, created/activity timestamps (ISO 8601), and attached status. Returns an empty list when no tmux server is running.
Inputs: no named parameters.
list_windowsARead-only
List windows within a named session (index, name, active flag, pane count).
Inputs: name (required).
new_sessionADestructive
Start a new detached tmux session. Always starts a shell (so the session survives after the initial command finishes). If command is given, it is sent to the shell as keystrokes + Enter, so aliases, venvs, and functions work as expected. Errors if the session name already exists.
Inputs: name (required), command, cwd.
send_keysADestructive
Send key combos or text to the session's active pane. Use for interrupts (C-c), end-of-input (C-d), or typing a command. Text is sent literally. Enter is appended by default; set enter=false for raw key combos.
Inputs: name (required), keys (required), enter.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: creation, output capture, listing sessions/windows, existence check, input sending, and termination. No two tools overlap in functionality, making misselection unlikely.
All tools follow a consistent verb_noun pattern in lowercase snake_case (e.g., new_session, capture_pane, list_sessions). The naming is uniform and predictable, with no stylistic deviations.
7 tools is a well-scoped set for tmux session management, covering the essential lifecycle operations without redundancy or bloat. Each tool serves a clear purpose.
The surface covers the core lifecycle (create, read, check, update via send_keys, delete) adequately. Minor gaps exist, such as no rename or attach/detach operations, but these are not critical for typical usage and can be worked around.
Maintenance
Related MCP Connectors
Lets Claude, ChatGPT and other AI chats work on your Linux computers: terminal, files and browser.
Linux cloud desktop your AI can use by the hour: run commands, read and write files, see the screen.
A cloud Linux desktop for your AI: browse, click, type, read the screen and run commands.
Linux VMs for AI agents: create VMs, run commands, edit files and open preview URLs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables comprehensive tmux session management through MCP, allowing users to list sessions, send commands, set up automated messaging timers, and control tmux processes directly from Claude Desktop. Provides both real-time session monitoring and automated workflow features like exit/continue cycles.2MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to manage local tmux sessions, including creating and controlling sessions, windows, and panes, sending commands, and capturing terminal output.1610 npmDo What The F*ck You Want To Public
- AlicenseNot gradedqualityDmaintenanceEnables Claude to execute commands and manage directory-aware panes within tmux sessions for a shared terminal experience. It features smart output capture, interactive prompt detection, and background task management.2MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to control tmux sessions, manage windows and panes, and search/extract text from terminal output.2MIT