Skip to main content
Glama
mcp-wcgw
by rusiaaman

Claudeおよびその他のMCPクライアント向けシェル・コーディングエージェント

チャットアプリケーションがローカルマシン上でコーディング、ビルド、実行を行えるようにします。

wcgwは、シェルとコード編集ツールが密接に統合されたMCPサーバーです。

⚠️ 警告: このMCPサーバーは、マシンのシェルとファイルへの無制限のアクセスを提供します。LLMが任意のコマンドを実行したり、意図しない変更を加えたりすることを制限しません。このツールは、攻撃者に悪用されたり、AIがハルシネーションを起こして危険なコマンドを実行したりする可能性があります。AIエージェントを制限なしで実行することに伴うリスクを完全に理解し、受け入れる場合にのみ、このリポジトリを実行してください。

2026年現在、wcgwを使用する理由は、ユーザーとエージェントの両方が制御できる(キー入力の送信を含む)完全にインタラクティブなシェル体験を提供するためです。エディタ内でエージェントのシェルをアタッチするwcgw VS Code拡張機能と組み合わせることで、現在利用可能な最高のエージェント型シェル体験を得ることができます。ファイル編集のテクニックと全体的なミニマリズムも、エージェントの生産性向上に寄与します。

Tests Mypy strict Build codecov

デモ

Workflow Demo

Related MCP server: Claude Code Control MCP

更新情報

  • [2025年10月6日] モデルがバックグラウンドで複数のコマンドを実行できるようになりました。ZSHがサポート対象のシェルになりました。多重化(Multiplexing)の改善。

  • [2025年4月27日] リレーサーバー経由のGPTサポートを削除しました。バージョン5以降ではMCPサーバーのみがサポートされます。

  • [2025年3月24日] Sonnet 3.7向けの書き込みおよび編集体験を改善しました。CLAUDE.mdが自動的に読み込まれます。

  • [2025年2月16日] AIが使用する作業ターミナルにアタッチできるようになりました。以下の「ターミナルへのアタッチ」セクションを参照してください。

  • [2025年1月15日] モードを導入しました:アーキテクト、コードライター、および全能のwcgwモード。

  • [2025年1月8日] 関連するファイルパスと説明を単一のファイルに保存するコンテキスト保存ツール。タスクのチェックポイントや知識の転送に使用できます。

  • [2024年12月29日] ファイル書き込みおよび編集時の構文チェックが安定しました。initializeツール呼び出しを有用なものにしました。リポジトリが参照された場合、スマートなリポジトリ構造をClaudeに送信します。大きなファイルの処理も改善されました。

  • [2024年12月9日] Claudeアプリにコンテキストを貼り付けるためのVS Code拡張機能

