Skip to main content
Glama

IDA-MCP-Hub

IDA Pro 的 MCP(Model Context Protocol)服务器:stdio 传输、无头 idalib worker、 多实例生命周期管理与官方 IDAPython 文档查询。工具目录为本项目自有的 反汇编/反编译/修改/调试全量 API(90 个工具)。纯 idalib 架构:无 GUI 插件、 无 IDA 可执行文件路径依赖。

MCP 客户端 ──stdio──▶ idamcp-hub 独立进程
                        │  ├─ 实例发现:<IDAUSR>/ida-mcp/instances.json
                        │  └─ 直连各 worker 进程内的 JSON-RPC 桥(无网关、无端口注册转发)
                        ▼
             无头 idalib worker ×N(自动创建/分析 .i64,含调试器)

核心特性

  • stdio 唯一传输(uvx idamcp-hub stdio)。HTTP/网关/端口注册转发机制已删除。

  • open_database:附加已存在的同文件 worker,或启动无头 idalib worker (自动创建并分析 .i64)。

  • 多实例(无状态路由):list_databases / save_database / close_database, 以 instance_id 标识各数据库;无 select_database 默认选中——每次调用显式传 instance_id,省略时仅在恰好一个活跃实例时隐式路由,多实例并存时省略即报错 (多 agent 并发不会互相改道)。无头 worker 随最后一个使用者关闭(默认先保存)。

  • 终端 UI(v1.1+):dump(非交互 asm/伪代码导出)与 tui(r2 风格交互浏览)。 tui:左侧函数侧栏输入即过滤、ENTER 打开;主窗格可滚动;g seek(名称/地址, 亦解析地址所在函数)、p 反汇编⇄伪代码、x/f xref 查看与跟随、G/b 在当前 函数上直接看 call graph / ASCII CFG、n/m 重命名/注释、r 刷新列表。 q 退出并保存关闭 worker(TUI 是最后使用者时);ctrl+q 保留 worker 给 MCP 等其他客户端继续用(或 --keep-open)。textual 随包默认安装;全部跑在 宿主侧(uvx 环境)经桥调用现有工具,worker 内零新增依赖。

  • 官方 IDAPython 文档:ida_python_reference(query) 基于当前 IDA 运行时构建 BM25 索引(约 2 万条 API 签名 + 文档字符串),版本永远匹配。

  • worker 进程内零第三方依赖:桥为纯标准库实现。

  • 调试器无头可用:dbg_start 自动加载本机调试器(linux/win32/macos,可传 debugger="gdb" 走远程),IDA 9 删除官方调用栈 API 后由帧指针链自动重建。

Related MCP server: ida-pro-mcp-plus

安装

前置:IDA Pro 9.0+(含 idalib)。推荐 HCLI 一条龙(无需手填任何路径):

hcli ida install --download-id ida-pro:latest --set-default --accept-eula --yes

1. 配置无头 worker 解释器(可选——运行时也会自动探测)

python scripts/hcli_install.py        # 探测能 import idapro 的解释器(通常即
                                      # IDA 自带 ida-python 运行时)并缓存 ida_python

2. 独立 MCP 服务器

# 无需克隆,直接从 GitHub 运行(也可换成任意 ref / 本地路径):
uvx idamcp-hub stdio
# 指定仓库/分支(未发布新版时):
uvx --from git+https://github.com/Captain-AI-Hub/IDA-MCP idamcp-hub stdio
# 或从源码:
python -m ida_mcp stdio

PyPI 包名 idamcp-hub,已发布,uvx idamcp-hub stdio 即开即用。

发布方式:推送 v* tag 触发 .github/workflows/pypi-publish.yml (优先用仓库 secret PYPI_API_TOKEN,未设置时走 trusted publisher)。

MCP 客户端配置(HCLI/安装器安装完成后打印同款,可直接复制):

{
  "mcpServers": {
    "ida-mcp": { "command": "uvx", "args": ["idamcp-hub", "stdio"] }
  }
}

3. 无头 worker 的 Python(idalib)

无头 open_database 需要一个 import idapro 可用 的 Python。检测顺序:

  1. 配置 idalib_python

  2. 配置/检测的 ida_python

  3. ~/.idapro/ida-config.json 中 ida-install-dir 下的 ida-python(自编译运行时)

  4. <state>/idalib-venv 与 ~/.idapro/venv

