Skip to main content
Glama
claude-terminal-mcp

claude-terminal-mcp

by LukeLamb

Terminal — Linux用Claude Desktop拡張機能

Claude Desktop用の拡張機能で、ローカルのLinuxマシン上のターミナル、ファイルシステム、バックグラウンドジョブへのアクセス権をClaudeに付与します。

Linux版Claude Desktopではclaude_desktop_config.json形式のMCPサーバーが読み込まれない(この仕組みはmacOS/Windows専用です)という問題を解決します。Linuxでは、ツールを追加する唯一の方法はインストール可能な拡張機能を経由することです。


⚠️ セキュリティ — 最初に必ずお読みください

この拡張機能をインストールすると、ユーザーアカウントに対してClaudeに無制限のシェルアクセス権が与えられます。 ターミナルからユーザーが実行できることはすべて、Claudeもこのツールを通じて実行可能です。ユーザーが読み取れるあらゆるファイルの読み取り、変更可能なあらゆるものの変更、ソフトウェアのインストール、ネットワーク接続の開始などが含まれます。

このインストールは、誰かに自分のマシンへのSSHセッションを許可するのと同じことだと考えてください。Claudeに見られたくない機密データがあるマシンや、共有システムにはインストールしないでください。

明らかに破壊的なワンライナー(rm -rf /、rm -rf ~、フォーク爆弾、生のディスクデバイスに対するdd/mkfs、shutdown/reboot)を拒否する最小限の組み込み安全拒否リストが存在します。これは最後の手段としての安全策であり、サンドボックスではありません。 悪意のあるコマンドであれば、簡単に回避可能です。これは、一瞬の不注意でホームディレクトリが消去されるのを防ぐために存在します。

制限を強化するには、server.jsの先頭にあるDENYLIST配列を編集して再ビルドしてください。完全に削除するには、DENYLIST = []に設定して再ビルドしてください。


Related MCP server: claude-linux-mcp

機能

Claudeに対して8つのツールを公開します:

ツール

目的

run_command(command, cwd?, timeout?, env?)

bash -lc経由でシェルコマンドを実行します。パイプ、リダイレクト、source venv/bin/activate && …などがすべて機能します。stdout/stderr/exit_codeを返します。出力はストリームごとに100KBに制限されます。完全なトランスクリプトは常にファイルに保存され、パスがlog_pathとして返されます。

read_file(path, offset?, limit?)

オプションの行範囲指定でテキストファイルを読み取ります。

list_directory(path)

タイプ(ファイル/ディレクトリ)、サイズ、mtimeを含むエントリを一覧表示します。

write_file(path, content, overwrite?)

テキストファイルを作成または上書きします。親ディレクトリも作成されます。

run_background(command, cwd?)

デタッチされたサブプロセスを生成し、job_idを返します。チャットをブロックしたくない長時間実行される作業(ビルド、トレーニング実行、サーバーなど)に使用します。

read_background(job_id, tail?)

バックグラウンドジョブのステータスと、stdout/stderrの最後のN行を読み取ります。

list_background()

すべてのジョブ(実行中、終了、強制終了)を一覧表示します。

kill_background(job_id)

ジョブにSIGTERMを送信します。5秒経過しても生存している場合はSIGKILLを送信します。

実行状態(トランスクリプト、ジョブの一時ファイル)は/tmp/claude-term-mcp/以下に保存され、再起動時に消去されます。


インストール

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

  2. Claude Desktop → Settings → Extensions を開きます。

  3. 下部にある Extension Developer セクションまでスクロールします。Install Extension をクリックし、ダウンロードしたTerminal.mcpbファイルを選択します。

  4. Claude Desktopに「開発者情報がAnthropicによって検証されていません」という赤い警告とともに拡張機能の詳細が表示されます。ソースを信頼できることを確認し、Install をクリックします。

  5. インストール時にClaude Desktopから Default working directory(デフォルトの作業ディレクトリ)を尋ねられます。これは、Claudeが指定しなかった場合にシェルコマンドが実行される場所です。メインのプロジェクトフォルダを選択するか、空のままにしてホームディレクトリをデフォルトにします。

  6. All extensions に戻り、Terminal がオンになっていることを確認します。

  7. チャット内でコネクタ/ツールピッカーを開き、その会話で Terminal を有効にします。

デフォルトの作業ディレクトリは、後から Settings → Extensions → Terminal で変更できます。

要件

  • Linux上のClaude Desktop ≥ 0.10.0(macOSでもテスト済み)

  • Node.js ≥ 16(Claude Desktopには拡張機能実行用のNodeが同梱されているため、システム側のNodeは不要です)

  • PATH上のbash

npm installの手順は不要です。この拡張機能は依存関係ゼロの純粋なNode.jsで構成されています。


設定

すべての設定は、インストール時または Settings → Extensions → Terminal からClaude DesktopのUIを通じて行います。

フィールド

型

目的

Default working directory

ディレクトリ

Claudeが指定しなかった場合にシェルコマンドが実行される場所。空欄にすると$HOMEになります。

