Skip to main content
Glama
LukeLamb

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".

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name.
linesNoNumber of lines to capture (default 100).

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnly and non-destructive behavior. The description adds that it captures from the 'active pane' and returns 'joined text', which is useful behavioral context beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: first technical with defaults/limits, second a relatable use case. No wasted words, information is front-loaded and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only tool with two parameters and no output schema, the description covers purpose, behavior, parameters, and use case fully. No gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% coverage with descriptions for both parameters. The description adds the default value for 'lines' (100), which is not in the schema, giving minor additional value. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Capture the last N lines'), the resource ('session's active pane'), defaults and limits, and a concrete use case. It distinguishes from sibling tools which manage sessions or send keys, not capture output.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear context for use ('is my training still running?') but does not explicitly state when not to use or name alternatives. However, the sibling tools imply that this is the sole tool for capturing output.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

has_sessionA
Read-only

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

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name. Cannot contain ".", ":", "|", or whitespace.

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=true and destructiveHint=false. Description adds that the operation is 'cheap', which is valuable behavioral context beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words, front-loaded with purpose. Efficient and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one parameter, no output schema), the description is complete: it explains purpose, usage context, and constraint hints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with the parameter name described and constraints noted. Description does not add additional semantic meaning beyond what the schema provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool checks if a tmux session exists, using a specific verb and resource. It distinguishes itself from sibling tools by mentioning it's a precondition for three specific actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description explicitly states it's a cheap precondition for capture_pane, send_keys, or kill_session, providing clear usage context. No exclusions or alternatives are mentioned, but the context is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

kill_sessionA
Destructive

Terminate a named tmux session. Any processes running inside are sent SIGHUP by tmux. Errors if the session does not exist.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name.

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds beyond annotations: details SIGHUP behavior and error condition if session does not exist. Matches destructiveHint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, front-loaded with primary purpose. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Complete for a simple kill tool with one parameter and no output schema. Covers purpose, behavior, and error case.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% coverage but only a minimal description for the 'name' parameter. No additional semantics added in tool description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Terminate a named tmux session' with a specific verb-resource pair. Distinct from sibling tools like capture_pane or list_sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Conveys when to use (to terminate a session) and mentions consequences (SIGHUP, error if missing). Could note alternatives but sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint and destructiveHint. Description adds beyond that by detailing return fields (ISO 8601 timestamps, attached status) and the edge case of an empty list when no tmux server is running.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the main action, and every word adds value. No fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters, no output schema, and annotations, the description fully covers what the tool does, its return values, and a key edge case (no server running).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, and schema coverage is 100% (trivially). Per guidelines for 0 parameters, baseline is 4. Description does not need to add parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'List all tmux sessions' with specific return fields (name, window count, timestamps, attached status). It distinguishes from sibling tools like kill_session and new_session by focusing on listing only.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for reading sessions, not modifying them. However, it does not explicitly state when not to use or mention alternatives. The context from sibling tools helps, but clarity could be improved.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_windowsA
Read-only

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

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name.

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so the description adds the return fields (index, name, active flag, pane count). However, it does not disclose behavior if the session does not exist or any other edge cases. Adds some context but not rich behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence (12 words) with no wasted words. It is front-loaded with the action 'List windows' and immediately clarifies scope and return fields.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only list tool with 1 parameter and no output schema, the description is fairly complete: it specifies what it does, what it returns, and the required input. It could mention that the session must exist, but that is implied. Sibling tools provide additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (the only parameter 'name' is described as 'Session name'). The description reinforces that the session is named but adds no new semantic meaning beyond the schema. Baseline 3 for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and the resource 'windows within a named session', and specifies return fields (index, name, active flag, pane count). This distinguishes it from sibling tools like list_sessions (list sessions) and capture_pane (capture pane output).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you have a session name and want to see its windows, but does not explicitly state when to use this tool versus alternatives like list_sessions or when not to use it. No guidance on prerequisites (e.g., session must exist).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name (unique). Cannot contain ".", ":", "|", or whitespace.
commandNoOptional initial command to run inside the shell (e.g. "cd /path && python train.py").
cwdNoOptional starting working directory for the session.

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds significant behavioral details beyond annotations: detached, always starts shell, command sent as keystrokes enabling aliases, errors on duplicate name. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with no waste. First sentence states purpose, second explains key behavior, third clarifies command detail and error condition. Front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, behavior, error conditions, and parameter semantics. No output schema needed. Complete for a creation tool with 3 parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. Description adds key nuance: command is sent as keystrokes + Enter, preserving aliases and venvs. This raises the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool starts a new detached tmux session, which is a specific verb + resource. It distinguishes from siblings like 'kill_session' by focusing on creation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Describes when to use (to start a session) and conditions: always starts a shell, errors if name exists. No explicit comparison to alternatives, but context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesSession name.
keysYesKey combo (e.g. "C-c", "C-d", "Escape") or literal text to type.
enterNoAppend an Enter keypress after the keys. Default true.

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate destructive and open-world hints; the description adds detail: text is sent literally, Enter appended by default, and raw combos require enter=false. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences, front-loaded with purpose, then specific guidelines. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers key behavioral aspects; lacks description of return values, but given no output schema and the nature of the action (send), this is acceptable. Sibling tools are listed for context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters; description enriches meaning by explaining literal sending and enter default behavior, going beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb (send), resource (key combos or text to session's active pane), and specific use cases (interrupts, end-of-input, typing a command). It distinguishes from sibling tools like capture_pane or kill_session.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear when-to-use guidance (interrupts, end-of-input, typing) and explains the enter parameter behavior. Does not explicitly mention when not to use or alternatives among siblings, but sibling tools are sufficiently different.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 7 tool updatesv0.1.0
    • First observedcapture_pane
    • First observedhas_session
    • First observedkill_session
    • First observedlist_sessions
    • First observedlist_windows
    • First observednew_session
    • First observedsend_keys

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

ActivityMaintained
ResponsivenessNo issues

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
    8 npm
    Do What The F*ck You Want To Public
  • F
    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
    -