首次探测成功会写入用户级配置 ~/.idapro/ida-mcp/config.conf 缓存。 若还没有激活的运行时:pip install <IDA>/idalib/python/idapro-*.whl 后运行 python <IDA>/py-activate-idalib.py。

CLI

idamcp-hub                  # = idamcp-hub stdio
idamcp-hub instances list       # 列出活跃 worker 实例
idamcp-hub open <path>          # 无头打开(自动创建/分析 .i64)
idamcp-hub close [--id ID] [--terminate]
idamcp-hub save [--id ID]
idamcp-hub tool call <name> --params '{"addr":"main"}'
idamcp-hub reference "decompile function" [--module ida_funcs]
idamcp-hub dump <path> [-f REGEX] [--asm-only|--pseudo-only] [-o FILE]
idamcp-hub tui <path>           # 交互式终端 UI;q 保存退出,ctrl+q 保留 worker
idamcp-hub config show

配置

ida_mcp/config.conf(包内)与 ~/.idapro/ida-mcp/config.conf(用户级,优先生效), 仅 3 个键:ida_python(能 import idapro 的解释器,通常为 IDA 自带 ida-python 运行时;留空则按 用户配置 → IDA 安装目录自带 → 托管 venv 探测并 缓存)、request_timeout、debug。scripts/hcli_install.py 可一次性写入; 日常无需手工配置。实例桥固定 127.0.0.1:13337+,无需配置。 环境变量覆盖:IDA_MCP_CONFIG_<KEY>。

工具面

  • 生命周期:open_database、list_databases、 save_database、close_database、check_connection

  • 文档:ida_python_reference(query, module=None)

  • 后端目录(90 个,每个都可带 instance_id 指定目标实例;多实例并存时必传): 反编译/反汇编/xref/搜索/重命名/注释/patch/类型/结构体/栈帧/内存/py_eval/dbg_* 等全量开放,见 API.md。

运行时边界

  • IDA 运行时:所有 SDK 调用经 worker 主线程队列串行执行(idalib 单线程约束)。

  • 独立进程:任何 Python ≥3.11;fastmcp 4.x;不接触 IDA SDK。

  • 测试:pytest——无可用 IDA/idalib 时后端测试自动跳过;本机有 idalib 时会 无头启动 test/samples/complex.exe 实例实测(--ida-open-timeout 可调)。

布局

IDA-MCP/
├── ida_mcp/
│   ├── bridge_server.py   # worker 内 JSON-RPC 桥(纯标准库)
│   ├── worker.py          # 无头 idalib worker 进程
│   ├── mcp_server.py      # 独立 stdio MCP 服务器
│   ├── instances.py       # 共享 JSON 实例清单
│   ├── lifecycle.py       # open/close/save/attach 生命周期
│   ├── bridge_client.py   # 桥 HTTP 客户端
│   ├── idapython_docs.py  # 官方 IDAPython 文档索引(BM25)
│   ├── api_*.py           # 工具目录(反汇编/反编译/修改/调试…)
│   └── sync.py / rpc.py   # 工具注册与调用标记
├── scripts/hcli_install.py  # idalib 解释器探测/配置
├── test/               # pytest 套件(单元 + 无头真机含调试器)
└── API.md / project.md / roadmap.md

Available Tools

91 tools
add_segmentAdd SegmentC

Add a new memory segment to the IDB.

Inputs: name (required), size (required), start_ea (required), perm, +4 more.

apply_patchApply PatchC

Apply IDB byte patches to a copied input file and export it.

Inputs: timeout, overwrite, instance_id, output_path.

callgraphCallgraphC

Build a call graph by walking call references from the root function(s).

Inputs: roots (required), timeout, max_depth, max_nodes, +1 more.

check_connectionCheck ConnectionA

Health check. Returns {ok, instance_id, pid, input_file, ...} for the resolved IDA instance.

Inputs: no named parameters.

close_databaseClose DatabaseA

Release an IDA database worker: saved and shut down when the last user detaches; terminate=true forces shutdown. Use when its analysis is finished or no longer needed — the other instances are unaffected.

Inputs: save, terminate, instance_id.

convert_numberConvert NumberB

Convert number to hex/unsigned/signed representations.

Inputs: text (required), size, timeout, instance_id.

create_functionCreate FunctionC

Create a function at an address.

Inputs: address (required), end, timeout, instance_id.

dbg_add_bpDbg Add BpC

Add breakpoint(s) at address(es).

Inputs: addr (required), timeout, instance_id.

