r2-copilot
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@r2-copilot Analyze the binary at /tmp/vuln and show functions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
English is Same
r2-copilot
r2-copilot は、強力なリバースエンジニアリングフレームワークである radare2 のための Multi-Agent Collaboration Protocol (MCP) サーバーです。
このリポジトリはサードパーティーツールになります。オフィシャルのmcpツールは以下になります。
r2mcp - the official radare2 mcp
r2ai - the official r2ai
インストール
※ r2pmに追加してもらえました!r2pm -Uci r2-copilotでインストール可能です。
Related MCP server: ReVa
セルフビルドする場合
リポジトリのクローン
cd r2-copilot依存関係のインストール プロジェクトでは
uvを使用して依存関係を管理しています。
uv syncradare2のインストール
r2pipe が正しく動作するためには、radare2 がシステムにインストールされている必要があります。
mkdir -p ~/.local/src/
cd ~/.local/src/
git clone https://github.com/radareorg/radare2 --depth 1
radare2/sys/install.shwindowsの場合、ビルド済みバイナリをダウンロードしてきてPATHを通す方が早いです。
see. https://github.com/radareorg/radare2
使用方法
サーバーを起動するには、次のコマンドを実行します。
./start.shこれにより、標準入出力(stdio)を介して通信する MCP サーバーが起動します。 サーバーは、クライアントからのリクエストを待ち受け、radare2 のコマンドを実行し、結果を返します。
gemini-cliで利用するには、 ~/.gemini/settings.json を以下の通りに追記してください。
{
/*
...
*/
"mcpServers": {
/*
...
*/
"r2-copilot": {
"command": "r2pm",
"args": ["-r", "r2mcp"]
/* セルフビルドの場合で、uv使ってない人はこれ
"command": "/path/to/r2-copilot/start.sh"
/*
/* uvを使ってる場合はこっちの方がパフォーマンス出ると思います
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/r2-copilot",
"r2copilot"
]
*/
}
}解析ワークフロー
一般的なバイナリ解析は、以下のステップで進めることが推奨されます。 なお、gemini-cli等を利用する場合は具体的なコマンドを暗記する必要はなく、自然減での入力が推奨されます。
セッションの開始
まず、解析対象のファイルに対してradare2セッションを開始します。これにより、以降の操作で参照するセッションIDが発行されます。
コマンド:
create_session(file_path='<ファイルへの絶対パス>')
例:
/home/kali/ctf/iris/sqlate/vuln を解析する場合
print(default_api.create_session(file_path='/home/kali/ctf/iris/sqlate/vuln'))
Note: このコマンドの応答に含まれる session_id は、後続の全てのコマンドで必要になります。
初期静的解析(情報収集)
セッションが開始されたら、バイナリの基本的な情報を収集します。これらのコマンドは並行して実行可能です。
バイナリの基本情報を取得:
get_binary_info(session_id='<session_id>')(アーキテクチャ、ビット数、ファイル形式などを確認します)セキュリティ機構の確認:
check_security(session_id='<session_id>')(NX, PIE, Canaryなどの緩和機能が有効かを確認します)文字列のリストアップ:
get_strings(session_id='<session_id>')(バイナリに埋め込まれた文字列を抽出し、プログラムの機能や目的を推測する手がかりを探します)インポート関数のリストアップ:
get_imports(session_id='<session_id>')(外部ライブラリからどの関数を呼び出しているかを確認します。systemやstrcpyのような危険な関数の有無は重要な指標です)
詳細解析
次に、radare2の強力な自動解析機能を実行します。これにより、関数、基本ブロック、コードの相互参照などが特定されます。
コマンド:
analyze_all(session_id='<session_id>')
Note: この処理は、バイナリのサイズによっては時間がかかる場合があります。
関数の調査
自動解析が完了したら、特定された関数をリストアップし、プログラムの全体像を把握します。
関数一覧の表示:
list_functions(session_id='<session_id>')特定の関数の逆アセンブル:
disassemble_function(session_id='<session_id>', address='<関数名 or アドレス>')(例えば、プログラムの起点であるmain関数を調べるには address='sym.main' を指定します)
高度な操作(生コマンドの実行)
より複雑な調査や、特定のツールが期待通りに動作しない場合、execute_command を使用してradare2の任意のコマンドを直接実行できます。
コマンド:
execute_command(session_id='<session_id>', command='<radare2コマンド>')
# "login" という文字列を名前に含む関数を検索する
print(default_api.execute_command(command='afl | grep login', session_id='...'))API リファレンス
サーバーは、以下のツールを公開しており、それぞれが特定の radare2 の機能に対応しています。
セッション管理
create_session: 新しい radare2 セッションを開始します。list_sessions: アクティブなセッションを一覧表示します。close_session: セッションを閉じます。switch_session: 現在のセッションを切り替えます。
解析
analyze_all: バイナリ全体を解析します (aa)。analyze_function: 特定のアドレスの関数を解析します (af)。list_functions: 解析された関数を一覧表示します (afl)。get_function_info: 関数の詳細情報を取得します (afi)。get_xrefs_to: 特定のアドレスへのクロスリファレンスを取得します (axt)。get_xrefs_from: 特定のアドレスからのクロスリファレンスを取得します (axf)。
バイナリ情報
get_binary_info: バイナリに関する包括的な情報を取得します (iI)。get_sections: セクションを一覧表示します (iS)。get_symbols: シンボルを一覧表示します (is)。get_strings: 文字列を一覧表示します (iz,izz)。get_imports: インポートされた関数を一覧表示します (ii)。get_entrypoint: エントリポイントを取得します (ie)。check_security: セキュリティ機能(NX, PIE など)を確認します。
ディスアセンブリ
disassemble: 命令をディスアセンブルします (pd)。disassemble_function: 関数全体をディスアセンブルします (pdf)。print_hex: 16進ダンプを表示します (px)。print_string: アドレスにある文字列を表示します (psz)。
ナビゲーション
seek: 特定のアドレスに移動します (s)。seek_relative: 相対的に移動します。get_current_address: 現在のアドレスを取得します。set_block_size: ブロックサイズを設定します (b)。
検索
search_bytes: バイトパターンを検索します (/x)。search_string: 文字列を検索します (/)。search_rop_gadgets: ROP ガジェットを検索します (/R)。
書き込み
write_hex: 16進数値を書き込みます (wx)。write_assembly: アセンブリ命令を書き込みます (wa)。write_nop: NOP 命令を書き込みます。
デバッガ
continue_execution: プログラムの実行を継続します (dc)。step_into: ステップイン実行します (ds)。step_over: ステップオーバー実行します (dso)。set_breakpoint: ブレークポイントを設定します (db)。list_breakpoints: ブレークポイントを一覧表示します。get_registers: レジスタの値を取得します (dr)。set_register: レジスタの値を設定します。
フラグ
list_flags: フラグ(ラベル)を一覧表示します (f)。create_flag: フラグを作成します。
設定
get_config: 設定値を取得します (e)。set_config: 設定値を設定します。execute_command:生の radare2 コマンドを実行します。
Available Tools
43 toolsanalyze_allB
Perform complete analysis of the binary (aa). Analyzes functions, basic blocks, and cross-references.
Inputs: session_id. Returns: result
analyze_functionC
Analyze function at current or specified address (af).
Args: address: Address or symbol (e.g., "0x401000", "sym.main") session_id: Session to use
Inputs: address, session_id. Returns: result
check_securityC
Check binary security features (NX, PIE, Canary, etc.).
Inputs: session_id. Returns: result
close_sessionC
Close a Radare2 session.
Inputs: session_id (required). Returns: result
continue_executionC
Continue program execution (dc).
Inputs: session_id. Returns: result
create_flagC
Create a flag/label at address (f name @ addr).
Inputs: name (required), address (required), size, session_id. Returns: result
create_sessionC
Create a new Radare2 session.
Args: file_path: Path to binary file to analyze pid: Process ID to attach to write_mode: Enable write mode debug_mode: Enable debugger mode session_name: Optional session name (auto-generated if not provided)
Returns: Session information
Inputs: pid, file_path, debug_mode, write_mode, +1 more. Returns: Radare2 session information.
disassembleB
Disassemble N instructions (pd).
Args: count: Number of instructions to disassemble address: Starting address or symbol session_id: Session to use
Inputs: count, address, session_id. Returns: result
disassemble_functionC
Disassemble entire function (pdf).
Inputs: address, session_id. Returns: result
execute_commandB
Execute raw Radare2 command. Use this for commands not yet wrapped by specific tools.
Inputs: command (required), session_id, json_output.
get_binary_infoC
Get comprehensive binary information (iI).
Inputs: session_id. Returns: result
get_configD
Get configuration value(s) (e).
Inputs: key, session_id.
get_current_addressD
Get current address.
Inputs: session_id. Returns: result
get_entrypointC
Get binary entrypoint (ie).
Inputs: session_id. Returns: result
get_function_infoC
Get detailed information about a function (afi).
Inputs: address, session_id. Returns: result
get_importsC
Get imported functions (ii).
Inputs: session_id. Returns: result
get_registersC
Get register values (dr).
Inputs: session_id. Returns: result
get_sectionsD
Get binary sections (iS).
Inputs: session_id. Returns: result
get_stringsC
Get strings from binary (iz/izz).
Inputs: session_id, data_section_only. Returns: result
get_symbolsC
Get binary symbols (is).
Inputs: session_id, exports_only, imports_only. Returns: result
get_xrefs_fromC
Get cross references from an address (axf).
Inputs: address (required), session_id. Returns: result
get_xrefs_toC
Get cross references to an address (axt).
Inputs: address (required), session_id. Returns: result
list_breakpointsC
List all breakpoints.
Inputs: session_id. Returns: result
list_flagsD
List flags/labels (f).
Inputs: space, session_id. Returns: result
list_functionsC
List all analyzed functions (afl).
Inputs: session_id. Returns: result
list_sessionsB
List all active Radare2 sessions.
Inputs: no named parameters. Returns: result
print_hexC
Print hexdump (px).
Inputs: size, address, session_id. Returns: result
print_stringC
Print string at address (psz).
Inputs: address (required), length, session_id. Returns: result
search_bytesC
Search for byte pattern (/x). Pattern should be hex string like "909090" or "\x90\x90"
Inputs: pattern (required), to_addr, from_addr, session_id. Returns: result
search_rop_gadgetsC
Search for ROP gadgets (/R). Example: ["pop eax", "ret"]
Inputs: instructions (required), max_length, session_id. Returns: result
search_stringD
Search for string (/).
Inputs: text (required), to_addr, from_addr, session_id, +1 more. Returns: result
seekC
Seek to address or symbol (s). Returns new position.
Inputs: address (required), session_id. Returns: result
seek_relativeC
Seek relative to current position.
Inputs: offset (required), session_id. Returns: result
set_block_sizeC
Set block size (b).
Inputs: size (required), session_id. Returns: result
set_breakpointD
Set breakpoint (db).
Inputs: address (required), session_id. Returns: result
set_configC
Set configuration value (e key=value).
Inputs: key (required), value (required), session_id. Returns: result
set_registerC
Set register value (dr reg=value).
Inputs: value (required), register (required), session_id. Returns: result
step_intoD
Step into (single step) (ds).
Inputs: session_id. Returns: result
step_overD
Step over (dso).
Inputs: session_id. Returns: result
switch_sessionC
Switch to a different session.
Inputs: session_id (required). Returns: result
write_assemblyC
Write assembly instruction (wa). Example: "jmp 0x401000"
Inputs: assembly (required), address, session_id. Returns: result
write_hexC
Write hex values (wx). Data should be hex string like "909090"
Inputs: data (required), address, session_id. Returns: result
write_nopD
Write NOP instructions.
Inputs: count, address, session_id. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 43 tools
Most tools target clearly distinct resources and actions, e.g. get_xrefs_to vs get_xrefs_from, search_bytes vs search_string vs search_rop_gadgets, and write_hex vs write_assembly vs write_nop. The generic execute_command overlaps with many specialized tools, and disassemble vs disassemble_function could be confused, but descriptions clarify scope.
All tool names use predictable snake_case, with a consistent verb_noun or verb_object pattern throughout (e.g. create_session, list_functions, set_register, search_bytes). Minor verb variety reflects domain actions rather than naming inconsistency.
At 43 tools, the surface is well above the typical 3-15 range and risks overwhelming an agent with many niche radare2 wrappers. Since execute_command already provides a raw fallback, some specific wrappers could likely be consolidated or omitted.
Core workflows are covered across sessions, analysis, disassembly, search, writes, and execution, but lifecycle gaps remain: no delete_breakpoint or disable_breakpoint, no delete_flag, and no call-stack/frame inspection. execute_command can work around these gaps, but the native tool surface is not fully complete.
Maintenance
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseAqualityCmaintenanceA multi-backend MCP server that exposes binary analysis capabilities from IDA Pro and Ghidra, allowing LLMs to directly drive reverse-engineering tools via natural language.11181Apache 2.0
- AlicenseNot gradedqualityAmaintenanceA Ghidra MCP server that enables AI language models to interact with Ghidra for reverse engineering tasks, providing small, context-efficient tools to reduce hallucination and handle large binaries.426 PyPI965Apache 2.0
- AlicenseNot gradedqualityBmaintenanceAn enterprise-grade MCP server for AI-powered reverse engineering. Enables AI agents to perform comprehensive binary analysis through natural language commands.115 PyPI224MIT
- FlicenseNot gradedqualityDmaintenanceA PyGhidra-based MCP server that exposes Ghidra's reverse engineering capabilities to AI agents, enabling binary analysis via tools like overview, search, view, list, edit, script execution, and version control.1-