🚀 ハイライト

  • ⚡ 作成、実行、反復: すべてのエラーが修正されるまでコンパイラチェックを実行し続けるようClaudeに依頼したり、長時間実行されるコマンドのステータスを完了までチェックし続けるよう依頼したりできます。

  • ⚡ 大きなファイルの編集: トークン制限の問題を回避するため、大きなファイルの増分編集をサポートしています。必要な変更の割合に基づいて、小さな編集を行うか、大きな書き換えを行うかをスマートに選択します。

  • ⚡ 編集時の構文チェック: LLMの編集に構文エラーがある場合、フィードバックを報告してやり直させることができます。

  • ⚡ インタラクティブなコマンド処理: 矢印キー、割り込み、ANSIエスケープシーケンスを使用したインタラクティブなコマンドをサポートしています。

  • ⚡ ファイル保護:

    • AIは、ファイルを編集または書き換える前に、少なくとも一度はそのファイルを読み取る必要があります。これにより、誤った上書きを防ぎます。

    • 非常に大きなファイルを読み込む際のコンテキストの枯渇を防ぎます。ファイルはトークン長に基づいてチャンク化されます。

    • 初期化時に、重要なファイルを選択した後(.gitignoreおよび統計的アプローチに基づく)、提供されたワークスペースのディレクトリ構造が返されます。

    • 検索・置換に基づくファイル編集では、以前の検索ブロックに基づいて複数のマッチがある場合、正しい検索ブロックを見つけようとします。そうでない場合は失敗します(正確性のため)。

    • ファイル編集はスペースを許容するマッチングを行い、インデントの不一致などの問題には警告を出します。マッチしない場合は、AIが間違いを修正できるように最も近いマッチが返されます。

    • ツール呼び出しベースの検索・置換よりもパフォーマンスの高い、Aiderのような検索・置換を使用しています。

  • ⚡ シェルの最適化:

    • AIが迷子にならないよう、シェルコマンドの実行後には常に現在の作業ディレクトリが返されます。

    • コマンドのポーリングは、低速なフィードバックを避けるために短いタイムアウトで終了します。ただし、ステータスチェックにはコマンドからの新しい出力ストリーミングに基づく待機許容値があります。これら両方のアプローチを組み合わせることで、優れたシェル操作体験を提供します。

    • メインのインタラクティブシェルと並行して、複数のバックグラウンドコマンドを同時にサポートします。

  • ⚡ リポジトリコンテキストを単一ファイルに保存: 「ContextSave」ツールを使用したタスクのチェックポイント作成により、詳細なコンテキストを単一ファイルに保存します。タスクは後で新しいチャットで「Resume task id」と入力することで再開できます。保存されたファイルは、別のAIから助けを得るなど、他の種類の知識転送にも使用できます。

  • ⚡ さまざまなモードを簡単に切り替え:

    • 計画のために「アーキテクト」モードで実行するよう依頼してください。Aiderのアーキテクトモードに触発されており、最初にClaudeと協力して計画を立てます。これにより精度が向上し、時期尚早なファイル編集を防ぎます。

    • コード編集やプロジェクト構築のために「コードライター」モードで実行するよう依頼してください。ワイルドカードをサポートした特定のパスを指定することで、他のファイルが編集されるのを防ぐことができます。

    • デフォルトでは、制限がなく完全な権限を持つ「wcgw」モードで実行されます。

    • 詳細はモードセクションを参照してください。

  • ⚡ 多重化ターミナルで実行: VS Code拡張機能を使用するか、screen -xを実行して、AIがコマンドを実行するターミナルにアタッチします。履歴を表示したり、プロセスを中断したり、AIが使用しているのと同じターミナルを操作したりできます。

  • ⚡ CLAUDE.md/AGENTS.mdを自動読み込み: プロジェクトルートにある「CLAUDE.md」または「AGENTS.md」ファイルを読み込み、初期化中に指示として送信します。グローバルな「/.wcgw/CLAUDE.md」または「/.wcgw/AGENTS.md」ファイル内の指示も読み込まれ、プロジェクト固有のCLAUDE.mdと共に追加されます。ファイル名は大文字と小文字を区別します。CLAUDE.mdが存在する場合はそれがアタッチされ、存在しない場合はAGENTS.mdがアタッチされます。

Claudeのセットアップ (mcpを使用)

MacおよびLinux

まず、Homebrewを使用してuvをインストールします: brew install uv

(重要: uvのインストールにはHomebrewを使用してください。それ以外の場合は、/usr/bin/のようなグローバルな場所にuvが存在することを確認してください)

次に、claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json) を作成または更新し、以下のJSONを記述します。

{
  "mcpServers": {
    "wcgw": {
      "command": "uvx",
      "args": ["--python", "3.12", "wcgw@latest"]
    }
  }
}

その後、Claudeアプリを再起動します。

オプション: 特定のシェルを強制する

特定のシェル(bashまたはzsh)を使用するには、--shell引数を追加します:

{
  "mcpServers": {
    "wcgw": {
      "command": "uvx",
      "args": ["--python", "3.12", "wcgw@latest", "--shell", "/bin/bash"]
    }
  }
}

セットアップでエラーが発生した場合

  • 「uv ENOENT」のようなエラーが発生した場合は、uvがインストールされていることを確認してください。次に、ターミナルで「which uv」を実行し、その出力を設定の「uv」の代わりに使用してください。

  • それでも問題が解決しない場合は、ターミナルで uv tool run --python 3.12 wcgw が実行できるか確認してください。出力はなく、終了もしないはずです。

  • ~/.cache/uv フォルダを削除してみてください。

  • このツールがテストされた uv バージョン 0.6.0 を使用してみてください。

  • npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw を使用してMCPサーバーをデバッグしてください。

