Skip to main content
Glama
claude-sessions-mcp

claude-sessions-mcp

by LukeLamb

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)

  1. Releases ページから最新の Sessions.mcpb をダウンロードします。

  2. Claude Desktopで、Settings → Extensions → Extension Developer → Install Extension を選択し、.mcpb ファイルを指定します。

  3. 拡張機能を有効にします。

ツール

ツール

アノテーション

機能

list_sessions

読み取り専用

セッション名、ウィンドウ、作成/アクティビティのタイムスタンプ、アタッチ状態を含むすべてのtmuxセッション

has_session

読み取り専用

セッション名の完全一致チェック

list_windows

読み取り専用

セッション内のウィンドウ(インデックス、名前、アクティブ状態、ペイン数)

capture_pane

読み取り専用

セッションのアクティブなペインの最後のN行(デフォルト100、最大10000)

new_session

破壊的

デタッチされたセッションを開始。オプションで初期シェルコマンドを実行

send_keys

破壊的

アクティブなペインにキーの組み合わせやテキストを送信(デフォルトでEnterが付与されます)

kill_session

破壊的

セッションを終了(内部の全プロセスにSIGHUPを送信)

ワークフローの例

トレーニング実行の開始:

"トレーニング実行 b8-c1 を開始して:rdna4-train venvを有効化し、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のキー名を受け付けます。一般的なものは以下の通りです:

キー

効果

C-c

Ctrl+C (割り込み)

C-d

Ctrl+D (EOF / ログアウト)

Escape

Escapeキー

Up, Down, Left, Right

矢印キー

Enter

Enter ( enter が true の場合、自動的に付与されます)

Space

スペース

生の組み合わせを送信する場合は、余分な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 tools
capture_paneA
Read-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_sessionA
Read-only

Check whether a named tmux session exists. Cheap precondition for capture_pane, send_keys, or kill_session.

Inputs: name (required).

kill_sessionA
Destructive

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_sessionsA
Read-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_windowsA
Read-only

List windows within a named session (index, name, active flag, pane count).

Inputs: name (required).

new_sessionA
Destructive

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_keysA
Destructive

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

    A4.3/5.0

    Scored across 7 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to manage local tmux sessions, including creating and controlling sessions, windows, and panes, sending commands, and capturing terminal output.
      16
      10 npm
      Do What The F*ck You Want To Public
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      2
      MIT