IDA Pro MCP
IDA Pro MCP
简单的MCP 服务器允许在 IDA Pro 中进行氛围逆转。
https://github.com/user-attachments/assets/6ebeaa92-a9db-43fa-b756-eececce2aca0
视频的二进制文件和提示可在mcp-reversing-dataset存储库中找到。
可用功能:
check_connection():检查 IDA 插件是否正在运行。get_metadata():获取有关当前 IDB 的元数据。get_function_by_name(name):通过名称获取函数。get_function_by_address(address):通过地址获取函数。get_current_address():获取用户当前选择的地址。get_current_function():获取用户当前选择的函数。convert_number(text, size):将数字(十进制、十六进制)转换为不同的表示形式。list_functions(offset, count):列出数据库中的所有函数(分页)。list_globals_filter(offset, count, filter):列出数据库中匹配的全局变量(分页、过滤)。list_globals(offset, count):列出数据库中的所有全局变量(分页)。list_strings_filter(offset, count, filter):列出数据库中匹配的字符串(分页、过滤)。list_strings(offset, count):列出数据库中的所有字符串(分页)。decompile_function(address):反编译给定地址的函数。disassemble_function(start_address):获取函数的汇编代码(地址:指令;注释)。get_xrefs_to(address):获取对给定地址的所有交叉引用。get_xrefs_to_field(struct_name, field_name):获取对命名结构字段(成员)的所有交叉引用。get_entry_points():获取数据库中的所有入口点。set_comment(address, comment):为函数反汇编和伪代码中的给定地址设置注释。rename_local_variable(function_address, old_name, new_name):重命名函数中的局部变量。rename_global_variable(old_name, new_name):重命名全局变量。set_global_variable_type(variable_name, new_type):设置全局变量的类型。rename_function(function_address, new_name):重命名函数。set_function_prototype(function_address, prototype):设置函数的原型。declare_c_type(c_declaration):从 C 声明创建或更新本地类型。set_local_variable_type(function_address, variable_name, new_type):设置局部变量的类型。
不安全的功能(需要--unsafe标志):
dbg_get_call_stack():获取当前调用堆栈。dbg_get_registers():获取所有寄存器及其值。此函数仅在调试时可用。dbg_run_to(address):运行调试器到指定的地址。dbg_exit_process():退出调试器。dbg_continue_process():继续调试器。dbg_enable_breakpoint(address, enable):启用或禁用指定地址的断点。dbg_list_breakpoints():列出程序中的所有断点。dbg_set_breakpoint(address):在指定地址设置断点。dbg_delete_breakpoint(address):删除指定地址处的断点。dbg_start_process():启动调试器。
先决条件
Python ( 3.11 或更高版本)
使用
idapyswitch切换到最新的 Python 版本
IDA Pro (8.3 或更高版本,建议 9)
支持的 MCP 客户端(选择您喜欢的客户端)
其他 MCP 客户端:运行
ida-pro-mcp --config获取客户端的 JSON 配置。
Related MCP server: idalib-mcp-headless
安装
安装(或升级)IDA Pro MCP 包:
pip install --upgrade git+https://github.com/mrexodia/ida-pro-mcp配置 MCP 服务器并安装 IDA 插件:
ida-pro-mcp --install重要提示:请确保完全重启 IDA/Visual Studio Code/Claude,以使安装生效。Claude 在后台运行,您需要通过托盘图标退出。
https://github.com/user-attachments/assets/65ed3373-a187-4dd5-a807-425dca1d8ee9
快速工程
LLM 容易出现幻觉,所以你的提示需要具体。对于逆向工程来说,整数和字节之间的转换尤其成问题。下面是一个最简单的示例提示,如果你使用其他提示取得了不错的效果,欢迎随时发起讨论或提交问题:
你的任务是使用 IDA Pro 分析一个 Crackme 文件。你可以使用 MCP 工具来检索信息。一般来说,使用以下策略:
检查反编译并添加注释以说明您的发现
将变量重命名为更合理的名称
如有必要,更改变量和参数类型(尤其是指针和数组类型)
更改函数名称,使其更具描述性
如果需要更多详细信息,请拆解该函数并添加注释和您的发现
切勿自行转换进制。如有需要,请使用 convert_number MCP 工具!
不要尝试暴力破解,任何解决方案都只能通过反汇编和简单的 Python 脚本来获得。
创建一份 report.md,其中包含你的发现和最后采取的步骤
当你找到解决方案时,提示用户使用你找到的密码进行反馈
这个提示只是第一次实验,如果您找到了改进输出的方法,请分享!
提高法学硕士(LLM)准确性的技巧
大型语言模型 (LLM) 是强大的工具,但它们有时会难以处理复杂的数学计算,或出现“幻觉”(即虚构事实)。请务必告知 LLM 使用conver_number MCP,并且您可能还需要math-mcp进行某些操作。
另外需要注意的是,LLM 在处理混淆代码时效果不佳。在尝试使用 LLM 解决问题之前,请先检查一下二进制文件,并花些时间(自动)删除以下内容:
字符串加密
导入哈希
控制流平坦化
代码加密
反反编译技巧
您还应该使用 Lumina 或 FLIRT 之类的工具尝试解析所有开源库代码和 C++ STL,这将进一步提高准确性。
SSE 传输和无头 MCP
您可以运行 SSE 服务器来连接到用户界面,如下所示:
uv run ida-pro-mcp --transport http://127.0.0.1:8744/sse安装idalib后,您还可以运行无头 SSE 服务器:
uv run idalib-mcp --host 127.0.0.1 --port 8745 path/to/executable注意: idalib功能由Willi Ballenthin贡献。
手动安装
注意:本节适用于需要详细安装说明的 LLM 和高级用户。
手动安装 MCP 服务器(Cline/Roo 代码)
要自行安装 MCP 服务器,请按照以下步骤操作:
全局安装uv :
Windows:
pip install uvLinux/Mac:
curl -LsSf https://astral.sh/uv/install.sh | sh
克隆此存储库,例如
C:\MCP\ida-pro-mcp。导航到 Cline/Roo Code MCP 服务器配置(见屏幕截图)。
单击*“已安装*”选项卡。
单击配置 MCP 服务器,将打开
cline_mcp_settings.json。添加
ida-pro-mcp服务器:
{
"mcpServers": {
"github.com/mrexodia/ida-pro-mcp": {
"command": "uv",
"args": [
"--directory",
"c:\\MCP\\ida-pro-mcp",
"run",
"server.py",
"--install-plugin"
],
"timeout": 1800,
"disabled": false
}
}
}要检查连接是否有效,您可以执行以下工具调用:
<use_mcp_tool>
<server_name>github.com/mrexodia/ida-pro-mcp</server_name>
<tool_name>check_connection</tool_name>
<arguments></arguments>
</use_mcp_tool>IDA插件安装
MCP 服务器启动时,IDA Pro 插件将自动安装。如果您禁用了--install-plugin选项,请按照以下步骤操作:
将
src/ida_pro_mcp/mcp-plugin.py复制(而不是移动)到您的插件文件夹(Windows 上为%appdata%\Hex-Rays\IDA Pro\plugins)中。打开 IDB 并单击
Edit -> Plugins -> MCP来启动服务器。
与其他 MCP 服务器的比较
目前市面上有一些 IDA Pro MCP 服务器,但我出于以下几个原因创建了自己的服务器:
安装应完全自动化。
其他插件的架构使得快速添加新功能变得困难(太多不必要的依赖样板)。
学习新技术很有趣!
如果你想查看它们,这里有一个列表(按照我发现它们的顺序):
https://github.com/taida957789/ida-mcp-server-plugin (仅限 SSE 协议,需要在 IDAPython 中安装依赖项)。
https://github.com/fdrechsler/mcp-server-idapro(TypeScript中的 MCP 服务器,添加新功能需要过多的样板)。
https://github.com/MxIris-Reverse-Engineering/ida-mcp-server (自定义套接字协议,样板)。
请随意打开 PR 来在此处添加您的 IDA Pro MCP 服务器。
发展
添加新功能的过程非常简单流畅。您只需在mcp-plugin.py中添加一个新的@jsonrpc函数,即可在 MCP 服务器中使用,无需任何额外的样板代码!以下视频演示了我在不到 2 分钟的时间内(包括测试)添加get_metadata函数的过程:
https://github.com/user-attachments/assets/951de823-88ea-4235-adcb-9257e316ae64
要测试 MCP 服务器本身:
uv run mcp dev src/ida_pro_mcp/server.py这将在http://localhost:5173打开一个 Web 界面并允许您与 MCP 工具进行交互以进行测试。
为了测试,我创建了一个指向 IDA 插件的符号链接,然后直接向http://localhost:13337/mcp发送一个 JSON-RPC 请求。 启用符号链接后,您可以运行以下命令:
uv run ida-pro-mcp --install生成直接提交到main的变更日志:
git log --first-parent --no-merges 1.2.0..main "--pretty=- %s"Available Tools
43 toolscheck_connectionB
Check if the IDA plugin is running
Inputs: no named parameters.
convert_numberC
Convert a number (decimal, hexadecimal) to different representations
Inputs: size (required), text (required).
create_stack_frame_variableC
For a given function, create a stack variable at an offset and with a specific type
Inputs: function_address (required), offset (required), type_name (required), variable_name (required).
data_read_byteA
Read the 1 byte value at the specified address.
Only use this function if `get_global_variable_at` failed.
Inputs: address (required).
data_read_dwordA
Read the 4 byte value at the specified address as a DWORD.
Only use this function if `get_global_variable_at` failed.
Inputs: address (required).
data_read_qwordA
Read the 8 byte value at the specified address as a QWORD.
Only use this function if `get_global_variable_at` failed.
Inputs: address (required).
data_read_stringA
Read the string at the specified address.
Only use this function if `get_global_variable_at` failed.
Inputs: address (required).
data_read_wordA
Read the 2 byte value at the specified address as a WORD.
Only use this function if `get_global_variable_at` failed.
Inputs: address (required).
declare_c_typeC
Create or update a local type from a C declaration
Inputs: c_declaration (required).
decompile_functionC
Decompile a function at the given address
Inputs: address (required).
delete_stack_frame_variableC
Delete the named stack variable for a given function
Inputs: function_address (required), variable_name (required).
disassemble_functionC
Get assembly code for a function
Inputs: start_address (required).
get_calleesB
Get all the functions called (callees) by the function at function_address
Inputs: function_address (required).
get_callersC
Get all callers of the given address
Inputs: function_address (required).
get_current_addressB
Get the address currently selected by the user
Inputs: no named parameters.
get_current_functionB
Get the function currently selected by the user
Inputs: no named parameters.
get_defined_structuresC
Returns a list of all defined structures
Inputs: no named parameters.
get_entry_pointsB
Get all entry points in the database
Inputs: no named parameters.
get_function_by_addressC
Get a function by its address
Inputs: address (required).
get_function_by_nameC
Get a function by its name
Inputs: name (required).
get_global_variable_value_at_addressB
Read a global variable's value by its address (if known at compile-time)
Prefer this function over the `data_read_*` functions.
Inputs: ea (required).
get_global_variable_value_by_nameA
Read a global variable's value (if known at compile-time)
Prefer this function over the `data_read_*` functions.
Inputs: variable_name (required).
get_metadataB
Get metadata about the current IDB
Inputs: no named parameters.
get_stack_frame_variablesC
Retrieve the stack frame variables for a given function
Inputs: function_address (required).
get_xrefs_toC
Get all cross references to the given address
Inputs: address (required).
get_xrefs_to_fieldC
Get all cross references to a named struct field (member)
Inputs: field_name (required), struct_name (required).
list_functionsB
List all functions in the database (paginated)
Inputs: count (required), offset (required).
list_globalsB
List all globals in the database (paginated)
Inputs: count (required), offset (required).
list_globals_filterB
List matching globals in the database (paginated, filtered)
Inputs: count (required), filter (required), offset (required).
list_importsB
List all imported symbols with their name and module (paginated)
Inputs: count (required), offset (required).
list_local_typesB
List all Local types in the database
Inputs: no named parameters.
list_stringsC
List all strings in the database (paginated)
Inputs: count (required), offset (required).
list_strings_filterB
List matching strings in the database (paginated, filtered)
Inputs: count (required), filter (required), offset (required).
read_memory_bytesA
Read bytes at a given address.
Only use this function if `get_global_variable_at` and `get_global_variable_by_name`
both failed.
Inputs: memory_address (required), size (required).
rename_functionC
Rename a function
Inputs: function_address (required), new_name (required).
rename_global_variableC
Rename a global variable
Inputs: new_name (required), old_name (required).
rename_local_variableC
Rename a local variable in a function
Inputs: function_address (required), new_name (required), old_name (required).
rename_stack_frame_variableB
Change the name of a stack variable for an IDA function
Inputs: function_address (required), new_name (required), old_name (required).
set_commentB
Set a comment for a given address in the function disassembly and pseudocode
Inputs: address (required), comment (required).
set_function_prototypeC
Set a function's prototype
Inputs: function_address (required), prototype (required).
set_global_variable_typeC
Set a global variable's type
Inputs: new_type (required), variable_name (required).
set_local_variable_typeC
Set a local variable's type
Inputs: function_address (required), new_type (required), variable_name (required).
set_stack_frame_variable_typeC
For a given disassembled function, set the type of a stack variable
Inputs: function_address (required), type_name (required), variable_name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 43 tools
The tool set has clear functional groupings, but there is significant overlap between data reading tools (data_read_byte, data_read_word, etc.) and memory/global variable tools, with explicit guidance to prefer certain tools over others indicating ambiguity. Tools like list_functions and get_function_by_address serve distinct but related purposes that could cause confusion in selection.
Most tools follow a consistent verb_noun or verb_noun_preposition pattern (e.g., get_function_by_address, set_global_variable_type), with clear action-object naming. Minor deviations exist, such as convert_number (verb_noun) vs. declare_c_type (verb_noun), but overall the naming is predictable and readable across the set.
With 43 tools, the count is excessive for typical MCP server purposes, leading to potential cognitive overload and reduced usability. While IDA Pro is a complex domain, the tool surface could be consolidated (e.g., merging data_read_* variants) to improve coherence without losing functionality.
The tool set comprehensively covers IDA Pro's core functionalities, including disassembly, decompilation, data reading, variable and type management, cross-referencing, and metadata retrieval. It supports full CRUD/lifecycle operations for functions, variables, and types, with no obvious gaps for agent-driven analysis workflows.
Maintenance
Related MCP Connectors
MCP server for ScanMalware.com URL scanning, malware detection, and analysis.
MCP server for static security analysis of Android source code
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseBqualityFmaintenanceMCP server for reverse engineering that enables interaction with IDA Pro for analysis tasks such as decompilation, disassembly, and memory engagement reports.2446MIT
- FlicenseNot gradedqualityBmaintenanceA headless MCP server that manages multiple independent IDA Pro worker processes for reverse engineering, supporting database operations and debug tools.28-
- AlicenseNot gradedqualityDmaintenanceHeadless MCP server for IDA Pro enabling on-demand database loading and programmatic reverse engineering workflows via MCP tools.19MIT
- AlicenseNot gradedqualityCmaintenanceHeadless reverse engineering MCP server integrating IDA Pro for static analysis and x64dbg for dynamic debugging via controlled MCP tools.5GPL 3.0