
Ghidra 用 MCP サーバー

ghidraMCP は、LLM がアプリケーションを自律的にリバースエンジニアリングできるようにするための Model Context Protocol サーバーです。Ghidra のコア機能から多数のツールを MCP クライアントに公開します。
https://github.com/user-attachments/assets/36080514-f227-44bd-af84-78e29ee1d7f9
MCP サーバー + Ghidra プラグイン
pip install git+https://github.com/LaurieWired/GhidraMCP を実行し、以下のコマンドとして ghidra-mcp を使用)まず、このリポジトリから最新の リリース をダウンロードします。これには Ghidra プラグインと Python MCP クライアントが含まれています。その後、プラグインを Ghidra に直接インポートできます。
File -> Install Extensions を選択+ ボタンをクリックghidra_12.1.4_PUBLIC_<date>_GhidraMCP.zip を選択File -> Configure -> Developer で GhidraMCPPlugin が有効になっていることを確認Edit -> Tool Options -> GhidraMCP HTTP Server からポートを設定インストール動画ガイド:
https://github.com/user-attachments/assets/75f0c176-6da1-48dc-ad96-c182eb4648c3
理論的には、任意の MCP クライアントが ghidraMCP で動作するはずです。ほとんどのクライアントは以下のような JSON 設定を受け入れます:
{
"mcpServers": {
"ghidra": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/LaurieWired/GhidraMCP",
"ghidra-mcp",
"--ghidra-server",
"http://127.0.0.1:8080/"
]
}
}
}
サーバーの IP とポートは設定可能で、対象の Ghidra インスタンスを指すように設定する必要があります。設定しない場合、両方ともデフォルトで localhost:8080 になります。
コマンドを起動する代わりに URL に接続するクライアントの場合、まず MCP サーバーを自分で実行します:
uvx --from git+https://github.com/LaurieWired/GhidraMCP ghidra-mcp --transport streamable-http --mcp-host 127.0.0.1 --mcp-port 8081 --ghidra-server http://127.0.0.1:8080/
次に、クライアントのリモートサーバーとして http://127.0.0.1:8081/mcp を追加します。
コマンドパレットから MCP: Add Server を実行するか、ワークスペースの .vscode/mcp.json に以下を追加します:
{
"servers": {
"ghidra": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/LaurieWired/GhidraMCP",
"ghidra-mcp",
"--ghidra-server",
"http://127.0.0.1:8080/"
]
}
}
}
以下のコマンドを実行します:
claude mcp add ghidra -- uvx --from git+https://github.com/LaurieWired/GhidraMCP ghidra-mcp --ghidra-server http://127.0.0.1:8080/
ghidra-mcp は PyGhidra を使用して、Ghidra GUI を実行せずにバイナリ自体をインポートおよび解析することもできます。これには Python 3.10~3.13、Ghidra にインストールされた GhidraMCP 拡張機能(または --extension-jar /path/to/GhidraMCP.jar)、および GHIDRA_INSTALL_DIR を Ghidra 12.1.4 ディレクトリに設定する必要があります:
uvx --python 3.13 --from "ghidra-mcp[headless] @ git+https://github.com/LaurieWired/GhidraMCP" ghidra-mcp --headless --binary /path/to/target
上記のクライアント設定のいずれかで同じコマンドと引数を使用してください。実行間で Ghidra プロジェクトを保持(および変更を保存)するには --project DIR を追加します。macOS では、Ghidra ディレクトリから support/gradle/gradlew buildNatives を使用して Ghidra のデコンパイラを一度ビルドしてください。
GHIDRA_INSTALL_DIR を Ghidra 12.1.4 ディレクトリに設定cd extension && $GHIDRA_INSTALL_DIR/support/gradle/gradlew buildExtension
extension/dist/ に生成された zip ファイルには、ビルドされた Ghidra プラグインとそのリソースが含まれています。これらのファイルは Ghidra が新しい拡張機能を認識するために必要です。
Python MCP サーバーはチェックアウトから uv run ghidra-mcp で実行でき、uv run pytest でテストできます。