dbg_callstackDbg CallstackB

Get current call stack (requires active debugger).

Inputs: timeout, instance_id.

dbg_continueDbg ContinueC

Continue execution.

Inputs: timeout, instance_id.

dbg_delete_bpDbg Delete BpC

Delete breakpoint(s) at address(es).

Inputs: addr (required), timeout, instance_id.

dbg_enable_bpDbg Enable BpC

Enable or disable breakpoint(s).

Inputs: items (required), timeout, instance_id.

dbg_exitDbg ExitC

Exit debugger.

Inputs: timeout, instance_id.

dbg_list_bpsDbg List BpsA

List all breakpoints (works without active debugger).

Inputs: timeout, instance_id.

dbg_read_memDbg Read MemC

Read memory from debugged process.

Inputs: regions (required), timeout, instance_id.

dbg_regsDbg RegsB

Get all debugger registers (requires active debugger).

Inputs: timeout, instance_id.

dbg_run_toDbg Run ToC

Run debugger to specific address.

Inputs: addr (required), timeout, instance_id.

dbg_startDbg StartC

Start the debugger on the current input file. The local debugger is

Inputs: timeout, debugger, instance_id.

dbg_statusDbg StatusB

Get debugger status: state, pid, threads, current instruction pointer.

Inputs: timeout, instance_id.

dbg_step_intoDbg Step IntoC

Step into instruction.

Inputs: timeout, instance_id.

dbg_step_overDbg Step OverC

Step over instruction.

Inputs: timeout, instance_id.

dbg_thread_regsDbg Thread RegsA

Read registers of one or more debug threads (temporarily selects each thread, then restores).

Inputs: names, timeout, thread_ids, instance_id.

dbg_write_memDbg Write MemC

Write memory to debugged process.

Inputs: regions (required), timeout, instance_id.

declare_enumDeclare EnumC

Declare or update an enum in the local type library.

Inputs: decl (required), timeout, instance_id.

declare_stackDeclare StackC

Create stack variable(s) at specified offset(s).

Inputs: items (required), timeout, instance_id.

declare_structDeclare StructC

Declare or update a struct in the local type library.

Inputs: decl (required), timeout, instance_id.

declare_typedefDeclare TypedefC

Declare or update a typedef in the local type library.

Inputs: decl (required), timeout, instance_id.

decompileDecompileB

Decompile function(s) at given address(es). Requires Hex-Rays.

Inputs: addr (required), timeout, instance_id.

delete_functionDelete FunctionC

Delete an existing function.

Inputs: address (required), timeout, instance_id.

delete_segmentDelete SegmentC

Delete a memory segment from the IDB.

Inputs: address (required), flags, timeout, instance_id.

delete_stackDelete StackC

Delete stack variable(s) by name.

Inputs: items (required), timeout, instance_id.

diff_before_afterDiff Before AfterB

Snapshot a function's decompilation, run a modification tool, return the unified diff.

Inputs: action (required), address (required), timeout, action_args, +1 more.

disasmDisasmB

Disassemble function(s) into listing lines (hex addresses, no color tags).

Inputs: addr (required), timeout, instance_id.

find_bytesFind BytesC

Search for byte pattern with wildcards (?? for any byte).

Inputs: pattern (required), end, limit, start, +2 more.

find_instructionsFind InstructionsC

Find instructions by mnemonic and/or a regex over the instruction text.

Inputs: limit, pattern, timeout, mnemonic, +1 more.

find_regexFind RegexB

Search symbol names (functions, globals, labels) with a regular expression.

Inputs: pattern (required), limit, offset, timeout, +1 more.

find_xref_signaturesFind Xref SignaturesC

Find signatures for code locations that reference an address. For each

Inputs: addrs (required), top, format, timeout, +2 more.

force_recompileForce RecompileA

Invalidate cached Hex-Rays decompilations so they are regenerated.

Inputs: timeout, addresses, instance_id.

get_basic_blocksGet Basic BlocksC

Get basic blocks with control flow information.

Inputs: addr (required), timeout, instance_id.

get_bytesGet BytesC

Read raw bytes at address(es).

Inputs: addr (required), size, timeout, instance_id.

get_calleesGet CalleesC

Get callees grouped by target function and call sites.

Inputs: addr (required), timeout, instance_id.

get_callersGet CallersC

Get callers grouped by calling function and call sites.

Inputs: addr (required), timeout, instance_id.

