This project provides a Model Context Protocol (MCP) server for integrating IDA Pro with AI agents like Gemini, Claude, and Jetski. It features a gateway-based proxy architecture, an embedded relational SQLite query engine, and headless session management to support advanced reverse engineering workflows.
Background & Motivation
Back in 2025, when we began integrating AI agents with IDA Pro, the upstream
ida-pro-mcp project provided a
great initial starting point. At the time, it did not yet offer multi-session
workflows, which were essential for our daily reverse engineering needs.
To address our internal use cases, we began building experimental solutions:
- Gateway Proxy Architecture: We developed a stateless proxy layer that automatically discovers and routes tool requests across concurrent GUI and headless IDA instances. (While upstream has since added its own multi-session implementation, the two projects use fundamentally different architectural approaches).
- Relational SQL Query Engine: Answering high-level questions about a
binary (e.g., finding functions with specific characteristics or exploring
complex cross-reference patterns) typically required dozens of sequential
API calls running on IDA's main thread. We integrated an on-demand,
event-synchronized SQLite3 engine with an AST query-rewrite layer
(
sqlglot). Because queries execute against SQLite in worker threads, they support concurrent reads without acquiring IDA's main thread lock or blocking the UI. - Architecture-Agnostic Tools & Bug Fixes: Several tools in the early upstream code had x86-specific assumptions or heuristics. We rewrote them to be architecture-agnostic (supporting ARM, AArch64, MIPS, PowerPC, RISC-V, etc.) and fixed various stability and synchronization edge cases.
Over time, as we added more features, optimizations, and compatibility layers across multiple IDA versions (IDA 7.7 through 9.4) and Python versions, the codebase diverged substantially into an independent project with its own design trade-offs.
We are sharing this project as an alternative, gateway- and SQL-centric approach for connecting AI agents to IDA Pro, and we remain grateful to Duncan Ogilvie and the upstream contributors for the foundational work that inspired this effort.
Core Features
Key capabilities of this implementation include:
-
Stateless Gateway: A proxy layer allows agents to interact with multiple IDA Pro instances (GUI and Headless) concurrently. The gateway automatically discovers and manages connections, allowing users to open and close databases without reconfiguring the client.
-
Headless Mode: Perform analysis in the background without the IDA Pro GUI, suitable for automated workflows. Sessions can be managed directly by the AI agent. A headless instance registers as soon as the file is loaded and runs IDA's auto-analysis afterwards, so a large binary can be listed and closed while it is still being analysed.
-
Relational SQL Engine: Integrates a read-only SQLite relational database populated on-demand and synchronized via IDA event hooks. Tables (
functions,strings,names,imports,segments,local_types,xrefs,entries) support concurrent background queries without blocking IDA's main UI thread, while an AST query layer (sqlglot) handles unsigned 64-bit arithmetic, comparison rewriting, and hex literals. -
WYSIWYG Disassembly: Disassembly tools (like
disassemble_functionanddisassemble_code) return formatted text matching the IDA Pro UI, including opcode bytes, data definitions, and comments. Includesget_ida_viewfor viewing arbitrary memory ranges. -
Analysis & Modification Tools: Includes tools for UI navigation (
jump_to_address,set_color), memory inspection (hexdump), byte patching (patch_bytes), database exporting (export_file), cross-references (get_xrefs_from,get_data_xrefs_from), and structured data creation. -
Context-Aware Assembly Patching: Powered by Keystone at the Gateway layer, the
patch_assemblytool allows assembling and applying instructions directly at target addresses. It can resolve IDA symbols (function names, labels, globals) within assembly strings and evaluate basic operand math across supported architectures (x86/x64, ARM/AArch64, MIPS, PowerPC, etc.), making it convenient for quick hotpatching, stubbing out checks, or testing alternative execution paths. -
Pagination and Caching: Implements paginated resource iteration for symbol and string listing, reducing memory overhead on large binaries.
-
Security Dashboard: A web-based interface for managing permissions for "unsafe" tools (e.g., Python code execution), providing control over agent capabilities.
-
Unix Domain Socket (UDS) Support: In addition to TCP, the server supports UDS for secure local communication in isolated environments (Linux/macOS).
-
Configurable Tool Exposure (
tool_mode): Supports three MCP tool exposure strategies via FastMCP transforms—"hybrid"(default, pins core high-frequency tools upfront and exposes the rest on-demand via BM25 search),"code_mode"(collapses tools into sandboxed Python discovery and execution), and"full"(exposes all 89 tools upfront).
Architecture Overview
The core of this project is the Gateway Pattern. A central gateway process acts as a proxy that routes requests from the AI agent to the correct active IDA instance.
- Discovery: IDA instances (GUI or headless) register themselves by writing a metadata file to a shared directory.
- Routing: The gateway monitors this directory and manages a routing
table. When a tool call arrives with a specific
database_id, the gateway forwards it to the corresponding IDA process. - Statelessness: This design decouples the agent from the backend. The agent communicates only with the gateway, and IDA instances can be opened or closed without affecting the agent's connection.
This architecture enables a multi-session analysis environment where the agent can work with multiple binaries concurrently.
Most tools in this project have been thoroughly tested and verified across:
- IDA Pro 7.7 + Python 3.11
- IDA Pro 8.4 + Python 3.11
- IDA Pro 9.3 + Python 3.13
- IDA Pro 9.4 + Python 3.13
In headless mode on IDA 9.3 and earlier, a tool timeout or cancellation
interrupts Python code (e.g., in idapython_eval) but can't set IDA's cancel
flag, so an IDA operation that is already running isn't stopped early.
- OS: Linux, macOS, or Windows.
- IDA Pro: Version 7.x or higher
- Python: 3.11 or higher.
Follow these steps to set up the IDA MCP server and configure your client.
1. Quick Setup
# a. Clone the repo
git clone https://github.com/idamcp/idamcp.git
cd idamcp
# b. Install the IDA Pro plugin (use `python` on Windows if `python3` is not set)
python3 install.py plugin
# c. Install the dependencies
python3 -m venv venv_idamcp
# Activate the virtual environment:
# On Linux / macOS:
source venv_idamcp/bin/activate
# On Windows (Command Prompt):
venv_idamcp\Scripts\activate.bat
# On Windows (PowerShell):
venv_idamcp\Scripts\activate.ps1
# Inside the activated virtual environment, use `python` (on Windows, venvs
# provide `python.exe` rather than `python3.exe`):
python -m pip install -r requirements.txt
# d. Install IDA Python library module, please update the path accordingly
cd </path/to/IDA/installation/idalib/python>
python -m pip install "idapro*.whl"
python py-activate-idalib.py
# f. Register the server with your preferred LLM client (run from the idamcp repo):
cd </path/to/idamcp>
# For google antigravity-cli / Antigravity IDE
python install.py agy
# For Codex
python install.py codex
# For Claude Code
python install.py claude
# For Gemini CLI
python install.py gemini2. Verify the Gateway (Optional / Testing Only)
You can launch the standalone gateway proxy locally to verify that all dependencies are met:
python3 -m gateway.proxyNote: Running the gateway standalone is strictly for testing/verification and is not required during normal use. When configured as an MCP server, your LLM client (e.g., Gemini CLI, Claude Code, Codex) automatically launches and manages the gateway process via stdio in the background.
3. Recommended Configuration
For the best experience, save these recommended settings to ~/.idamcp.json:
{
"communication_channel": "uds",
"registry_dir": "~/.ida_mcp_registry",
"max_headless_instances": 8,
"headless_open_timeout": 600.0,
"enable_all_unsafe_tools": false,
"enabled_unsafe_tools": ["idapython_eval"],
"opcode_bytes": 8,
"populate_tables_on_startup": true,
"sqlite_persistent": true,
"tool_mode": "hybrid"
}Configuration File Options & Full Example
The configuration file is located at ~/.idamcp.json. Here is a complete
example of all available settings (showing defaults):
{
"communication_channel": "uds",
"registry_dir": "~/.ida_mcp_registry",
"uds_dir": "/tmp/ida_mcp_uds",
"max_headless_instances": 4,
"headless_open_timeout": 600.0,
"headless_analysis_wait": 10.0,
"python_path": "/usr/bin/python3",
"enable_all_unsafe_tools": false,
"enabled_unsafe_tools": ["idapython_eval", "dbg_step_over"],
"opcode_bytes": 8,
"populate_tables_on_startup": false,
"sqlite_persistent": false,
"check_entries_freshness": false,
"rebuild_strings_on_data_patch": false,
"disabled_tools": [],
"flush_after_write": false,
"gui_undo_points": false,
"autostart": false,
"hotkey": "Ctrl-Alt-M",
"tool_mode": "hybrid",
"always_visible_tools": [
"list_available_databases",
"idalib_headless_open",
"idalib_headless_close",
"sql_query",
"decompile_function",
"disassemble_function",
"disassemble_code",
"get_ida_view",
"hexdump",
"idapython_eval"
],
"show_decompiler_warnings": false,
"omitted_decompiler_warnings": ["WARN_GUESSED_TYPE", "WARN_UNDEF_LVAR"],
"max_tool_response_bytes": "8m",
"max_eval_output_bytes": "1m"
}- communication_channel: Use
"uds"for secure, local-only communication (Linux/macOS) or"tcp"for networked setups. Windows environments will default to"tcp". - uds_dir: Directory for the Unix sockets, one
<16 characters>.sockper IDA instance. The operating system limits a socket path to 107 bytes on Linux and 103 on macOS, which leaves 85 and 81 for this directory. With a longer one, the server does not start and reports thatuds_diris too long. - max_headless_instances: Limits how many background IDA processes the MCP Client (e.g., Gemini CLI) can spawn. This limit does not apply to manually launched instances.
- headless_open_timeout: Timeout in seconds for a headless IDA instance
to load the file. Auto-analysis runs afterwards and does not count, but
populating the query tables of a database that is already analysed
(
populate_tables_on_startup) happens before the instance registers and does count. Increase this value if you're experiencing timeout errors with large binaries or on slower hardware. - headless_analysis_wait: How long
idalib_headless_openwaits, in seconds, for IDA's auto-analysis to finish before it returns a database that is still being analysed.0returns as soon as the file is loaded. Defaults to10.0. See Headless Mode under Usage. - opcode_bytes: Specifies how many instruction/data bytes to display in the disassembly or listing view when bytes are requested (defaults to 8).
- sqlite_persistent: If
True, the Sqlite database used bysql_querywill be saved to a.dbfile in the same directory as your IDA IDB file. This avoids re-populating tables every time you open the database. Otherwise the database is a scratch file in a per-session temporary directory that is removed when the session closes. - check_entries_freshness: If
True, the server verifies whether entry points have changed in IDA (using a lightweight in-memory fingerprint) before executing queries against theentriestable, automatically repopulating it if changes are detected. Because entry points represent static binary exports (functions and global data symbols) and are not expected to change after initial auto-analysis completes, this option defaults toFalse. Entry points added with theadd_entry_pointstool are picked up without it. - rebuild_strings_on_data_patch: If
True, patching non-function bytes that do not belong to any existing string marks thestringstable dirty so the nextstringsquery rebuilds it (for example, after decrypting strings in a data section). Patches inside an existing string are always updated or rebuilt automatically regardless of this setting. Defaults toFalse. - disabled_tools: A list of case-insensitive regular expressions. Any tool whose name matches a pattern in this list will not be registered. Use this to restrict the agent's capabilities.
- flush_after_write: If
True, the IDA plugin callsida_loader.flush_buffers()after every tool call that modifies the database, so IDA's in-memory changes are written to the unpacked database files (.id0etc.) right away instead of staying only in memory. This is not a save: the.idb/.i64file is not repacked. It costs oneflush_bufferscall per modifying tool call and defaults toFalse. Ifflush_buffersis unavailable or fails, one error is logged and flushing stops for that session. - gui_undo_points: If
True, the IDA GUI plugin creates an undo point labeledMCP: <tool name>before each tool call that modifies the database, so each agent change can be reverted withCtrl + Z/ Edit -> Undo. Not used in headless mode. Defaults toFalse. - autostart: If
True, the IDA plugin starts the MCP server by itself when IDA opens a database, so you don't need Edit -> Plugins -> MCP or the hotkey. If auto-analysis is still running, the server starts when it finishes, without blocking the UI; until then, the hotkey only reports that the server is on its way. If auto-analysis is disabled, the server starts without it. Works in the GUI and in text-mode IDA (idatbefore IDA 9.2). Skipped in batch mode: with-Aor-B(e.g.ida -A -S script.py), and in anyidatsince IDA 9.2, which has no interactive mode. No effect in headless mode (idalib). Defaults toFalse. - hotkey: The IDA plugin's shortcut for starting the server, in IDA's
hotkey syntax (e.g.
"Ctrl-Shift-M"). An empty string means no shortcut; Edit -> Plugins -> MCP still works. IDA reads it when it loads the plugin, so a change applies to the next database you open. Defaults to"Ctrl-Alt-M". - tool_mode: Controls how the Gateway exposes MCP tools to the client.
Supported values are
"hybrid"(default),"full", and"code_mode":"hybrid": Uses FastMCP'sBM25SearchTransformto keep core high-frequency tools (configured viaalways_visible_tools) directly visible, while placing the remaining tools behind on-demandsearch_toolsandcall_toolwith compact Markdown schema serialization (~70% fewer tokens than JSON Schema)."full": Exposes all 89 tools upfront intools/list."code_mode": Uses FastMCP'sCodeModetransform (search,get_schema,execute) to allow chaining multipleawait call_tool(...)invocations inside a single sandboxed Python block.
- always_visible_tools: A list of tool names that remain directly visible
in
tools/listwhentool_modeis set to"hybrid". Defaults to["list_available_databases", "idalib_headless_open", "idalib_headless_close", "sql_query", "decompile_function", "disassemble_function", "disassemble_code", "get_ida_view", "hexdump", "idapython_eval"]. - show_decompiler_warnings: If
True,decompile_functionshows Hex-Rays warnings, such as "positive sp value has been found", in// Hex-Rays warning:comments above the line each refers to (or at the top), except those inomitted_decompiler_warnings. Defaults toFalse. - omitted_decompiler_warnings: The Hex-Rays warnings that
decompile_functionleaves out, named as in IDA'sida_hexraysmodule. Names that the running IDA doesn't define are logged and ignored. Defaults to["WARN_GUESSED_TYPE", "WARN_UNDEF_LVAR"]: "using guessed type" notes come with most calls, and "possibly undefined" ones mostly flag call arguments that the pseudocode already shows as never set.[]shows all warnings. - max_tool_response_bytes: The largest tool response that the gateway
passes on to the client; a larger one is replaced by an error that tells
the model to narrow the query, paginate, or write to a file. Clients keep
tool results in the model's context, so a huge result is useless there and
may break the client. Requests are not limited. A size is a number of
bytes (
8388608) or a string with a unit:k,m, org, also writtenkb/kib,mb/mib,gb/gib, case-insensitive and in binary multiples ("8m","512 KiB","1.5mb").0means no limit. Defaults to"8m". - max_eval_output_bytes: The limit on each of
stdout,stderr, andresultofidapython_eval, as a size like above. Code that prints more is stopped at the limit, and the call fails with an error that includes the output so far, like a timeout does; a larger result fails the call with the first part of the value.0means no limit. Keep it well belowmax_tool_response_bytes: JSON escaping can double the size of escape-heavy output. Defaults to"1m".
Environment Variables
- IDAMCP_CONFIG: Path to a custom configuration file.
- IDAMCP_NO_USER_CONFIG: Set to
true,1, oryesto ignore user configuration files (~/.idamcp.*) and use default settings (useful in CI or test suites). - POPULATE_TABLES_ON_STARTUP: Set to
true,1, oryesto enable table population at startup. - HEADLESS_ANALYSIS_WAIT: Overrides
headless_analysis_wait, in seconds. - SQLITE_PERSISTENT: Set to
true,1, oryesto enable persistent Sqlite storage. - CHECK_ENTRIES_FRESHNESS: Set to
true,1, oryesto enable entry points freshness verification before querying theentriestable. - GUI_UNDO_POINTS: Set to
true,1, oryesto enablegui_undo_points. - AUTOSTART: Set to
true,1, oryesto enableautostart; any other value disables it. - HOTKEY: Overrides
hotkey; an empty value means no shortcut. - ENABLE_ALL_UNSAFE_TOOLS: Set to
trueto enable all unsafe tools. - ENABLED_UNSAFE_TOOLS: A comma-separated list of specific unsafe tools to
enable (e.g.,
idapython_eval,dbg_step_over). - DISABLED_TOOLS: A comma-separated list of regular expressions to disable
specific tools (e.g.,
^dbg_.*,^patch_.*). - FLUSH_AFTER_WRITE: Set to
true,1, oryesto enableflush_after_write. - TOOL_MODE: Set to
"hybrid","full", or"code_mode"to configure the Gateway's tool exposure mode. - ALWAYS_VISIBLE_TOOLS: A comma-separated list of tool names that remain
directly visible when
tool_modeis"hybrid"(e.g.,list_available_databases,sql_query,decompile_function). - SHOW_DECOMPILER_WARNINGS: Set to
true,1, oryesto enableshow_decompiler_warnings; any other value disables it. - OMITTED_DECOMPILER_WARNINGS: Overrides
omitted_decompiler_warningswith a comma-separated list of warning names (e.g.,WARN_GUESSED_TYPEto show "possibly undefined" warnings too); an empty value shows all warnings.
Security Dashboard & Unsafe Tools
Some powerful tools (like arbitrary Python execution) are marked as "unsafe" by default. To manage these permissions and view active sessions:
- Start the Security Dashboard:
python3 -m frontend.security_dashboard - Open your browser to
http://127.0.0.1:8080(the dashboard opens automatically by default). - Use the interface to approve/deny tools.
While a headless instance is still running its auto-analysis, the dashboard shows its settings, but saving changes fails until the analysis has finished.
The dashboard supports the following CLI arguments:
--port <number>: Specify the port to run on (default: 8080).--no-browser: Disable automatic browser opening.
In case you just want to enable specific tools temporarily, you can use the environment variables, for example:
ENABLE_ALL_UNSAFE_TOOLS=true <gemini/headless/ida>
ENABLED_UNSAFE_TOOLS=idapython_eval,dbg_step_over <gemini/headless/ida>- Start IDA Pro and open a database/binary.
- Press
Ctrl + Alt + M(thehotkeyoption) to start the MCP server within IDA, or set"autostart": trueto have it start by itself. - The Gateway will automatically discover this new session, and you can begin your analysis with the AI agent.
You can launch IDA instances in the background directly from the command line or via the agent.
Manual Launch:
PYTHONPATH=/path/to/project python3 -m ida_mcp.headless /path/to/binary_or_idbAdd --disable-auto-analysis to skip IDA's auto-analysis.
Via LLM CLI / AI Agent: You can ask the AI agent to open files for you:
-
Open: "Open the file
/path/to/binaryin headless mode."- Tool used:
idalib_headless_open
- Tool used:
-
Close: "Close the headless session for
/path/to/binary."- Tool used:
idalib_headless_close
- Tool used:
Auto-analysis: A headless instance registers as soon as IDA has loaded the
file and runs the auto-analysis afterwards, so opening a large binary does not
wait for the analysis. idalib_headless_open and list_available_databases
report its state as auto_analysis_status:
"done": The database is ready.idalib_headless_openwaits up toheadless_analysis_waitseconds (10 by default) for this, so a small binary comes back ready to use."in_progress": IDA is still analysing. Every tool call for the database fails with "auto analysis is still in progress, please wait." untillist_available_databasesreports"done"; until then both tools report the database asbusy. The session can be closed at any time: the partly analysed database is saved, and the analysis resumes when it is opened again."disabled": The analysis was skipped because the file was opened withdisable_auto_analysis=true, e.g., for a very large binary. The database then holds only what the loader created.
Loading the file still happens before idalib_headless_open returns. So does
populating the query tables when a database that is already analysed is opened
with populate_tables_on_startup set. If that takes longer than your client
allows a tool call to run, raise the client's timeout setting and
headless_open_timeout.
Note: The max_headless_instances setting in ~/.idamcp.json ensures the MCP
client doesn't spawn too many resource-heavy IDA processes. If the limit is
reached, idalib_headless_open raises an error instructing the client to close
an unused instance using idalib_headless_close before opening a new one. This
setting does not affect manually launched headless instances.
(Prompting Tip: LLM clients may not inherently recognize the versatility
and performance of sql_query, often defaulting to sequential, single-purpose
inspection tools like list_functions, list_strings, or get_xrefs_to. We
recommend reminding the model in system or session prompts to prioritize
sql_query for complex lookups, filtering, and relational joins).
Whenever the backend RPC interfaces have been updated, developers must
regenerate gateway/proxy.py and run the test suite to ensure everything
functions properly:
# Generate and format the gateway/proxy
python3 -m generators.generate_proxy
# Format the file with [pyink](https://github.com/google/pyink)
pyink --line-length=80 --pyink-indentation=2 gateway/proxy.py
# Regenerate the MCP metadata snapshot checked by tests/test_mcp_metadata.py
python3 tests/dump_mcp_metadata.py
# Run the test suite
make testDeveloped and maintained by Junfeng Yang with the help of Google Gemini,
originally based on and inspired by the
ida-pro-mcp project by Duncan
Ogilvie.
Some code, mainly in idapython_eval and in tool cancellation and timeouts, is
adapted from the ida-nexus project
by Hex-Rays SA.
Special thanks to Hua Wu and Geoff Alexander for their thorough code reviews, and to Genwei Jiang and Andriy Brukhovetskyy (doomedraven) for invaluable feedback.
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
This project is licensed under the MIT License and is based on the
ida-pro-mcp project by Duncan Ogilvie. Portions are adapted from ida-nexus
by Hex-Rays SA, which is also MIT-licensed.