Ghidralens

io.github.hellosverre由 GitHub 帳號 hellosverre 發布v0.1.1更新於 Oct 24, 2026

Interactive Ghidra views in your AI client: decompile, rename, and navigate a binary.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

GhidraLens 把 Ghidra 二進位分析以互動檢視帶進 AI 用戶端,讓助理反編譯、瀏覽函式、查看呼叫圖並重新命名符號。

可以做什麼
在常駐的 Ghidra 工作階段中開啟二進位並讀取程式資訊,自動分析只做一次,重新開啟或重啟後仍可沿用。反編譯函式,並瀏覽二進位中的所有函式,可依位址、名稱、大小或呼叫者數量篩選與排序。檢視呼叫圖(呼叫者與被呼叫者),並查詢交互參照與字串。重新命名符號、加入註解,再儲存程式,讓修改寫入 Ghidra 專案。在對話中呈現反編譯檢視、函式瀏覽器與呼叫圖,點擊檢視即可觸發重新命名與註解。
適用情境
適合逆向工程情境:希望助理與自己檢視同一個即時程式,請助理反編譯指定函式、追蹤呼叫關係,並隨手重新命名識別字。也適合在用戶端重啟後保留已分析的二進位,避免重複執行耗時的 Ghidra 自動分析。
執行需求
以本機 stdio 程序執行(npm 套件 ghidralens),另需在目標二進位上啟動獨立的 PyGhidra 橋接程序。需要 Ghidra 11.3+、JDK 21+、Python 3.9-3.13(不支援 3.14)與 Node 20+。需設定 GHIDRALENS_BRIDGE_URL(預設 GHIDRALENS_TOKEN(橋接啟動時列印的權杖)。僅支援桌面用戶端。
安裝前請注意
GHIDRALENS_TOKEN 是橋接程序列印的共用密鑰,需填入用戶端設定。save_program 會把重新命名與註解寫入 Ghidra 專案,改動已儲存的分析資料。橋接僅限本機回環、沒有多使用者模型,不應對外暴露。分析二進位不會執行它,但 Ghidra 會開啟惡意軟體,請依逆向工作的隔離要求處理。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Ghidralens,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

GhidraLens

Ghidra, rendered inside your AI client. Click a symbol to rename it. Click a call to follow it.

[CI] [MCP Apps] [Ghidra 11.3+] [Local models] [npm] [MIT]

[The decompiler view]

Every Ghidra MCP server so far returns text. The model can read it; you cannot navigate it. GhidraLens returns the same analysis as an interactive view — built on MCP Apps (io.modelcontextprotocol/ui), the extension that lets a server ship real HTML into the conversation.

You and the model are looking at the same live program. Rename a variable by clicking it and the model's next decompile sees the new name.

That is a real screenshot: where.exe, decompiled by Ghidra, every identifier carrying the address it came from.


What you get

ViewWhat it does
DecompilerGhidra's C output as a live token stream — every identifier carries its address and its kind. Click a local to rename it, click a call to follow it. Callers, callees and variables in a sidebar.
Function browserEvery function in the binary, filterable and sortable by address, name, size or caller count. Click a row to decompile it.
Call graphCallers to the left, callees to the right, the function you asked about in the middle. Click any node to recenter.

Function browser

[The function browser]

Call graph

[The call graph]

Ten tools total. Three open views; the rest are lookups and writes, including two the model never sees — they exist only so a click in a view can fire them.

How it fits together

  MCP client  ──stdio──▶  server/  ──HTTP──▶  bridge/  ──JPype──▶  Ghidra (JVM)  (Claude,                 TypeScript         PyGhidra            program stays   Cursor, …)              MCP server         session             resident       ▲       │  ui:// HTML in a sandboxed iframe       └──  ui/  three self-contained views

The bridge is a separate long-lived process on purpose. Ghidra's auto-analysis is the expensive step, and it happens once. Measured on a 64 KB Windows system utility (198 functions):

First open, with analysis25 s
Re-open the same binary0.3 s
Decompile one 2 KB function0.4 s
87-node call graph< 0.1 s

Restart the MCP server or the client and the analysed program is still there.

Setup

Prerequisites: Ghidra 11.3+, a JDK 21+, Python 3.9–3.13 (not 3.14 — JPype has no wheel for it yet), Node 20+. See bridge/setup.py.md — the Python side is fussy and that file covers every way it goes wrong. GhidraLens finds a JDK for you if JAVA_HOME is unset, which covers the usual "installed Java, shell has not restarted" case.

bash
git clone https://github.com/hellosverre/ghidralenscd ghidralensnpm installnpm run build

Then start the bridge on the binary you want to look at:

bash
python bridge/serve.py --binary /path/to/target.exe

It prints a token. Put that, and the path to the built server, into your MCP client config:

json
{  "mcpServers": {    "ghidralens": {      "command": "npx",      "args": ["-y", "ghidralens"],      "env": {        "GHIDRALENS_BRIDGE_URL": "http://127.0.0.1:8799",        "GHIDRALENS_TOKEN": "paste-the-printed-token-here"      }    }  }}

Running from a clone instead? Point command at node and args at /absolute/path/to/ghidralens/server/dist/index.js.

Then ask your client: "decompile the function that handles license validation".

Also listed in the official MCP Registry as io.github.hellosverre/ghidralens.

Editing the config by hand? Quit the client first — properly, including any system-tray icon. Claude Desktop keeps its own copy of claude_desktop_config.json in memory and writes it back over yours when it exits, so an edit made while it is running silently disappears on the next restart. Editing through Settings → Developer → Edit Config avoids the race entirely.

Tools

ToolVisible toRenders
open_binarymodel—
program_infomodel—
decompilemodel + viewDecompiler
list_functionsmodel + viewFunction browser
call_graphmodel + viewCall graph
find_stringsmodel—
xrefs_tomodel + view—
rename_symbolmodel + view—
add_commentview only—
save_programmodel—

add_comment is hidden from the model deliberately. Visibility is how MCP Apps separates "the agent may do this" from "a click may do this"; keeping write tools out of the model's list keeps it short and stops the model from renaming things on its own initiative.

Renames and comments live in memory until save_program writes them into the Ghidra project — after which they show up in the Ghidra GUI like any other edit.

Developing the views without Ghidra

bash
npm run dev:ui# open http://localhost:5173/dev/harness.html

ui/dev/harness.ts is a real MCP Apps host — it runs the SDK's AppBridge against the view in an iframe, so the ui/initialize handshake, the opening ui/notifications/tool-result, and every tools/call a click fires all go over real postMessage JSON-RPC. There is a message trace down the right-hand side and a host-theme switch, because the views have to look right in both.

Two data sources, switchable in the toolbar:

  • fixtures — no Ghidra needed, nothing to install
  • live bridge — proxies to a running bridge, so you develop against a real analysed program

Use live before you trust anything. Fixtures are tidy; real output is a 400-line function with 56 locals and an 87-node call graph, and that is where layout actually breaks.

Running it on a local model

Reverse engineering is exactly the work people would rather not send to a hosted model, so agent/ollama-agent.mjs is a small MCP host that puts GhidraLens behind Ollama instead. No API key, nothing leaves the machine.

bash
OLLAMA_MODEL=qwen3:14b node agent/ollama-agent.mjs "what does this binary do?"

It respects _meta.ui.visibility, so the app-only tools stay hidden from the model — the same separation a graphical client enforces. A ~9B model is enough to orient itself with find_strings and list_functions; a 14B is noticeably better at reading decompiled C.

Tests

SuiteNeeds GhidraCovers
node server/smoke.mjsnoMCP surface: tools, ui:// resources, tool visibility, graceful failure with no bridge
python bridge/test_serve.pynoBridge auth, CSRF rejection, routing, input validation
python bridge/test_session.pyyesEvery Ghidra call: analysis, caching, decompiler tokens, imports, renames, writes
node server/live.mjsyes (bridge running)The whole chain, and that every payload matches the shape the views index into

The first two are what CI can run. test_session.py is the one that matters after touching bridge/session.py — it is the only thing that proves the Ghidra API calls are right, and it caught three real bugs the day it was written.

Containerising it

The Dockerfile builds the server and views for clients or registries that want to start it themselves. One thing to get right:

dockerfile
CMD ["node", "server/dist/index.js"]     # correctCMD ["npm", "run", "start"]              # breaks the protocol

A stdio MCP server speaks JSON-RPC on stdout, and npm run / pnpm run print the script banner there first:

> [email protected] start> node server/dist/index.js

Those lines land in the stream ahead of the handshake and the client gives up mid-initialize. The symptom is unhelpful - the container builds, starts, exits cleanly, and the client just reports no tools - so it is worth not stepping on. Invoke node directly.

Real analysis still needs the bridge on the host: 127.0.0.1 inside a container is the container, so point GHIDRALENS_BRIDGE_URL at host.docker.internal or a real address.

Security

The bridge binds 127.0.0.1 only, requires a per-run token in X-GhidraLens-Token, and rejects any request carrying an Origin or Referer header — so a page open in your browser cannot reach your decompiler. It has no multi-user model and is not meant to be exposed; --host refuses anything but loopback.

Analysing a binary does not execute it, but Ghidra will happily open malware. Use the same isolation you would use for any other RE work.

Licence

MIT.

來源:README.md,提交 d8502b0

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分