$ show mrexodia/ida-pro-mcp
This repository implements an MCP (Model Context Protocol) server that exposes IDA Pro's disassembler, decompiler, debugger, and type system as a set of tools and resources consumable by LLM clients (Claude, Codex, Cursor, etc.). It operates in two distinct modes: an IDA GUI plugin that starts an MCP server on a configurable port, and a headless supervisor (`idalib-mcp`) that manages persistent worker processes for multiple databases. The architecture is a hybrid of a plugin and a standalone server, built on a custom, vendored MCP server implementation (`zeromcp`) with HTTP/SSE/stdio transports. The core API surface is defined via a decorator-based registration system (`@tool`, `@resource`, `@unsafe`, `@ext`) in `rpc.py`, which also handles output truncation middleware and JSON schema generation from TypedDicts. All IDA SDK calls are marshalled onto the main thread through a robust execution pipeline (`sync.py`) that manages timeouts, cancellation, and batch mode. The headless mode uses a supervisor/worker pattern (`idalib_supervisor.py`, `idalib_server.py`, `worker_lifecycle.py`) with health probing, idle TTL, and session management. A comprehensive compatibility layer (`compat.py`) provides version-gated shims for IDA 8.4 through 9.3. Key features include decompilation, disassembly, cross-references, memory read/write, patching, type declaration/inference, debugger control (breakpoints, step, registers), signature generation, and binary survey. Tool calls are always-on traced into the IDB as gzipped JSONL batches. The project includes an extensive test suite with a custom test framework, MCP spec regression tests, and CI running against multiple IDA versions in Docker containers. The codebase is actively maintained and demonstrates strong engineering practices, but the plugin mode is explicitly deprecated in favor of the official Hex-Rays IDA MCP Server. The heavy reliance on IDA's internal APIs and the vendored MCP server implementation represent ongoing maintenance risks. The code is well-structured with several genuinely reusable components, though some modules (e.g., `api_analysis.py`) are monolithic.
The LLM identified 8 files worth highlighting for reuse:
A self-contained, vendored MCP server implementation (fork of zeromcp 1.3.0) providing JSON-RPC dispatch, HTTP/SSE/stdio transports, CORS handling, session management, and extension support. It is cleanly abstracted and could be extracted into a standalone MCP server library with minimal modification. Demonstrates strong protocol engineering and is the core transport layer for the entire project.
The central tool and resource registry. It provides the @tool, @resource, @unsafe, and @ext decorators that define the entire MCP API surface. It includes sophisticated output truncation middleware that preserves schema validity, caches full results for download, and generates JSON schemas from TypedDicts. This is a highly reusable pattern for building any MCP server.
Manages the execution of tool code on IDA's main thread via execute_sync. It implements a robust pipeline with timeouts (using threading.Timer and set_cancelled), batch mode management (@keep_batch), and reentrancy guards. This solves a hard real-time problem in IDA plugin development and is a model for safely bridging background threads with a single-threaded UI framework.
A collection of version-gated shims and adapters for the IDAPython API across IDA Pro versions 8.4 to 9.3. It uses hasattr checks and version probing to provide a stable interface over a rapidly evolving third-party API. This is a pragmatic and well-structured pattern for maintaining compatibility in plugin ecosystems.
Manages the lifecycle of headless IDA worker subprocesses. It implements idle TTL, health probing via TCP and RPC pings, wedged process detection, and graceful self-exit. This is a generic, well-tested component for managing a pool of long-running subprocesses and is independent of IDA-specific logic.
A custom, lightweight test framework designed specifically for testing MCP tools. It provides a @test decorator for inline test placement, run_tests() for execution, and powerful assertion helpers like assert_shape and assert_typed_dict for validating complex nested TypedDict responses. It is a clean DSL that could be extracted for testing any JSON-RPC or MCP-based API.
Implements always-on, append-only tracing of every tools/call into the IDB as gzipped JSONL batches. It captures duration, timestamps, arguments (unredacted), and truncation metadata. This is a novel and well-implemented pattern for audit logging in a reverse engineering context, providing a replayable history of all LLM interactions with the binary.
A collection of high-quality, reusable utility functions for address parsing, list normalization, pagination, pattern filtering, and BSS-safe memory reads. These functions are used pervasively across all API modules and demonstrate a strong focus on correctness and edge-case handling (e.g., reading zeros from unloaded BSS memory instead of raising errors).