基于 name333/idapromcp_333,解决了依赖安装和 Python 兼容性问题。
| 组件 | 版本 |
|---|---|
| IDA Pro | 7.x-8.x (已在 8.4 上测试) |
| IDA Python | 3.9+ |
| MCP Server Python | 3.11+ |
通过 MCP(模型上下文协议)将 LLM 客户端连接到 IDA Pro,以实现以下功能:
此版本修复了原始项目中的以下问题:
requirements.txtfrom __future__ import annotationstyping_extensions.NotRequired基于原始版本 mrexodia/ida-pro-mcp,由 name333/idapromcp_333 增强。
混淆检测增强:
算法识别增强:
报告生成:
动态分析:
其他:
采用双 Python 环境以避免版本冲突:
注意:不要切换 IDA Pro 的 Python 版本,否则可能导致 IDA 无法启动。
# 1. 克隆项目
git clone https://github.com/cybermaxluo/IDAProMCP_Max.git
cd IDAProMCP_Max/
# 2. 安装依赖(使用独立 Python 3.12,而不是 IDA Pro 的 Python)
# 将下面的路径替换为您系统的实际 Python 3.12 路径
# macOS (Miniconda) 示例
/opt/miniconda3/bin/python3.12 -m pip install -r requirements.txt
/opt/miniconda3/bin/python3.12 -m pip install -e .
# macOS (Homebrew) 示例
/usr/local/bin/python3.12 -m pip install -r requirements.txt
/usr/local/bin/python3.12 -m pip install -e .
# Windows
C:\Python312\python.exe -m pip install -r requirements.txt
C:\Python312\python.exe -m pip install -e .
# Linux
/usr/bin/python3.12 -m pip install -r requirements.txt
/usr/bin/python3.12 -m pip install -e .
# 3. 安装 IDA Pro 插件和 LLM 客户端配置
# macOS 示例(替换为您的实际路径)
/opt/miniconda3/bin/python3.12 -m ida_pro_mcp.server --install
# Windows
C:\Python312\python.exe -m ida_pro_mcp.server --install
# Linux
/usr/bin/python3.12 -m ida_pro_mcp.server --install
这将自动完成:
~/.idapro/plugins/mcp-plugin.py~/.cursor/mcp.json)# 或者使用一键安装脚本(需要先编辑脚本中的 Python 路径)
chmod +x install.sh
./install.sh
安装后会自动生成配置文件或手动创建:
MacOS 示例 (~/.cursor/mcp.json):
{
"mcpServers": {
"ida-pro-mcp": {
"command": "python3.12",
"args": ["-m", "ida_pro_mcp.server"],
"timeout": 1800,
"disabled": false
}
}
}
注意:将
python3.12替换为您系统的完整路径,例如/opt/miniconda3/bin/python3.12
Windows 示例:
{
"mcpServers": {
"ida-pro-mcp": {
"command": "C:\\Python312\\python.exe",
"args": [
"-m",
"ida_pro_mcp.server"
],
"timeout": 1800,
"disabled": false
}
}
}
cd ~/tools/idapromcp_333
python3 test_plugin.py
预期输出:
🧪 IDA Pro MCP 插件测试套件
✅ 通过: 语法检查
✅ 通过: 模块导入
✅ 通过: Python 版本
✅ 通过: MCP 服务器
总计: 4/4 测试通过
🎉 所有测试通过!
# 检查依赖是否安装成功(使用独立 Python)
/opt/miniconda3/bin/python3.12 -c "import mcp; print(f'MCP 版本: {mcp.__version__}')"
# 检查 IDA 插件是否安装
# macOS
ls -la ~/.idapro/plugins/mcp-plugin.py
# Windows
dir "%APPDATA%\Hex-Rays\IDA Pro\plugins\mcp-plugin.py"
# 测试插件语法(Python 3.9)
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3 -m py_compile ~/.idapro/plugins/mcp-plugin.py
┌─────────────────┐ ┌──────────────────┐ ┌─────────────┐
│ LLM 客户端 │ │ MCP 服务器 │ │ IDA Pro │
│ (Cursor/Cline) │ ◄─────► │ (Python 3.12) │ ◄─────► │ 插件(3.9) │
└─────────────────┘ stdio └──────────────────┘ HTTP └─────────────┘
:13337
Ctrl+Alt+M(macOS: Ctrl+Option+M)Edit -> Plugins -> MCP您应该看到:
[MCP] 服务器已启动: http://127.0.0.1:13337
打开客户端如 cursor/Line 并输入命令:
请连接到 IDA Pro 并获取当前分析的二进制文件信息
MCP 服务器将自动连接到 IDA Pro 插件(端口 13337)并执行操作。
# 检查连接
请检查 IDA Pro 连接状态
# 获取元数据
获取当前 IDB 的基本信息
# 列出函数
列出前 100 个函数
# 函数分析
分析函数 sub_401000,包括:
1. 参数和返回值分析
2. 控制流程说明
3. 算法识别
4. 混淆和反调试检测
# 批量重命名
对所有 sub_ 开头的函数进行智能重命名
# 生成报告
生成完整的结构化分析报告
# 检测单个函数
检测函数 sub_401234 的混淆特征
# 全局扫描
扫描所有函数,找出使用混淆的函数列表
# 识别加密算法
分析函数 sub_405000,识别使用的加密算法
# 批量识别
对所有函数进行算法特征扫描
可能原因:Python 版本切换错误
解决方法:
# 恢复到 Python 3.9
cd "/Applications/IDA Pro 8.4/ida64.app/Contents/MacOS"
./idapyswitch -s /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Python3
检查清单:
Ctrl+Alt+M 启动插件调试方法:
# 查看端口是否监听
lsof -i :13337
# 测试连接
curl http://127.0.0.1:13337/mcp
原因:使用 Python 3.9 安装依赖
解决方法:
# 必须使用 Python 3.11+ 安装 MCP 依赖
/opt/miniconda3/bin/python3.12 -m pip install -r requirements.txt
# 不要使用 IDA Pro 的 Python 3.9
已在本版本中修复,使用 typing-inspection>=0.4.0
安装 Python 3.12:
macOS (Homebrew):
brew install python@3.12
macOS (Miniconda):
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash Miniconda3-latest-MacOSX-arm64.sh
Windows:
Linux (Ubuntu/Debian):
sudo apt update
sudo apt install python3.12 python3.12-pip
| 客户端 | 配置文件路径(macOS) |
|---|---|
| Cursor | ~/.cursor/mcp.json |
| Cline | VSCode 扩展设置 |
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| Claude Code | ~/.claude.json |
Windows 路径将 ~ 替换为 %USERPROFILE%
idapromcp_333/
├── 📄 README.md # 主文档(本文档)
├── 📄 CHANGELOG.md # 详细更新日志
├── 📄 TESTING.md # 测试指南
├── 📄 SUMMARY.md # 修复总结
├── 🔧 test_plugin.py # 自动测试脚本 ⭐
├── 🔧 install.sh # 自动安装脚本
├── 📦 requirements.txt # Python 依赖(修复版)
├── 📄 pyproject.toml # 项目配置
├── 📁 src/
│ └── ida_pro_mcp/
│ ├── __init__.py
│ ├── server.py # MCP 服务器(Python 3.12)
│ ├── idalib_server.py # IDALib 服务器(独立模式)
│ └── mcp-plugin.py # ✅ IDA Pro 插件(Python 3.9 兼容)
├── 📁 build/ # 构建输出
└── 📄 LICENSE # MIT 协议
python -m ida_pro_mcp.server [options]
选项:
--install 安装 MCP 服务器和 IDA 插件
--uninstall 卸载 MCP 服务器和 IDA 插件
--transport PROTOCOL 指定通信协议 (stdio | http://host:port)
--ida-rpc URL 指定 IDA RPC 服务器地址 (默认: http://127.0.0.1:13337)
--unsafe 启用不安全函数(调试器操作等)
--config 生成 MCP 配置 JSON
export IDA_HOST="127.0.0.1"
export IDA_PORT="13337"
export MCP_LOG_LEVEL="DEBUG"
如果端口 13337 被占用:
mcp-plugin.py:202):PORT = 13338 # 更改为其他端口
python -m ida_pro_mcp.server --ida-rpc http://127.0.0.1:13338
欢迎提交 Issue 和 Pull Requests!
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)