拒否リストやその他の動作をカスタマイズするには、server.jsを編集して再ビルドしてください(下記参照)。


既知の問題

黄色いバナー: "Tool result could not be submitted. The request may have expired or the connection was interrupted." これは、Claudeの動的なツール読み込みステップをトリガーするすべてのターンで発生します。この404エラーはAnthropicバックエンドへのツール検索結果送信に関するもので、MCPツール自体に対するものではありません。ツール呼び出しは実行され、バナーの直後に正しく結果が返されます。これは見た目上の問題です。同様の問題は標準のFilesystem拡張機能でも発生します。将来のClaude Desktopリリースで修正される予定の、クライアントとバックエンド間のプロトコルの不一致である可能性が高いです。


ソースからのビルド

git clone https://github.com/LukeLamb/claude-terminal-mcp
cd claude-terminal-mcp

# Edit whatever you want in server.js / manifest.json.
# If you change the tool surface, update both places.

# Bump the version in manifest.json so Claude Desktop treats the install as an update.

# Build the bundle:
zip -j Terminal.mcpb manifest.json package.json server.js

# Then install Terminal.mcpb via Claude Desktop → Settings → Extensions → Install Extension.

アンインストール

Settings → Extensions → All extensions → Terminal → Remove。

プライバシーポリシー

データがマシンから外部へ送信されることはありません。 この拡張機能は完全にローカルで動作します:

  • データ収集: なし。この拡張機能は外部への通信、テレメトリの送信、独自のネットワークリクエストの実行を行いません。観測されるすべてのネットワーク呼び出しは、ユーザーがClaudeに実行を依頼したもの(例: curl、wget、git push)です。

  • データの使用と保存: コマンドのトランスクリプト(stdinは除外、stdout + stderr + 終了コード)は/tmp/claude-term-mcp/runs/<timestamp>.logに書き込まれ、Claudeが同じ会話内で後から参照できるようにします。バックグラウンドジョブの状態(コマンド、pid、stdout/stderrログファイル、終了コード、ステータス)は/tmp/claude-term-mcp/jobs/<job-id>/に書き込まれます。

  • 第三者への共有: なし。この拡張機能によってAnthropic、拡張機能の作成者、または第三者にデータが送信されることはありません。(Claude Desktop自体は、通常のチャットフローの一部としてツールへの入力/出力をAnthropicに送信しますが、これはAnthropicとユーザー間の関係であり、この拡張機能とは無関係です。)

  • 保持: /tmp/claude-term-mcp/は再起動のたびにクリアされます。手動でクリアするには rm -rf /tmp/claude-term-mcp を実行してください。

  • 権限の範囲: コマンドはユーザー自身の権限で実行されます。ターミナルに直接入力した場合と同じです。

  • 連絡先 / 質問: https://github.com/LukeLamb/claude-terminal-mcp/issues でIssueを作成してください。

ライセンス

MIT。自由に使用してください。帰属表示を歓迎しますが、保証はありません。

Available Tools

8 tools
kill_backgroundA
Destructive

Terminate a running background job (SIGTERM, then SIGKILL after 5s).

Inputs: job_id (required).

list_backgroundA
Read-only

List all background jobs (running, exited, killed).

Inputs: no named parameters.

list_directoryA
Read-only

List entries in a directory with type, size, and mtime.

Inputs: path (required).

read_backgroundA
Read-only

Read status and last N lines of stdout/stderr for a background job. tail=0 returns full logs.

Inputs: job_id (required), tail.

read_fileA
Read-only

Read a text file with optional line-range slicing.

Inputs: path (required), offset, limit.

run_backgroundA
Destructive

Start a long-running command in the background. Returns a job_id you can poll with read_background.

Inputs: command (required), cwd.

run_commandA
Destructive

Run a shell command via bash -lc on the user's machine. Returns stdout/stderr/exit_code. Default cwd is the user-configured default working directory (or $HOME if unset). Output capped at 100KB per stream; full transcript saved to log_path.

Inputs: command (required), cwd, timeout, env.

write_fileA
Destructive

Create or overwrite a text file. Parent directories are created.

Inputs: path (required), content (required), overwrite.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a distinct purpose: run_command for synchronous commands, run_background for long-running, and separate tools for file operations and background job management. No overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., kill_background, list_directory, read_file), making the set predictable.

    Tool Count5/5

    With 8 tools, the server covers essential terminal operations (command execution, file read/write, listing, background jobs) without excessive tool count.

    Completeness4/5

    Core operations are present, but missing file deletion, rename, and persistent directory change tools; however, these can be accomplished via run_command, so only minor gaps.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Give Claude Desktop full desktop control on Linux/X11: screenshot, mouse, keyboard, windows, clipboard, app launch. Zero-dependency MCP extension, MIT-licensed.
      15
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Exposes an interactive terminal over MCP, enabling remote shell command execution, file operations, and directory management via ChatGPT or Claude Desktop.
      2
      MIT