Windows (WSL上)

このMCPサーバーはWindows上のWSLでのみ動作します。

セットアップするには、uvをインストールしてください。

次に、Claudeの設定ファイル %APPDATA%\Claude\claude_desktop_config.json を追加または更新し、以下を記述します。

{
  "mcpServers": {
    "wcgw": {
      "command": "wsl.exe",
      "args": ["uvx", "--python", "3.12", "wcgw@latest"]
    }
  }
}

エラーが発生した場合は、コマンドプロンプトで wsl uv --python 3.12 wcgw コマンドを実行してください。error /bin/bash: line 1: uv: command not found というエラーが出る場合は、uvがグローバルにインストールされていないことを意味するため、uvの正しいパスを指定する必要があります。

  1. uvがどこにインストールされているかを確認します:

whereis uv

出力例: uv: /home/mywsl/.local/bin/uv

  1. フルパスが機能するかテストします:

wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
  1. フルパスで設定を更新します:

{
  "mcpServers": {
    "wcgw": {
      "command": "wsl.exe",
      "args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw"]
    }
  }
}

/home/mywsl/.local/bin/uv をステップ1で確認した実際のuvパスに置き換えてください。

使用方法

数秒待ってください。すべてが正しく設定されていれば、このアイコンが表示されるはずです。

mcp icon こちらです

mcp icon

その後、Claudeにシェルコマンドの実行、ファイルの読み取り、ファイルの編集、コードの実行などを依頼してください。

タスクのチェックポイントまたは知識の転送

  • 「Attach from MCP」ボタンを使用して「KnowledgeTransfer」プロンプトをアタッチすることで、タスクのチェックポイント作成や知識の転送を行うことができます。

  • 「KnowledgeTransfer」プロンプトを実行すると、「ContextSave」ツールが呼び出され、タスクの説明とすべてのファイル内容が単一のファイルに保存されます。タスクのIDが生成されます。

  • 新しいチャットで「Resume ''」と言うと、AIはタスクIDを指定して「Initialize」を呼び出し、そこからコンテキストを読み込むはずです。

  • または、生成されたファイルを直接開き、別のAIに共有して助けを求めることもできます。

モード

3つの組み込みモードがあります。Claudeに対して「'architect'モードを使用してください」のように、いずれかのモードで実行するよう依頼できます。

モード

説明

許可される操作

拒否される操作

呼び出しプロンプト

Architect

Claudeと協力してリポジトリを調査・理解するために設計されています。

読み取り専用コマンド

FileEditおよびWriteツール

Run in mode='architect'

Code-writer

コード作成および開発用

編集または書き込み用の指定パスグロブ、指定コマンド

指定されたグロブに一致しないパスのFileEdit、指定されたグロブに一致しないパスのWrite

Run in code writer mode, only 'tests/**' allowed, only uv command allowed

wcgw

すべてが許可されるデフォルトモード

すべて

なし

プロンプトなし、または「Run in wcgw mode」

注: コードライターモードでは、現時点ではすべてのコマンドが許可されるか、まったく許可されないかのどちらかです。許可されるコマンドのリストを指定した場合、Claudeはそのコマンドのみを実行するように指示されますが、実際のチェックは行われません。(開発中)

調査のために作業ターミナルにアタッチする

新機能: VS Code拡張機能は、ワークスペースパスが一致する場合、実行中のターミナルを自動的にアタッチします。

screenコマンドがインストールされている場合、wcgwは自動的にscreenインスタンス上で実行されます。wcgw MCPサーバーを起動している場合は、screenセッションを一覧表示できます:

screen -ls

93358.wcgw.235521 のようなwcgw screen名(最後の数字は時-分-秒形式)をメモしてください。

その後、screen -x 93358.wcgw.235521 を使用してセッションにアタッチできます。

実行中のコマンドは安全に中断できます。

パスワードの入力やテキストの入力など、ターミナルを安全に操作できます。(警告: 新しいコマンドを実行すると、新しいLLMコマンドによって中断されます。)

