Logo with a human head and circuit design labeled IDA MCP AI for Intelligent Data Analytics Modeling and Computation Platform AI

Add SSH bridge for IDA Pro MCP

ida-pro-mcp has two independent components:

ComponentRoleUsually runs on
IDA plugin (ida_mcp)Listens on 127.0.0.1:13337 inside IDA and exposes a JSON-RPC interfaceLocal (installed into your local IDA)
MCP server (server.py)A pure-Python proxy: speaks MCP upstream, forwards requests over HTTP to 13337 downstreamAnywhere (does not require IDA)

In a typical remote-development setup IDA runs locally while the AI agent runs
on a remote server. The agent-side MCP server connects to 127.0.0.1:13337,
but that resolves to the remote server itself, whereas the IDA plugin is
listening on the local loopback address — the link is broken at the
network layer.

Local workstation Remote server
┌──────────────────┐ ┌──────────────────────┐
│ IDA + plugin │ │ Claude Code (agent) │
│ 127.0.0.1:13337 │ ✗ unreachable ✗ │ └─ MCP server │
└──────────────────┘ │ connects to │
│ 127.0.0.1 → self│
└──────────────────────┘

1.2 The solution: an SSH reverse tunnel

The two sides communicate over plain “HTTP to some host:port”. ssh-bridge
opens an SSH connection from your local machine to the remote and sets up a
reverse port forward (ssh -R), so traffic to a loopback port on the
remote is carried back to the local machine over the encrypted tunnel.

Local workstation Remote server
┌──────────────────┐ ┌──────────────────────────┐
│ IDA + plugin │◀── tunnel carries back ──│ 127.0.0.1:<port> (listen) │
│ 127.0.0.1:13337 │ │ ▲ │
└────────▲─────────┘ │ │ connects to │
│ ssh-bridge dials outbound ──────▶ sshd │ local loopback │
└─────────────────────────────────────────── Claude Code (agent) │
└──────────────────────────┘

Key point: connection direction. The SSH connection is initiated
outbound from local to remote (the same direction you log in with). As a
result:

  • It works even when the local machine is behind NAT / on an intranet — all
    you need is outbound SSH from local to the server; the server does not need to
    reach back into your network.
  • The only requirement is that the remote server runs sshd.

1.3 Two modes

sse mode (default — nothing to install on the remote)

