
Headless IDA Pro MCP server for AI-assisted binary analysis, powered by idalib
ida-cli 是一个面向 macOS / Linux 的无界面 IDA CLI 与 skill-first 工具集。它会在运行时自动选择后端,在需要时自动拉起本地服务,并同时以 flat CLI、stdio MCP、Streamable HTTP MCP 三种方式暴露相同的能力。
ida-cli 二进制(一个可执行文件同时承担客户端和服务端角色)ida-cli skill(skill/SKILL.md)底层的 worker / router 服务层由 CLI 自动拉起和回收。只有当你真的需要一个常驻、对外可寻址的服务时,才手动跑 serve / serve-http。
后端选择由 probe-runtime 在运行时决定。编译期仍然需要 IDA SDK,因为 vendored native 层要参与编译;运行时实际加载的 IDA 本体来自 IDADIR 或常见安装路径。
在支持的 IDA 9.x 运行时上,ida-cli 可以:
.i64read_* 和 convert_number 系列辅助run_script 执行 IDAPython 片段还没对齐的:idat-compat 下部分写入 / 高级类型编辑操作仍是部分支持。完整工具清单见 docs/TOOLS.md。
默认入口是 ida-cli skill,而不是手动装 CLI。
# 查看这个仓库暴露出来的 skill
npx -y skills add https://github.com/cpkt9762/ida-cli --list
# 给 Codex 安装 ida-cli skill
npx -y skills add https://github.com/cpkt9762/ida-cli --skill ida-cli --agent codex --yes --global
skill 自带一个 bootstrap wrapper:
~/.agents/skills/ida-cli/scripts/ida-cli.sh --help
~/.agents/skills/ida-cli/scripts/ida-cli.sh probe-runtime
~/.agents/skills/ida-cli/scripts/ida-cli.sh --path /path/to/binary list-functions --limit 20
如果本机没有 ida-cli,wrapper 会先跑仓库里的安装脚本再转发命令。
如果你确定要单独使用 CLI,而不是通过 skill:
curl -fsSL https://raw.githubusercontent.com/cpkt9762/ida-cli/master/scripts/install.sh | bash -s -- --add-path
常见变体:
# 安装指定版本
curl -fsSL https://raw.githubusercontent.com/cpkt9762/ida-cli/master/scripts/install.sh | bash -s -- --tag v0.9.3 --add-path
# 直接从分支 / 提交源码构建
curl -fsSL https://raw.githubusercontent.com/cpkt9762/ida-cli/master/scripts/install.sh | bash -s -- --ref master --build-from-source --add-path
说明:
~/.local/bin/ida-cli--add-path 会把这个目录追加到当前 shell 的 rc 文件IDASDKDIR / IDALIB_SDK,安装器会自动拉取开源 HexRaysSA/ida-sdkIDADIRgit clone https://github.com/cpkt9762/ida-cli.git
cd ida-cli
export IDADIR="/Applications/IDA Professional 9.4.app/Contents/MacOS" # 或 Linux 安装目录
export IDASDKDIR="/path/to/ida-sdk" # 根目录或 ida-sdk/src 都可
cargo build --bin ida-cli
./target/debug/ida-cli --help
ida-cli 是 client-first 的:任意客户端子命令都会自动在本地起一个 Streamable HTTP 服务器(随机端口),并通过 /tmp/ida-cli.socket 发现真实的 socket:
./target/debug/ida-cli --path /path/to/sample.bin list-functions --limit 20
./target/debug/ida-cli --path /path/to/sample.bin decompile --addr 0x140001000
./target/debug/ida-cli --path /path/to/sample.bin raw '{"method":"get_xrefs_to","params":{"address":"0x140001000"}}'
第一个参数是服务端子命令(serve / serve-http / serve-worker / probe-runtime)时,进入服务端模式:
./target/debug/ida-cli serve # stdio MCP
./target/debug/ida-cli serve-http --bind 127.0.0.1:8765
./target/debug/ida-cli probe-runtime
后端 probe 的典型输出:
{"runtime":{"major":9,"minor":1,"build":250226},"backend":"idat-compat","supported":true,"reason":null}
{"runtime":{"major":9,"minor":4,"build":260610},"backend":"native-linked","supported":true,"reason":null}
完整 CLI 使用方式见 skill/references/cli-tool-reference.md。
IDADIR 指定 IDA 安装目录(运行时最低要求 IDA 9.0)IDASDKDIR 或 IDALIB_SDK 指定 IDA SDKSDK 支持两种布局:
/path/to/ida-sdk/path/to/ida-sdk/srcidat-compatIDA 9.0–9.2 的兼容后端。通过 idat 启动批处理脚本,跑 IDAPython,把结构化 JSON 返回给 CLI 运行时。
native-linkedIDA 9.3+ 的原生后端。直接链接 vendored idalib 在进程内打开数据库。
~/.ida/idb/~/.ida/logs/server.log~/.ida/server.sock~/.ida/server.pid/tmp/ida-cli.socket/tmp/ida-cli-out/GitHub Actions 在 Hosted Runner 上通过开源 HexRaysSA/ida-sdk 做编译和测试,不依赖私有机器的固定路径。
当前工作流:
master 上的 push / pull request 跑校验v0.9.3)构建 Linux / macOS release 资产install.sh 和各平台压缩包release 二进制是用 SDK stub 构建出来的;真正启动时,install.sh 生成的 launcher 会优先通过 IDADIR 或常见安装路径解析你本机的 IDA 运行时。
MIT
| IDA 版本 | 后端 | 说明 |
|---|
< 9.0 | 不支持 | — |
9.0 – 9.2 | idat-compat | 通过 idat + IDAPython 兼容 |
9.3+ | native-linked | 链接 vendored idalib 直接进程内打开 |