RR

radareorg/radare2-mcp

开发工具官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

340 stars 42 forks 质量 81 趋势 35MIT

radareorg/radare2-mcp 是从 https://github.com/radareorg/radare2-mcp. 导入的 MCP 服务器候选

概览

radareorg/radare2-mcp 是从 https://github.com/radareorg/radare2-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一个MCP服务器,用于将radare2与OpenCode、Mai、VSCode、Claude、CLION等AI代理配合使用。

特色

该实现提供了:

  • 💻 完全用C语言编写,使用原生r2 API
  • 🧩 可通过CLI运行,作为r2插件和MCP服务器
  • 🔍 与radare2实现无缝二分分析
  • 🔗 通过 r2pipe 连接到任何本地或远程的 r2/iaito 会话
  • 🔒 支持只读模式、沙箱锁定和限制工具
  • 🔩 细粒刀具配置
  • 🔁 直接标准/标准化通信模型
  • 🌐 HTTP MCP 服务器模式,支持可选的 X-Session-ID 复用
  • 🛠️ 可选的原始访问,可运行 r2 命令或 r2js 脚本

安装

使用 r2pm

安装该软件包最简单的方法是使用 r2pm:

r2mcp 可执行文件会被复制到你家目录中的 r2pm bindir 中。然而,这个二进制文件不应直接从壳层执行;它只有在你选择的语言模型的 MCP 服务处理器启动时才会工作。

这是常见的mcpServer JSON配置文件:

法典

安装Codex插件只需执行以下命令:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Radare2 MCP Server

An MCP server to use radare2 with AI agents such as OpenCode, Mai, VSCode, Claude, CLION, …

Features

This implementation provides:

  • 💻 Fully written in C using the native r2 APIs
  • 🧩 Works from the CLI, as an r2 plugin and as an MCP server
  • 🔍 Seamless binary analysis with radare2
  • 🔗 Connect to any local or remote r2/iaito session via r2pipe
  • 🔒 Supports readonly mode, sandbox lock and restrict tools
  • 🔩 Fine grained tools configuration
  • 🔁 Direct stdin/stdout communication model
  • 🌐 HTTP MCP server mode with optional X-Session-ID multiplexing
  • 🛠️ Optional raw access to run r2 commands or r2js scripts

Installation

Using r2pm

The simplest way to install the package is by using r2pm:

$ r2pm -Uci r2mcp

The r2mcp executable will be copied into r2pm’s bindir in your home directory. However, this binary is not supposed to be executed directly from the shell; it will only work when launched by the MCP service handler of your language model of choice.

$ r2pm -r r2mcp

That’s the common mcpServer JSON configuration file:

{
  "mcpServers": {
    "radare2": {
      "command": "r2pm",
      "args": ["-r", "r2mcp"]
    }
  }
}

Codex

To install the codex plugin just run the following command:

make codex-plugin-install

This will create a personal marketplace in your home and copy the files from dist/codex-plugin inside.

Using Docker

Alternatively, you can build the Docker image:

docker build -t r2mcp .

Update your MCP client configuration file (see below) to use the Docker image to use:

  • "command": "docker"
  • "args": ["run", "--rm", "-i", "-v", "/tmp/data:/data", "r2mcp"].

Configuration

HTTP Server Mode

Use -H [address:]port to run r2mcp as an HTTP MCP server instead of using stdin/stdout. A bare port binds only to 127.0.0.1; use 0.0.0.0:port explicitly to make the server reachable from the network:

r2mcp -H 8765
# Public binding; protect this with -a  or -A.
r2mcp -H 0.0.0.0:8765 -A

Per-session HTTP state is enabled with -X max[:idle_seconds] and routed by the X-Session-ID request header:

r2mcp -H 8765 -X 8:600

HTTP bearer authentication is enabled with -a . Clients must send Authorization: Bearer on every GET and POST request:

在 GitHub 查看完整 README

安装

docker run --rm -i -v /tmp/data:/data r2mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "radare2": { "command": "r2pm", "args": ["-r", "r2mcp"] } } }