REA MCP
☰
KO
● — 명 접속 중 · 조회 — 회
후원사례 제출
GitHub 저장소 · 작성자 akbar-npj

rea-ida-adapter

REA의 ida-pro-mcp 레거시 도구 프로필을 실행 중인 ida-free-mcp IDA 플러그인에 연결하는 표준 라이브러리만 사용하는 Python 3 MCP 어댑터로, 10개의 레거시 도구를 최신 ida-free-mcp 호출로 변환합니다.

번역 완료

이 사례에 대하여

이 어댑터는 REA(stdio JSON-RPC를 통해 ida-pro-mcp v1.4 레거시 attached 도구 프로필을 사용하는 쪽)와 ida-free-mcp(최신 Streamable HTTP MCP IDA 플러그인) 사이에 위치합니다. 10개의 레거시 도구 이름을 알리고, 각 호출을 ida-free-mcp 도구 호출로 변환하며, 결과를 REA가 검증하는 정확한 레거시 스키마로 재구성합니다. 업스트림 검색 순서, 전체 도구 매핑 표, 알려진 제한 사항, 그리고 IDA 없이 설정을 검증하는 방법을 문서화합니다.

설정

설치 방법은 원본 출처를 확인하세요.

원문 / README

rea-ida-adapter

A small, stdlib-only Python 3 MCP adapter that bridges REA's "IDA provider" to a running ida-free-mcp IDA plugin.

REA's attached mode expects the upstream MCP server to speak the ida-pro-mcp v1.4 "legacy attached" tool profile — a fixed set of 10 tools with specific JSON result shapes that REA validates with zod (a shape mismatch hard-fails the request). ida-free-mcp exposes a different (modern) tool set over Streamable HTTP MCP. This adapter sits in between:

REA  --stdio JSON-RPC-->  adapter.py  --HTTP MCP-->  ida-free-mcp (IDA plugin)
       (legacy 1.4 profile)              (modern profile)

It advertises exactly the 10 legacy tool names, translates each call into one or more ida-free-mcp tool calls, and reshapes the results into the exact legacy schemas.

Files

| File | Purpose | | --- | --- | | adapter.py | The adapter (executable, #!/usr/bin/env python3). | | README.md | This document. | | .gitignore | Ignore local scratch files. |

No third-party packages are required. Run it with python3 adapter.py; it reads/writes newline-delimited JSON-RPC 2.0 on stdin/stdout and logs to stderr only.

Registering with REA

Point REA_IDA_MCP_CONFIG at a JSON file shaped like:

{
  "mcpServers": {
    "ida-pro-mcp": {
      "type": "stdio",
      "command": "python3",
      "args": ["/home/shaanair/Projects/ida-mcp/rea-ida-adapter/adapter.py"],
      "mode": "attached"
    }
  }
}

REA spawns the adapter over stdio, calls initialize / tools/list, checks that the legacy tool set is present, and then drives the tools below.

Upstream discovery

On the first tool call the adapter connects to ida-free-mcp at POST /mcp:

  1. IDA_MCP_URL (env) — full URL or base; /mcp is appended if missing.
  2. IDA_MCP_PORT (env) — http://127.0.0.1:<port>/mcp.
  3. ~/.ida-mcp/instances/*.json — each file records {port, pid, idb_path}; ports are tried newest-file-first (handles the plugin's auto-increment when 13337 is busy).
  4. http://127.0.0.1:13337/mcp — the default.

It performs an MCP initialize + notifications/initialized handshake against the first reachable candidate and pins it. Responses are accepted as either plain JSON or SSE-framed (text/event-stream with data: {...} lines).

Tool mapping

| REA tool (legacy 1.4) | args | ida-free-mcp source | result translation | | --- | --- | --- | --- | | get_metadata | {} | resource ida://idb/metadata | passthrough {path, module, sha256, base, ...}; base normalized to 0x… | | list_functions | {offset, count} | list_funcs {queries:{offset,count}} | [{data,next_offset}] → {data:[{address,name,size}], next_offset} | | get_function_by_name | {name} | lookup_funcs {queries:[name]} | [{query,fn,error}] → {address,name,size} | | get_function_by_address | {address} | lookup_funcs {queries:[addr]} | [{query,fn,error}] → {address,name,size} | | list_strings | {offset, count} | find_regex {pattern:"(?s).*", limit, offset} | {matches:[{addr,string}]} → {data:[{address,string,length}], next_offset}; length synthesized | | disassemble_function | {start_address} | disasm {addr, max_instructions:50000} | asm.lines string → parsed into [{address,instruction}]; name/start_ea/return_type/arguments passed through | | decompile_function | {address} | decompile {addr} | {ok,pseudocode} → pseudocode string, or null when ok=false | | get_xrefs_to | {address} | xrefs_to {addrs:[addr], limit:1000} | [{xrefs:[{addr,type,fn}]}] → [{address,type,function}] | | get_callers | {function_address} | xrefs_to (derived) | keep type=="code" xrefs, dedupe by containing function, drop self-references → [{address,name,size}] | | get_callees | {function_address} | callees {addrs:[addr], limit:500} | [{callees:[{addr,name,type}]}] → [{address,name,type}] |

All addresses are normalized to lowercase 0x…; size is always a string.

Known limitations

  • list_strings — ida-free-mcp has no string-list tool. This adapter enumerates string literals via find_regex with (?s).*, falling back to [\s\S]* if the C++ std::regex ECMAScript engine rejects the inline (?s) flag. Only items IDA has flagged as string literals (is_strlit) are returned; length is the Python character count of the decoded string (not the on-disk byte length). Empty strings are not returned by the upstream tool.
  • get_callers — ida-free-mcp has no callers tool. Callers are derived from xrefs_to: only code cross-references whose containing function differs from the target are reported. This can miss callers reached through data/indirect references and can, in principle, include non-call code references (e.g. a tail jump) that IDA classifies as code. It is a best-effort approximation, not a proven call-edge set.
  • get_metadata.sha256 — passed straight through from IDA. If IDA cannot produce the input SHA-256 (e.g. the .i64 has no input hash), the upstream returns "unavailable", which REA rejects (it requires 64 hex chars). Open the original input binary in IDA so the hash is recorded.
  • disassemble_function — the upstream caps a single call at 50 000 instructions; larger functions are silently truncated. Basic-block/CFG data is not requested.
  • decompile_function — on IDA Free the upstream uses GUI-based decompilation (F5 + widget scraping); it returns null (never an error) when no pseudocode widget can be found for the function.
  • Startup — the adapter starts even when ida-free-mcp is down; the first tool call returns a clear MCP tool error, which REA surfaces rather than crashing.

Verifying without IDA

python3 -c "import ast; ast.parse(open('adapter.py').read())"

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
  | python3 adapter.py

tools/list does not touch ida-free-mcp and returns all 10 legacy tool names.

비슷한 프로젝트