radare2-mcp-server logo

radare2-mcp-server

Community
darallium

r2-copilot は、強力なリバースエンジニアリングフレームワークである radare2 のための Multi-Agent Collaboration Protocol (MCP) サーバーです。

Publisherdarallium
Repositoryr2-copilot
LanguagePython
Forks
1
Stars
15
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    radare2-mcp-server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    15 stars and 1 forks from the linked repository.

English is Same

r2-copilot

asciicast r2-copilot は、強力なリバースエンジニアリングフレームワークである radare2 のための Multi-Agent Collaboration Protocol (MCP) サーバーです。

このリポジトリはサードパーティーツールになります。オフィシャルのmcpツールは以下になります。

インストール

※ r2pmに追加してもらえました!r2pm -Uci r2-copilotでインストール可能です。

セルフビルドする場合

  1. リポジトリのクローン
bash

cd r2-copilot
  1. 依存関係のインストール プロジェクトでは uv を使用して依存関係を管理しています。
bash
uv sync

radare2のインストール

r2pipe が正しく動作するためには、radare2 がシステムにインストールされている必要があります。

bash
mkdir -p ~/.local/src/
cd ~/.local/src/
git clone https://github.com/radareorg/radare2 --depth 1
radare2/sys/install.sh

windowsの場合、ビルド済みバイナリをダウンロードしてきてPATHを通す方が早いです。

see. https://github.com/radareorg/radare2

使用方法

サーバーを起動するには、次のコマンドを実行します。

bash
./start.sh

これにより、標準入出力(stdio)を介して通信する MCP サーバーが起動します。 サーバーは、クライアントからのリクエストを待ち受け、radare2 のコマンドを実行し、結果を返します。

gemini-cliで利用するには、 ~/.gemini/settings.json を以下の通りに追記してください。

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等を利用する場合は具体的なコマンドを暗記する必要はなく、自然減での入力が推奨されます。

  1. セッションの開始

まず、解析対象のファイルに対して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 は、後続の全てのコマンドで必要になります。

  1. 初期静的解析(情報収集)

セッションが開始されたら、バイナリの基本的な情報を収集します。これらのコマンドは並行して実行可能です。

  • バイナリの基本情報を取得: 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のような危険な関数の有無は重要な指標です)

  1. 詳細解析

次に、radare2の強力な自動解析機能を実行します。これにより、関数、基本ブロック、コードの相互参照などが特定されます。

コマンド: analyze_all(session_id='<session_id>')

Note: この処理は、バイナリのサイズによっては時間がかかる場合があります。

  1. 関数の調査

自動解析が完了したら、特定された関数をリストアップし、プログラムの全体像を把握します。

  • 関数一覧の表示: list_functions(session_id='<session_id>')

  • 特定の関数の逆アセンブル: disassemble_function(session_id='<session_id>', address='<関数名 or アドレス>') (例えば、プログラムの起点であるmain関数を調べるには address='sym.main' を指定します)

  1. 高度な操作(生コマンドの実行)

より複雑な調査や、特定のツールが期待通りに動作しない場合、execute_command を使用してradare2の任意のコマンドを直接実行できます。

コマンド: execute_command(session_id='<session_id>', command='<radare2コマンド>')

python
# "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 コマンドを実行します。

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "darallium-radare2-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

Use radare2-mcp-server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once radare2-mcp-server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add radare2-mcp-server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the radare2-mcp-server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "darallium-radare2-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "r2_copilot"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the radare2-mcp-server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the radare2-mcp-server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use radare2-mcp-server to help me with this task?
radare2-mcp-server
Sure. I read it.
Here is what I found using radare2-mcp-server.

Frequently asked questions

What is the radare2-mcp-server MCP server used for?

radare2-mcp-server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use radare2-mcp-server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use radare2-mcp-server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use radare2-mcp-server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With radare2-mcp-server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect radare2-mcp-server MCP to TypingMind?

radare2-mcp-server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does radare2-mcp-server MCP provide in TypingMind?

radare2-mcp-server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use radare2-mcp-server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If radare2-mcp-server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