概要
- 静的解析ツールのMCP使ってみたよ~
- CursorでMCPを使ったよ~
- 簡単なセットアップ・使い方まとめ
- Ghidraは変数のrenameができるがBinary Ninjaはできない
Ghidra MCP編
構築
READMEに動画があるしほぼ詰まらず構築できるけど一応
Ghidra側
- githubのreleaseからzipをダウンロード
- Ghidraを起動しFile->Install Extensions->+ボタンを押して展開したzipファイル内にあるzipファイルを読み込ませる
- Ghidraを再起動
- CodeBrowserへ移動しFile->ConfigureでConfigure Toolウィンドウが表示されたら右上のプラグアイコン(Configure All Plugins)を選択
- GhidraMCPPluginにチェックを入れる(ここ動画に載ってなかったので注意)
Cursor側
Claude Desktopとかでもほぼ変わらんと思う
- 必要に応じてvenvを作成
-
pip install mcp==1.5 requests==2.32.3
(https://github.com/LaurieWired/GhidraMCP/blob/main/requirements.txt 参照) - mcp.jsonを設定する
- bridge_mcp_ghidra.pyは展開したzip内にあるので指定
- commandのpythonはvenvの場合など必要に応じて変更
{
"mcpServers": {
"ghidra": {
"command": "python",
"args": [
"/ABSOLUTE_PATH_TO/bridge_mcp_ghidra.py",
"http://127.0.0.1:8080/"
]
}
}
}
使ってみた
Binary Ninja MCP編
構築
- リポジトリをクローン
git clone https://github.com/Invoke-RE/binja-lattice-mcp.git
- venvを作成後
pip install -r requirements.txt
Binary Ninja側
- lattice_server_plugin.pyをプラグインディレクトリに移動
- windowsの場合AppData\Roaming\Binary Ninja\plugins (READMEがミスってる)
- Binary Ninjaを起動
ctrl + ,で設定を開きpython関連のパスをvenvのものに変更する
ctrl + pでRestart Binary Ninjaと入力し実行 - 適当な実行ファイルをBinary Ninjaで開く
- Plugins->Start Lattice Protocol Serverを選択
- Logにtokenが表示されるのでコピー
Cursor側
mcp.jsonを編集
{
"mcpServers": {
"binja-lattice-mcp": {
"command": "/path/to/venv/bin/python",
"args": ["/path/to/mcp_server.py"],
"env": {
"BNJLAT": "your_api_key_here"
}
}
}
}
"your_api_key_here"に先ほどコピーしたtokenを張り付ける
あとはcommandとmcp_server.pyのpathを修正する
使ってみた
検証に使用させていただいたバイナリ
IDA
環境構築
- python 3.11以降のバージョンを用意 & gitを使えるように
pip install --upgrade git+https://github.com/mrexodia/ida-pro-mcp
ida-pro-mcp --install
- 必要に応じてida側のpythonを変更
- IDAがインストールされているディレクトリへ移動
- idapyswitchを実行し3.11以降のバージョンを選択
比較
- Ghidraはxrefの参照ができないらしい https://x.com/PINKSAWTOOTH/status/1912032582579175929 (そのうちフォークが出るかも...?)
- Ghidraはコメント追加できない
- Binary Ninjaは変数や関数のリネームができない
- IDAは大体全部できる