get_cursorGet CursorC

Get current cursor position and context in IDA.

Inputs: timeout, instance_id.

get_entry_pointsGet Entry PointsC

Get all program entry points.

Inputs: timeout, instance_id.

get_function_signatureGet Function SignatureC

Get the best available function signature string.

Inputs: addr (required), timeout, instance_id.

get_metadataGet MetadataB

Get IDB metadata (input_file, arch, bits, endian, hash).

Inputs: timeout, instance_id.

get_stringGet StringC

Read null-terminated string(s).

Inputs: addr (required), max_len, timeout, instance_id.

get_struct_infoGet Struct InfoB

Get detailed structure/union definition with fields.

Inputs: name (required), timeout, instance_id.

ida_python_referenceIda Python ReferenceA

Search the official IDAPython API documentation (from the attached IDA runtime). Returns signatures + docstrings; pass 'modules' as query to list modules.

Inputs: query (required), limit, module.

infer_typesInfer TypesC

Guess the type at each address with IDA's type inference and apply it as a guessed type.

Inputs: addresses (required), timeout, instance_id.

linear_disasmLinear DisasmB

Linear disassemble from arbitrary address (not limited to functions).

Inputs: start_address (required), count, timeout, instance_id.

list_databasesList DatabasesA

List all live IDA databases/instances ({instance_id, pid, headless, input_file}); pass one as instance_id on every tool call while several are live.

Inputs: no named parameters.

list_exportsList ExportsC

List exported functions/symbols.

Inputs: count, offset, pattern, timeout, +1 more.

list_functionsList FunctionsC

List functions with pagination and optional filtering.

Inputs: count, offset, pattern, timeout, +1 more.

list_globalsList GlobalsC

List global (non-function) symbols with pagination.

Inputs: count, offset, pattern, timeout, +1 more.

list_importsList ImportsB

List imported functions with module names.

Inputs: count, offset, pattern, timeout, +1 more.

list_local_typesList Local TypesB

List all local types defined in the database.

Inputs: timeout, instance_id.

list_segmentsList SegmentsC

List memory segments with permissions.

Inputs: timeout, instance_id.

list_stringsList StringsC

List extracted strings with pagination.

Inputs: count, regex, offset, pattern, +2 more.

list_structsList StructsB

List all structures/unions defined in the database.

Inputs: pattern, timeout, instance_id.

make_codeMake CodeC

Convert bytes at an address into code.

Inputs: address (required), timeout, instance_id.

make_dataMake DataC

Create typed data items at an address.

Inputs: address (required), data_type (required), count, timeout, +1 more.

make_signatureMake SignatureC

Create unique byte signatures for addresses. Generates the shortest

Inputs: addrs (required), format, timeout, max_length, +2 more.

make_signature_for_functionMake Signature For FunctionC

Create unique byte signatures for function entry points. Resolves each

Inputs: addrs (required), format, timeout, max_length, +2 more.

make_signature_for_rangeMake Signature For RangeC

