Known Issues and Reflections (Must Read)
Pitfalls Encountered
-
idalib_openCannot be called directly through some code AI client MCP- Some code AI client's MCP client has issues with
idalib_open's output schema validation has a BUG - Error:
Structured content does not match the tool's output schema - Solution: Use the
scripts/open.ps1script to call directly via HTTP API, bypassing the MCP validation layer - After the file is opened, the database is bound to the shared context, and all other
idapro_*tools can be used directly
- Some code AI client's MCP client has issues with
-
C:\Windows\System32\File has no permission to open- idalib cannot directly read files in the System32 directory
- Solution:
open.ps1Automatically detect and copy to the临时目录directory before opening
-
Starting the server command blocks the conversation
idalib-mcpAfter startup, it continuously outputs INFO logs to the console- Solution: Use
scripts/start.ps1(-WindowStyle Hiddensilent background startup) - The script will wait for the service to be ready and then exit automatically, without blocking the conversation
-
MCP server names cannot use hyphens
- Previously used
ida-pro-mcpas the server name, which may cause tool registration issues - Current configuration: server name
idapro, tool prefixidapro_*
- Previously used
-
Remote HTTP vs Local Stdio
type:"local"(stdio) mode:idalib_openAlso has schema validation issuestype:"remote"(HTTP) mode: you can first use the script to open the file directly, then use MCP tools- Current solution: Remote HTTP mode
-
PR #389 fixed some schema issues
- Author mrexodia merged the fix via PR #389 after issue #388
- Fixed the structuredContent schema in HTTP mode, but some code AI client-side validation still has issues
- Latest
mainbranch version installed
-
idalib timeout leaves orphan worker process lock files
- First
open.ps1After the timeout, idalib's python worker child process becomes an orphan process, holding onto.id0/.id1/.namand not letting go - Any subsequent tool or manually dragging into IDA GUI will report "insufficient permissions"
- Solution:
start.ps1Switch totaskkill /F /Tto kill the process tree, no longer leaving orphans - Fallback:
open.ps1Added automatic degradation; when it detects the old database is locked, it automatically copies to Temp and adds a GUID prefix
- First
-
Opening with automatic analysis looks like it is stuck
idalib_open(run_auto_analysis=true)May not respond for a long time, but the backend is actually still continuing to open and analyze- Previously what users saw was "PowerShell has no output all along", making it easy to misjudge it as the script being stuck
- Current solution:
open.ps1Added-TimeoutSeconds, and changed to background request + foreground polling + periodic progress output - When polling detects that the session is ready, it returns early
OK:文件名:session_id; on timeout, returnsERR:open_timeout_xxs
Workflow Principles
| Step | What to do | What to use |
|---|---|---|
| 1 | Ensure the HTTP server is running | scripts/start.ps1(no parameters) |
| 2 | Open the target binary file | scripts/open.ps1 -Path "xxx.exe" |
| 3 | Use all 72 MCP tools | Directly call the idapro_* tool |
| 4 | Analysis complete | Tools are automatically available |
Script Resources
start.ps1 — Start the MCP HTTP server
Path:scripts/start.ps1
- Use
taskkill /F /Tto kill the old process tree (cleaning up worker child processes as well) → start in the backgroundidalib-mcp→ wait until ready (up to 15 seconds) - On success output
OK:72, on failure outputERR:timeout - The server runs in the background without blocking the conversation
How to call:
powershell -File "<skill-root>\ida-reverse\scripts\start.ps1"
open.ps1 — Open the binary file
Path:scripts/open.ps1
- Call directly via the HTTP API
idalib_open, bypassing MCP schema validation - Automatically detect the System32 path and copy it to a temporary directory
- Automatically clean up old database files with the same name (
.id0/.id1/.nam/.til/.i64) - When the old database is locked, automatically degrade: copy to Temp with a GUID prefix and then open, without reporting an error
- Run the open request in the background to avoid the script becoming unresponsive due to a long synchronous wait
- Supports
-TimeoutSeconds, after timeout returnsERR:open_timeout_xxs, and will not hang indefinitely - Output
INFO:opening:已用时/超时秒数every 10 seconds, making it easy to tell that analysis is still in progress - On success output
OK:文件名:session_id, when degraded add the(temp copy)marker - On failure automatically retry using the Temp copy
How to call:
powershell -File "<skill-root>\ida-reverse\scripts\open.ps1" -Path "C:\path\to\file.exe"
Optional parameters:
# 指定 SessionId
powershell -File "scripts\open.ps1" -Path "file.exe" -SessionId "my_session"
# 跳过自动分析(大文件推荐)
powershell -File "scripts\open.ps1" -Path "large.exe" -NoAutoAnalysis
# 设置超时,避免带自动分析时长时间无返回
powershell -File "scripts\open.ps1" -Path "file.exe" -TimeoutSeconds 600
Output conventions:
# 分析进行中(每 10 秒输出一次)
INFO:opening:11/600s
# 成功打开
OK:sample.exe:abcd1234
# 成功打开,但因锁文件降级到 Temp 副本
OK:1234abcd-sample.exe:abcd1234 (temp copy)
# 达到超时上限
ERR:open_timeout_600s
Measured notes:
Snipaste.exewith automatic analysis takes about324sbefore returning success; this is “long analysis” rather than “script deadlock”- Therefore, for GUI programs or more complex samples, it is recommended to explicitly set
-TimeoutSeconds 600
Core Tool List
Overview analysis (first step)
idapro_survey_binary(detail_level="minimal")— Quick overview: function count, strings, segments, entry point, import classification (encryption/network/file IO)idapro_list_funcs(queries)— List functions (pagination, filter by name)idapro_list_globals(queries)— List global variablesidapro_entity_query(kind, filter)— Unified query: functions/globals/imports/strings/names
Decompilation and Disassembly
idapro_decompile(addr)— Decompile to pseudocodeidapro_disasm(addr, max_instructions=N)— Disassembleidapro_analyze_function(addr, include_asm=false)— Comprehensive analysis (pseudocode + strings + constants + callers + callees + blocks)idapro_func_profile(queries)— Function summary metrics
Cross-references and Data Flow
idapro_xrefs_to(addrs)— Find who references the target addressidapro_xref_query(addr, direction)— Advanced xref query (direction/type filtering)idapro_callees(addrs)— Subfunction listidapro_callgraph(roots, max_depth)— Call graphidapro_trace_data_flow(addr, direction, max_depth)— Data flow tracing (forward/backward)
Search
idapro_find_regex(pattern, limit)— Regex search for stringsidapro_search_text(pattern)— Search for text in the disassembly listingidapro_find_bytes(patterns, limit)— Byte pattern search (supports ?? wildcards)idapro_find(type, targets)— Advanced search (immediates/strings/references)
Memory and Data
idapro_get_bytes(addrs)— Read raw bytesidapro_get_string(addrs)— Read stringidapro_get_int(queries)— Read integer valueidapro_get_global_value(queries)— Read global variable valueidapro_read_struct(queries)— Read struct field valueidapro_search_structs(filter)— Search struct
Modification operations
idapro_set_comments(items)— Add comment (disassembly + decompilation bidirectional sync)idapro_append_comments(items)— Append commentidapro_rename(batch)— Batch rename (functions/globals/locals/stack variables)idapro_patch_asm(items)— Patch assembly instructionsidapro_patch(patches)— Patch bytesidapro_define_func(items)— Define functionidapro_undefine(items)— Undefineidapro_define_code(items)— Convert bytes to code
Type system
idapro_declare_type(decls)— Declare C struct/enum/unionidapro_set_type(edits)— Apply type to function/global/localidapro_infer_types(addrs)— Infer typeidapro_type_query(queries)— Query declared typesidapro_type_inspect(queries)— View type details
Stack frame
idapro_stack_frame(addrs)— View stack frame variablesidapro_declare_stack(items)— Declare stack variableidapro_delete_stack(items)— Delete stack variable
Signature
idapro_make_signature(addrs)— Generate unique byte signature for addressidapro_make_signature_for_function(addrs)— Generate signature for functionidapro_find_xref_signatures(addrs)— Generate signature for code referencing address
Debugger (requires ?ext=dbg)
idapro_open_file(file_path)— Open file in GUI IDA instance- Debugger tools are hidden by default and can be enabled via the URL parameter
?ext=dbgenable
Session management
idapro_idalib_open(input_path)— ⚠️ Has a schema validation BUG, use insteadopen.ps1scriptidapro_idalib_list()— List all sessionsidapro_idalib_current()— Session bound to current contextidapro_idalib_switch(session_id)— Switch to another sessionidapro_idalib_close(session_id)— Close sessionidapro_idalib_save(path)— Save databaseidapro_idalib_health(session_id)— Check worker health status
Other
idapro_int_convert(inputs)— Base conversion (You must use this, don't calculate bases yourself!)idapro_export_funcs(addrs, format)— Export functions (json/c_header/prototypes)idapro_py_eval(code)— Execute Python in IDA contextidapro_server_health()— Server health checkidapro_server_warmup()— Warm up subsystems (string cache, Hex-Rays, etc.)
Complete reverse engineering workflow
Step 1: Start the server
Ensure the HTTP service is running in the background.
powershell -File "scripts/start.ps1"
Output OK:72 indicates ready.
Step 2: Open file
powershell -File "scripts/open.ps1" -Path "C:\目标.exe" -TimeoutSeconds 600
Output OK:文件名:session_id indicates success (followed by (temp copy) indicates automatic fallback to a temporary copy).
If analysis takes a long time, it will periodically output INFO:opening:...; if the timeout is reached, it outputs ERR:open_timeout_xxs。
Step 3: Global overview
idapro_survey_binary(detail_level="minimal")
Focus on:
- Architecture (x86/x64/ARM)
- Entry points (main/WinMain/DllMain)
- Interesting strings (URLs, paths, error messages)
- Import categories (crypto functions? network APIs? file operations?)
- Hot functions (functions with high xref counts are usually key logic)
Step 4: Dive into key functions
idapro_analyze_function(addr="关键函数名")
Or:
idapro_decompile(addr="函数名")
idapro_disasm(addr="函数名", max_instructions=50)
Step 5: Data flow and cross-references
idapro_xrefs_to(addrs="关键地址/字符串")
idapro_callgraph(roots=["关键函数"], max_depth=3)
idapro_trace_data_flow(addr="关键地址", direction="backward", max_depth=5)
Step 6: Record and refine
idapro_set_comments(items=[{"addr": "0x140001000", "comment": "你的理解"}])
idapro_rename(batch={"func": [{"addr": "函数地址", "name": "有意义的名字"}]})
Step 7: Output report
After analysis is complete, generate report.md to record findings and steps.
Prompt engineering guidelines
- Don't calculate bases manually — anytime you need to convert numbers, use
idapro_int_convert - Survey first, then dive deep — First look at the overview, then analyze in a targeted way
- Continuously add comments and rename — Continuously update function names and variable names during analysis to improve the accuracy of subsequent analysis
- Track cross-references — When you find interesting data/strings, use
xrefs_toto see who references it - When encountering obfuscated code — First perform preprocessing such as string decryption, import hash removal, and control flow flattening removal
- C++ STL code — After identifying library functions with FLIRT/Lumina, then analyze the business logic
- Do not brute-force — Analysis should derive the solution from the disassembly, using simple Python to assist with calculations
- When encountering "No database bound" — No binary file has been opened yet, first execute
open.ps1 - When encountering "Failed to open database" — The old database file may be locked,
open.ps1will automatically fall back to a Temp copy (the output contains the(temp copy)marker) - When opening the GUI/complex samples with auto-analysis enabled — By default add
-TimeoutSeconds 600, do not mistake a longINFO:opening:...for a stuck script
Routing context
Upstream entry: skills/SKILL.md(master control),routing.md
Upstream alternative: radare2/(if you do not want to open IDA, you can first do quick reconnaissance with r2)
Downstream exit:
- Requires Frida dynamic verification →
reverse-engineering/tools-dynamic.md - Requires symbolic execution/angr →
reverse-engineering/tools-dynamic.md - Requires general reverse engineering methodology →
reverse-engineering/SKILL.md
Peer related modules: radare2/(alternative when IDA is unavailable)
On-Demand Bootstrap
The entry script of this skill is already connected to the unified bootstrap system.
Automation capability boundaries
| Tool | Can be installed automatically | Installation method | Description |
|---|---|---|---|
| idalib-mcp | ✓ | pip install (from GitHub) | start.ps1 Automatically install when missing |
| IDA Pro itself | ✗ | Commercial software, requires manual installation | Set the IDADIR environment variable to point to the installation directory |
Installation steps (verified)
# 1. 设置 IDA 路径(替换为你的实际 IDA 安装目录)
setx IDADIR "<你的IDA安装目录>"
# 2. 从 GitHub 安装 ida-pro-mcp(PyPI 上的 ida-mcp 是另一个项目,不要装错!)
pip install git+https://github.com/mrexodia/ida-pro-mcp.git
# 3. 安装 IDA 插件(选择 Streamable HTTP + Global + 全选客户端)
ida-pro-mcp --install
# 4. 重启 IDA Pro,打开目标文件
# 插件自动监听 127.0.0.1:13337
# 5. 验证
ida-pro-mcp --config
⚠️ Note: The
ida-mcppackage on PyPI (author jtsylve) is another project, not the one we need. It must be installed from GitHubmrexodia/ida-pro-mcp。
Bootstrap trigger point
scripts/start.ps1: Whenidalib-mcpis missing, automatically callbootstrap-reverse.ps1- MCP registration: bootstrap will automatically write
idaprointo the Claude MCP configuration
Prerequisites
- IDA Pro is installed and the
IDADIRenvironment variable is set (or the default path in the script is correct) - Python is installed (idalib-mcp depends on Python)