exit や Ctrl-d を使用してセッションを終了するのではなく、ctrl+a+d を使用してscreenセッションを破棄せずに安全にデタッチしてください。

より良いスクロール体験のために、~/.screenrc に以下を含めてください

defscrollback 10000
termcapinfo xterm* ti@:te@

[オプション] VS Code拡張機能

https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw

コマンド:

  • テキストを選択して cmd+' を押し、指示を入力します。これにより、アプリがClaudeに切り替わり、指示、ファイルパス、ワークスペースディレクトリ、および選択したテキストを含むテキストが貼り付けられます。

例

example

Docker経由でMCPサーバーを使用する

まずDockerイメージをビルドします: docker build -t wcgw https://github.com/rusiaaman/wcgw.git

次に、/Users/username/Library/Application Support/Claude/claude_desktop_config.json を更新して以下を含めます

{
  "mcpServers": {
    "wcgw": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount",
        "type=bind,src=/Users/username/Desktop,dst=/workspace/Desktop",
        "wcgw"
      ]
    }
  }
}

ツール

サーバーは以下のMCPツールを提供します:

シェル操作:

  • Initialize: シェルのリセットとワークスペース環境のセットアップ

    • パラメータ: any_workspace_path (string), initial_files_to_read (string[]), mode_name ("wcgw"|"architect"|"code_writer"), task_id_to_resume (string)

  • BashCommand: タイムアウト制御付きのシェルコマンド実行

    • パラメータ: command (string), wait_for_seconds (int, optional)

    • パラメータ: send_text (string) または send_specials (["Enter"|"Key-up"|...]) または send_ascii (int[]), `wait

Available Tools

6 tools
BashCommandA
Destructive
  • Execute a bash command. This is stateful (beware with subsequent calls).

  • Status of the command and the current working directory will always be returned at the end.

  • The first or the last line might be (...truncated) if the output is too long.

  • Always run pwd if you get any file or directory not found error to make sure you're not lost.

  • Do not run bg commands using "&", instead use this tool.

  • You must not use echo/cat to read/write files, use ReadFiles/FileWriteOrEdit

  • In order to check status of previous command, use status_check with empty command argument.

  • Only command is allowed to run at a time. You need to wait for any previous command to finish before running a new one.

  • Programs don't hang easily, so most likely explanation for no output is usually that the program is still running, and you need to check status again.

  • Do not send Ctrl-c before checking for status till 10 minutes or whatever is appropriate for the program to finish.

  • Only run long running commands in background. Each background command is run in a new non-reusable shell.

  • On running a bg command you'll get a bg command id that you should use to get status or interact.

Inputs: type (required), thread_id (required), command, send_text, +6 more.

ContextSaveB
Read-only

Saves provided description and file contents of all the relevant file paths or globs in a single text file.

  • Use the thread_id returned by Initialize when available; legacy clients may omit it.

  • Provide random 3 word unique id or whatever user provided.

  • Leave project path as empty string if no project path

Inputs: id (required), description (required), project_root_path (required), relevant_file_globs (required), +1 more.

FileWriteOrEditA
DestructiveIdempotent
  • Writes or edits a file based on the percentage of changes.

  • Use absolute path only (~ allowed).

  • First write down percentage of lines that need to be replaced in the file (between 0-100) in percentage_to_change

  • percentage_to_change should be low if mostly new code is to be added. It should be high if a lot of things are to be replaced.

  • If percentage_to_change > 50, provide full file content in text_or_search_replace_blocks

  • If percentage_to_change <= 50, text_or_search_replace_blocks should be search/replace blocks.

Instructions for editing files.

Example

Input file

import numpy as np
from impls import impl1, impl2

def hello():
    "print a greeting"

    print("hello")

def call_hello():
    "call hello"

    hello()
    print("Called")
    impl1()
    hello()
    impl2()

Edit format on the input file

<<<<<<< SEARCH
from impls import impl1, impl2
=======
from impls import impl1, impl2
from hello import hello as hello_renamed
>>>>>>> REPLACE
<<<<<<< SEARCH
def hello():
    "print a greeting"

    print("hello")
=======
>>>>>>> REPLACE
<<<<<<< SEARCH
def call_hello():
    "call hello"

    hello()
=======
def call_hello_renamed():
    "call hello renamed"

    hello_renamed()
>>>>>>> REPLACE
<<<<<<< SEARCH
    impl1()
    hello()
    impl2()
=======
    impl1()
    hello_renamed()
    impl2()
>>>>>>> REPLACE

SEARCH/REPLACE block Rules:

Every "<<<<<<< SEARCH" section must EXACTLY MATCH the existing file content, character for character, including all comments, docstrings, whitespaces, etc.

Including multiple unique SEARCH/REPLACE blocks if needed. Include enough and only enough lines in each SEARCH section to uniquely match each set of lines that need to change.

Keep SEARCH/REPLACE blocks concise. Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file. Include just the changing lines, and a few surrounding lines (0-3 lines) if needed for uniqueness. Other than for uniqueness, avoid including those lines which do not change in search (and replace) blocks. Target 0-3 non trivial extra lines per block.

Preserve leading spaces and indentations in both SEARCH and REPLACE blocks.

Inputs: file_path (required), thread_id (required), percentage_to_change (required), text_or_search_replace_blocks (required).

InitializeA
Read-only
  • Always call this at the start of the conversation before using any of the shell tools from wcgw.

  • Use any_workspace_path to initialize the shell in the appropriate project directory.

  • If the user has mentioned a workspace or project root or any other file or folder use it to set any_workspace_path.

  • If user has mentioned any files use initial_files_to_read to read, use absolute paths only (~ allowed)

  • By default use mode "wcgw"

  • In "code-writer" mode, set the commands and globs which user asked to set, otherwise use 'all'.

  • Use type="first_call" if it's the first call to this tool.

  • Use type="user_asked_mode_change" if in a conversation user has asked to change mode.

  • Use type="reset_shell" if in a conversation shell is not working after multiple tries.

  • Use type="user_asked_change_workspace" if in a conversation user asked to change workspace

Inputs: type (required), mode_name (required), thread_id (required), task_id_to_resume (required), +4 more.

ReadFilesA
Read-only
  • Read full file content of one or more files.

  • Use the thread_id returned by Initialize for this conversation when available; legacy clients may omit it.

  • Provide absolute paths only (~ allowed)

  • Only if the task requires line numbers understanding:

    • You may extract a range of lines. E.g., /path/to/file:1-10 for lines 1-10. You can drop start or end like /path/to/file:1- or /path/to/file:-10

Inputs: file_paths (required), thread_id.

ReadImageB
Read-only

Read an image from the shell. Use the thread_id returned by Initialize when available; legacy clients may omit it.

Inputs: file_path (required), thread_id.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool serves a clearly distinct role: initialize the session, run shell commands, read text files, read images, write/edit files, and save context. The small amount of overlap between BashCommand and the file tools is explicitly resolved by usage rules that forbid echo/cat for reading and writing.

    Naming Consistency3/5

    All names are PascalCase and generally readable, but the pattern is mixed: ReadFiles and ReadImage are verb-noun, ContextSave and FileWriteOrEdit are noun-verb, BashCommand is noun-like, and Initialize is a bare verb. The inconsistency is noticeable but not chaotic.

    Tool Count5/5

    Six tools is a well-scoped count for a shell/file-oriented MCP server. Each tool earns its place, and the set is neither bloated nor too thin for its apparent purpose.

    Completeness4/5

    The server covers the core workspace lifecycle: initialization, command execution, file reading, image reading, file writing/editing, and context saving. Generic operations like listing, deleting, or renaming are delegated to BashCommand, which works but makes for a slight indirectness rather than a true gap.

    Maintenance

    ActivityStale
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      A fully featured coding agent that uses symbolic operations (enabled by language servers) and works well even in large code bases. Essentially a free to use alternative to Cursor and Windsurf Agents, Cline, Roo Code and others.
      29
      31,250 PyPI
      31,560
      GPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Gives any MCP-compatible AI chat or agent a safe, model-neutral coding runtime with file read/search, structured multi-file patches, command execution, interactive sessions, and git operations, all confined to a single workspace and gated by permission modes.
      Apache 2.0