Create a byte signature for a specific address range (e.g. a selected

Inputs: end (required), start (required), format, timeout, +2 more.

make_stringMake StringC

Create a string literal at an address.

Inputs: address (required), length, timeout, instance_id, +1 more.

open_databaseOpen DatabaseA

Open a binary or .i64 database in a headless idalib worker (creates/analyzes the .i64). Call this first. Record the returned instance.instance_id — every subsequent tool call must carry it while multiple databases are open.

Inputs: path (required), timeout, wait_for_analysis.

patch_asmPatch AsmB

Assemble instruction text and patch it at address(es). Requires processor assembler support (e.g. x86).

Inputs: items (required), timeout, instance_id.

patch_bytesPatch BytesC

Patch bytes at address(es). Each item: {address, bytes}.

Inputs: items (required), timeout, instance_id.

py_evalPy EvalC

Execute Python code in IDA context.

Inputs: code (required), timeout, instance_id.

py_exec_filePy Exec FileC

Execute a Python script file in IDA context and capture output.

Inputs: file_path (required), timeout, instance_id.

read_scalarRead ScalarC

Read scalar integer(s) with explicit width.

Inputs: addr (required), width, signed, timeout, +1 more.

rename_functionRename FunctionC

Rename function. Accepts function name or address.

Inputs: address (required), new_name (required), timeout, instance_id.

rename_global_variableRename Global VariableD

Rename global variable.

Inputs: new_name (required), old_name (required), timeout, instance_id.

rename_local_variableRename Local VariableC

Rename local variable (Hex-Rays).

Inputs: new_name (required), old_name (required), function_address (required), timeout, +1 more.

save_databaseSave DatabaseB

Save the current (or specified) IDA database to disk (.i64).

Inputs: timeout, instance_id.

save_idbSave IdbC

Save the current IDA database to disk.

Inputs: path, timeout, instance_id.

search_textSearch TextB

Search disassembly listing text (instructions, comments) across the database.

Inputs: query (required), limit, regex, timeout, +1 more.

set_commentSet CommentC

Set comments at address(es). Each item: {address, comment}.

Inputs: items (required), timeout, instance_id.

set_function_prototypeSet Function PrototypeC

Set function prototype (type signature).

Inputs: prototype (required), function_address (required), timeout, instance_id.

set_global_variable_typeSet Global Variable TypeC

Set global variable type.

Inputs: new_type (required), variable_name (required), timeout, instance_id.

set_local_variable_typeSet Local Variable TypeB

Set local variable type (Hex-Rays).

Inputs: new_type (required), variable_name (required), function_address (required), timeout, +1 more.

set_op_typeSet Op TypeB

Set the display type of an instruction operand (hex/dec/oct/bin/char/stkvar).

Inputs: items (required), timeout, instance_id.

stack_frameStack FrameC

Get stack frame variables for function(s).

Inputs: addr (required), timeout, instance_id.

survey_binarySurvey BinaryC

High-level binary overview: metadata, entity counts, segments, entry points.

Inputs: timeout, instance_id.

trace_data_flowTrace Data FlowC

Trace data references (reads/writes/offsets) to and from an address.

Inputs: address (required), timeout, direction, max_depth, +2 more.

undefine_itemsUndefine ItemsD

Undefine items in a range.

Inputs: size (required), address (required), timeout, instance_id.

wait_for_analysisWait For AnalysisA

Block until IDA auto-analysis (functions, xrefs, strings) completes.

Inputs: timeout, instance_id.

xrefs_fromXrefs FromC

Get all cross-references from address(es).

Inputs: addr (required), timeout, instance_id.

xrefs_toXrefs ToB

Get all cross-references to address(es).

Inputs: addr (required), timeout, instance_id.

xrefs_to_fieldXrefs To FieldC

Search struct field references. Heuristic by default (name/offset text

Inputs: field_name (required), struct_name (required), limit, strict, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.6/5.0

    Scored across 91 tools

    Disambiguation4/5

    Most tools target clearly distinct IDA operations, especially with separate namespaces for database lifecycle, analysis, xrefs, types, patching, and debugging. However, save_database and save_idb are exact duplicates, dbg_regs/dbg_thread_regs overlap, and the signature-creation family plus apply_patch/patch_bytes require careful reading to choose correctly.

    Naming Consistency3/5

    All names are snake_case, which helps, but the naming style is mixed: many verb_noun names, many bare verbs like disasm/decompile, noun names like callgraph/stack_frame/survey_binary, a dbg_ prefix for debugger tools, and xrefs_to/xrefs_from directional names. The set is readable but does not follow one predictable pattern.

    Tool Count1/5

    With 91 tools, the surface is far beyond a reasonably scoped server and imposes high selection burden on an agent. Even though many tools are useful, the count is extreme for the apparent domain and includes duplicates and fine-grained variants that could be consolidated.

    Completeness4/5

    The surface is very comprehensive for IDA reverse engineering: database management, analysis, disassembly/decompilation, xrefs, functions, types, segments, strings, patching, signatures, debugging, and Python execution are all covered. Minor gaps exist around local-type deletion and richer per-function detail aggregation, but core workflows are well supported.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      F
      maintenance
      MCP server for reverse engineering that enables interaction with IDA Pro for analysis tasks such as decompilation, disassembly, and memory engagement reports.
      24
      46
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An enhanced MCP server for IDA Pro that integrates bulk binary export, multi-instance management via Broker mode, and 80+ analysis tools for AI-assisted reverse engineering.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to drive IDA Pro through a stability-hardened server that hosts multiple headless idalib instances, with per-session isolation, configurable HTTP/stdio transports, and API-key authentication.
      173
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI-powered reverse engineering in IDA Pro by letting MCP clients inspect decompilation and disassembly, rename symbols, convert integers, and otherwise interact with the database through natural language.
      1
      MIT