ssh-bridge starts an extra SSE-style MCP server locally (it connects to
the local IDA on 13337 over loopback, never across the network), then
reverse-forwards only that SSE port (default 8744) to the remote. The remote
Claude Code points its MCP server at the tunneled URL (e.g.
http://127.0.0.1:8744/sse).

Nothing needs to be installed on the remote server — it just talks MCP over
HTTP/SSE to the local machine through the tunnel.

Local: IDA(13337) ←loopback← local SSE server(8744) ←reverse-forward 8744→ Remote: Claude Code → 8744

rpc mode (remote runs ida-pro-mcp)

Reverse-forwards the IDA RPC port(s) (13337, etc.) directly to the remote.
The remote needs ida-pro-mcp installed (pure Python — IDA is not required there), launched over stdio by Claude Code with
--ida-rpc http://127.0.0.1:13337 pointing at the tunneled port. Use
--all-instances to forward every running local IDA instance at once.

1.4 Robustness

ssh-bridge configures the underlying ssh with ServerAliveInterval
(keepalive heartbeats), ExitOnForwardFailure=yes (exit immediately if a
forward can’t be established), and a ConnectTimeout. If the connection drops,
it auto-reconnects with exponential backoff; once a connection stays up for
more than 30s the backoff is reset. Ctrl-C tears down both the tunnel and the
local SSE server.


2. Usage

2.1 Prerequisites

  • Local: IDA Pro and the ida-pro-mcp plugin installed, and the MCP plugin
    started in IDA (Edit -> Plugins -> MCP, shortcut Ctrl+Alt+M /
    Ctrl+Option+M on macOS).
  • Local: a working ssh client that can log into the remote server (key
    auth recommended).
  • Remote: sshd reachable. In sse mode the remote needs nothing else; in
    rpc mode the remote needs pip/uv install ida-pro-mcp.

Always run ssh-bridge on the local workstation (the machine running IDA).

2.2 Getting and launching the bridge

ssh-bridge ships with this source tree. If you installed ida-pro-mcp from a
release that predates this feature, get this version first (e.g. clone the repo
onto your local machine). Then launch it on the local workstation using any
of the following.

Option A — uv (recommended; matches the rest of the repo):

cd ida-pro-mcp
uv run ida-pro-mcp ssh-bridge user@remote-server

Option B — editable pip install (registers the ida-pro-mcp console script):

cd ida-pro-mcp
pip install -e .
ida-pro-mcp ssh-bridge user@remote-server

Option C — run the module directly (no install; quickest to try):

cd ida-pro-mcp
PYTHONPATH=src python3 -m ida_pro_mcp.ssh_bridge user@remote-server

Option C imports only the standard library for the bridge itself, but in
sse mode it launches a local SSE server via python -m ida_pro_mcp.server,
which needs the project’s dependencies (tomli_w, idapro). For a smooth
run, prefer Option A or B, which install dependencies for you.

Confirm the command before connecting with --dry-run (see §2.6). The bridge
must keep running for the remote agent to stay connected; Ctrl-C stops it
(and tears down the tunnel and local SSE server).

2.3 sse mode (recommended)

Step 1 (local) — start the bridge:

uv run ida-pro-mcp ssh-bridge user@remote-server
# or pick a different local SSE port: --sse-port 8744

It prints the URL to use on the remote, e.g.:

[ssh-bridge] On the remote server, configure your MCP client with URL:
[ssh-bridge] http://127.0.0.1:8744/sse

Step 2 (remote) — register that URL with the Claude Code MCP client:

# run on the remote server
claude mcp add --transport sse ida http://127.0.0.1:8744/sse

The remote Claude can now call all of the local IDA tools. Keep the
ssh-bridge process running on the local machine.

2.4 rpc mode

Step 1 (local) — forward the RPC port(s):

# forward the single default port
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc
# or auto-forward every running local IDA instance
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc --all-instances
# or specify ports explicitly (repeatable)
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc --port 13337 --port 13338

It prints the configuration the remote should use, e.g.
ida-pro-mcp --ida-rpc http://127.0.0.1:13337.

Step 2 (remote) — install and configure:

# on the remote server: install the pure-Python package (no IDA needed)
uv tool install ida-pro-mcp # or pip install ida-pro-mcp
# register it as a stdio MCP server in Claude Code
claude mcp add ida -- ida-pro-mcp --ida-rpc http://127.0.0.1:13337

2.5 Options reference

OptionDescriptionDefault
targetSSH target, e.g. user@host or a ~/.ssh/config aliasrequired
--mode {sse,rpc}Bridge modesse
--sse-portLocal SSE port (sse mode)8744
--portIDA port to forward (rpc mode, repeatable)
--all-instancesrpc mode: discover and forward all local IDA instancesoff
--ida-rpcsse mode: IDA target the local SSE server connects toauto-discover
--remote-bindRemote-side bind address for the tunnel127.0.0.1
--identitySSH private key file (ssh -i)
--port-sshRemote SSH port (ssh -p)
--keepaliveServerAliveInterval seconds30
--dry-runPrint the ssh command(s) that would run, then exitoff
-v, --verbosePrint ssh / local-server commands (for debugging)off

2.6 Preview what will run (without connecting)

uv run ida-pro-mcp ssh-bridge user@remote-server --dry-run

2.7 Troubleshooting

  • Remote calls fail with “Failed to complete request to IDA Pro”: the MCP
    plugin isn’t started in your local IDA, or (in sse mode) the local SSE
    server couldn’t reach IDA. Start it via Edit -> Plugins -> MCP.
  • Tunnel keeps reconnecting: check that you can ssh user@remote-server
    manually; run with -v to see the ssh error; verify your key /
    ~/.ssh/config.
  • Remote port already in use: change --sse-port (sse) or the target ports;
    with ExitOnForwardFailure ssh exits and reconnects if the remote port is
    taken by another process.
  • Shared remote host: see the security notes below.

3. Security

3.1 Secure by default

  • All traffic is SSH-encrypted, reusing your existing SSH authentication and
    keys.
  • Loopback-only binding: the remote listener binds to 127.0.0.1 by default
    (--remote-bind), so the IDA RPC interface is never exposed to the network — only the remote host itself can reach it.
  • No inbound on the local side: the connection is initiated outbound from
    local, so the local machine exposes no listening port to the network.

3.2 IDA RPC has no built-in authentication — what that means

The IDA plugin’s 13337 interface performs no identity checks. The security
boundary therefore rests entirely on “loopback binding + SSH encryption”:

  • Do not bind the IDA plugin or the SSE server to 0.0.0.0.
  • Use --remote-bind 0.0.0.0 with care: it makes the tunneled port visible
    outside the remote host and requires GatewayPorts yes (or clientspecified)
    in the remote sshd config. Avoid it unless you explicitly need it; the tool
    prints a warning when a non-loopback bind is detected.

3.3 Shared / multi-user remote hosts

Even with loopback binding, other logged-in users on the remote host can
reach 127.0.0.1:<port> (loopback is visible to every user on that host). If
the remote is a shared server, be aware they could connect to your IDA.
Mitigations:

  • Use a remote host / container that is yours alone;
  • Pick a hard-to-guess port (only lowers the chance of accidental collisions —
    it is not authentication);
  • Stop the bridge (Ctrl-C) when done; don’t leave a tunnel hanging idle.

The IDA RPC interface can perform high-privilege operations: modifying the
database, running Python (api_python), controlling the debugger, etc.
Exposing it to untrusted users is equivalent to handing over control of your
local IDA. Only use this on remote hosts you trust.

3.4 Recommended practices

  • Use key-based authentication (--identity or ~/.ssh/config); avoid
    passwords.
  • Choose a single-tenant remote host you control.
  • Keep --remote-bind 127.0.0.1 (the default).
  • Stop the bridge process as soon as the task is done.

中文版

ssh-bridge:从远程 Agent 使用本地 IDA Pro

ida-pro-mcp ssh-bridge 让运行在远程 SSH 服务器上的 MCP 客户端(Claude Code 等)访问运行在本地工作站上的 IDA Pro。

本文分三部分:原理 · 使用方法 · 安全


一、原理

1.1 问题

ida-pro-mcp 有两个相互独立的组件:

组件作用通常运行在
IDA 插件ida_mcp在 IDA 进程内监听 127.0.0.1:13337,提供 JSON-RPC 接口本地(装进本地 IDA)
MCP serverserver.py纯 Python 的代理:对上讲 MCP,对下把请求 HTTP 转发到 13337任意(不依赖 IDA

典型远程开发场景下,IDA 在本地,AI Agent 在远程服务器。Agent 侧的 MCP server
去连 127.0.0.1:13337,连到的却是远程服务器自己,而 IDA 插件监听的是本地
的回环地址——链路在网络层断开。

本地工作站 远程服务器
┌──────────────────┐ ┌──────────────────────┐
│ IDA + 插件 │ │ Claude Code (Agent) │
│ 127.0.0.1:13337 │ ✗ 够不到 ✗ │ └─ MCP server │
└──────────────────┘ │ 连 127.0.0.1 → │
│ 连到的是自己 │
└──────────────────────┘
1.2 解法:SSH 反向隧道

两者之间本质是「连接到某个 host:port 的 HTTP 通信」。ssh-bridge本地发起一条
到远程的 SSH 连接,并建立反向端口转发ssh -R),把远程某个回环端口的流量经
加密隧道送回本地。

本地工作站 远程服务器
┌──────────────────┐ ┌──────────────────────────┐
│ IDA + 插件 │◀── 隧道把流量送回本地 ──│ 127.0.0.1:<port> (监听) │
│ 127.0.0.1:13337 │ │ ▲ │
└────────▲─────────┘ │ │ 连本地回环即可 │
│ ssh-bridge 发起出站 SSH ───────▶ sshd │ │
└────────────────────────────────────────── Claude Code (Agent) │
└──────────────────────────┘

关键点:连接方向。 SSH 由本地主动向外发起(和你平时登录服务器的方向一致)。
因此:

  • 本地在内网 / NAT 后也能用——只要本地能 SSH 出站到服务器即可,不要求服务器能反连本地。
  • 唯一前提是远程服务器开放了 sshd
1.3 两种模式
sse 模式(默认,远程零安装)

ssh-bridge本地额外拉起一个 SSE 形态的 MCP server(它在本机直连 IDA 的
13337,不跨网络),然后只把这个 SSE 端口(默认 8744)反向转发到远程。远程的
Claude Code 把 MCP server 配成隧道里的 URL(如 http://127.0.0.1:8744/sse)即可。

远程服务器上不需要安装任何东西,只是通过隧道用 HTTP/SSE 跟本地对话。

本地: IDA(13337) ←本机直连← 本地SSE server(8744) ←反向转发8744→ 远程: Claude Code 连 8744
rpc 模式(远程运行 ida-pro-mcp

直接把 IDA 的 RPC 端口(13337 等)反向转发到远程。远程需要安装 ida-pro-mcp
(纯 Python,不需要 IDA),由 Claude Code 以 stdio 拉起,并用
--ida-rpc http://127.0.0.1:13337 指向隧道端口。支持 --all-instances 一次转发本机
所有运行中的 IDA 实例。

1.4 健壮性

ssh-bridge 给底层 ssh 加了 ServerAliveInterval(保活心跳)、
ExitOnForwardFailure=yes(转发建立失败立即退出)和 ConnectTimeout;连接断开后
按指数退避自动重连,连接稳定超过 30s 则重置退避。Ctrl-C 会一并关闭隧道与本地
SSE server。


二、使用方法

2.1 前置条件
  • 本地:已安装 IDA Pro 与 ida-pro-mcp 插件,并在 IDA 中启动了 MCP 插件
    Edit -> Plugins -> MCP,快捷键 Ctrl+Alt+M / mac Ctrl+Option+M)。
  • 本地:可用的 ssh 客户端,且能 SSH 登录到远程服务器(密钥认证最佳)。
  • 远程:开放 sshdsse 模式下远程无需其它依赖;rpc 模式需要远程能
    pip/uv install ida-pro-mcp

ssh-bridge 一律在本地工作站(IDA 所在机器)运行。

2.2 获取与启动

ssh-bridge 随这份源码一起发布。如果你装的是早于该功能的发布版 ida-pro-mcp
需先获取这份代码(例如把仓库 clone 到本地机器)。然后在本地工作站用下列任一方式启动。

方式 A — uv(推荐,仓库本来就这么用):

cd ida-pro-mcp
uv run ida-pro-mcp ssh-bridge user@remote-server

方式 B — pip 可编辑安装(注册 ida-pro-mcp 控制台命令):

cd ida-pro-mcp
pip install -e .
ida-pro-mcp ssh-bridge user@remote-server

方式 C — 直接运行模块(免安装,最快验证):

cd ida-pro-mcp
PYTHONPATH=src python3 -m ida_pro_mcp.ssh_bridge user@remote-server

方式 C 的桥接本体只依赖标准库,但 sse 模式下它会通过 python -m ida_pro_mcp.server
拉起本地 SSE server,而后者需要项目依赖(tomli_widapro)。为顺利运行,建议用
方式 A 或 B,它们会替你装好依赖。

正式连接前可用 --dry-run 确认命令(见 §2.6)。桥接进程必须保持运行,远程 Agent 才能持续
连通;Ctrl-C 会停止它(并关闭隧道与本地 SSE server)。

2.3 sse 模式(推荐)

第 1 步(本地) 启动桥接:

uv run ida-pro-mcp ssh-bridge user@remote-server
# 或自定义本地 SSE 端口:--sse-port 8744

命令会打印出供远程使用的 URL,例如:

[ssh-bridge] On the remote server, configure your MCP client with URL:
[ssh-bridge] http://127.0.0.1:8744/sse

第 2 步(远程) 把该 URL 配进 Claude Code 的 MCP 客户端:

# 在远程服务器上执行
claude mcp add --transport sse ida http://127.0.0.1:8744/sse

完成后,远程的 Claude 即可调用本地 IDA 的全部工具。保持 ssh-bridge 进程在本地运行。

2.4 rpc 模式

第 1 步(本地) 转发 RPC 端口:

# 转发单个默认端口
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc
# 或自动转发本机所有运行中的 IDA 实例
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc --all-instances
# 或显式指定端口(可重复)
uv run ida-pro-mcp ssh-bridge user@remote-server --mode rpc --port 13337 --port 13338

命令会打印远程应使用的配置,例如 ida-pro-mcp --ida-rpc http://127.0.0.1:13337

第 2 步(远程) 安装并配置:

# 在远程服务器上:安装纯 Python 包(不需要 IDA)
uv tool install ida-pro-mcp # 或 pip install ida-pro-mcp
# 把它作为 stdio MCP server 配进 Claude Code
claude mcp add ida -- ida-pro-mcp --ida-rpc http://127.0.0.1:13337
2.5 参数速查
参数说明默认
targetSSH 目标,如 user@host~/.ssh/config 中的别名必填
--mode {sse,rpc}桥接模式sse
--sse-portsse 模式本地 SSE 端口8744
--portrpc 模式要转发的 IDA 端口(可重复)
--all-instancesrpc 模式:发现并转发本机所有 IDA 实例
--ida-rpcsse 模式:本地 SSE server 连接的 IDA 目标自动发现
--remote-bind远程侧隧道绑定地址127.0.0.1
--identitySSH 私钥文件(ssh -i
--port-ssh远程 SSH 端口(ssh -p
--keepaliveServerAliveInterval30
--dry-run只打印将执行的 ssh 命令并退出
-v, --verbose打印 ssh/本地 server 命令,便于排障
2.6 先看看会执行什么(不实际连接)
uv run ida-pro-mcp ssh-bridge user@remote-server --dry-run
2.7 故障排查
  • 远程调用报「Failed to complete request to IDA Pro」:本地 IDA 里没启动 MCP 插件,
    sse 模式下本地 SSE server 没连上 IDA。先在 IDA 里 Edit -> Plugins -> MCP
  • 隧道反复重连:检查能否手动 ssh user@remote-server 登录;用 -v 看 ssh 报错;
    确认密钥/~/.ssh/config 正确。
  • 远程端口被占用:换 --sse-port(sse)或目标端口;注意远程同一端口若被别的进程占用,
    ExitOnForwardFailure 会让 ssh 退出后重连。
  • 多用户共享远程主机:见下方安全说明。

三、安全

3.1 默认即安全
  • 全程 SSH 加密:隧道流量走 SSH,复用你已有的 SSH 认证与密钥体系。
  • 仅绑回环:远程监听默认绑 127.0.0.1--remote-bind 默认值),IDA 的 RPC 接口
    不会暴露到网络,只有该远程主机本机可达。
  • 本地无需开放入站:连接由本地出站发起,本地不暴露任何监听端口给公网。
3.2 IDA RPC 没有内建鉴权——这意味着什么

IDA 插件的 13337 接口本身不做身份校验。因此安全边界完全依赖「绑定回环 + SSH 加密」:

  • 不要把 IDA 插件或 SSE server 绑到 0.0.0.0
  • 谨慎使用 --remote-bind 0.0.0.0:它会让隧道端口对远程主机外部可见,且需要远程
    sshd 配置 GatewayPorts yes(或 clientspecified)。除非你明确需要,否则不要这么做;
    本工具在检测到非回环绑定时会打印警告。
3.3 多用户共享的远程主机

即使绑回环,远程主机上的其他登录用户也能访问 127.0.0.1:<port>(回环对该主机所有用户可见)。
如果远程是多人共享的服务器,应意识到他们也能连到你的 IDA。缓解措施:

  • 用你独占的远程主机 / 容器;
  • 选用不易被猜到的端口(仅为降低被无意撞上的概率,不是真正的鉴权);
  • 用完即停(Ctrl-C 结束 ssh-bridge),不要长期空挂隧道。

IDA RPC 可执行修改、运行 Python(api_python)、控制调试器等高权限操作。把它暴露给
不可信用户等同于把本地 IDA 的控制权交出去。务必只在可信的远程主机上使用。

3.4 推荐实践
  • 使用密钥认证--identity~/.ssh/config),避免口令。
  • 远程主机选择自己可控、单租户的环境。
  • 保持 --remote-bind 127.0.0.1(默认)。
  • 任务结束及时停止桥接进程。

code:

https://github.com/cn0xroot/ida-pro-mcp


Posted

in

by

Tags:

Comments

Leave a comment