OpenImageDebugger MCP

io.github.OpenImageDebugger由 GitHub 帳號 OpenImageDebugger 發布v0.3.6更新於 Oct 29, 2026

MCP server giving AI agents eyes on OpenImageDebugger buffers in live gdb/lldb sessions

已驗證STDIO僅桌面開發者工具媒體與設計

概覽

AI 產生的概覽

實驗性的本機 MCP 伺服器,讓助理檢視 gdb/lldb 中 OpenImageDebugger 即時工作階段的影像緩衝區,並可操作檢視器視窗。

可以做什麼
  • 列出可用的除錯器工作階段與檢視器視窗,以及目前中斷點可觀察的緩衝區符號
  • 將緩衝區算繪為 PNG,可指定裁切區域、單一通道與固定正規化範圍
  • 提供各通道最小值/最大值/平均值/標準差及 NaN/Inf/零值計數,並讀取小範圍裁切的精確像素值
  • 把緩衝區無損匯出為 .npy 檔案,並將緩衝區鏡像到使用者的 OID 檢視器視窗
  • 讀取與設定檢視器的檢視狀態(緩衝區、中心、縮放、旋轉、通道、自動對比)
適用情境
適合在 gdb 或 lldb 中除錯影像處理程式時使用:讓助理直接檢視緩衝區、找出異常、檢查統計量或核對數值,不必離開除錯流程。沒有除錯器時,也可針對單獨啟動的 OID 檢視器視窗使用。
執行需求
需要已建置安裝的 OpenImageDebugger 及部署好的 oid.py,以及內嵌 Python 的 gdb 或(macOS 上)Homebrew 版 lldb。除錯器須以 OID_AGENT=1 啟動,且被除錯程式已停在中斷點。伺服器透過 uv 在本機執行(自動解析 mcp、numpy、pillow);除錯器與伺服器須能讀取同一個探索目錄,可用 OID_AGENT_DIR 指定。選用的 OID_MCP_MAX_BYTES 可限制緩衝區傳輸大小。
安裝前請注意
屬於實驗性、需主動開啟的功能:它會把被除錯程式的記憶體暴露給能讀取探索檔案的本機程序,只應在可信任的本機開發環境中啟用。探索檔案含每個工作階段的權杖,目錄必須私有且歸你所有(權限 0700),否則伺服器會拒絕讀取。dump 會寫入磁碟檔案,除非 overwrite=true 否則不覆寫既有檔案;plot 與 set_view 會改變使用者檢視器中的顯示。view 的回傳可能耗用大量 token。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

oid-mcp

MCP server that gives AI agents eyes on OpenImageDebugger buffers in a live gdb/lldb session: list observable symbols at a breakpoint, view renderings, read exact values, dump lossless .npy copies, and mirror buffers into the human viewer.

⚠️ Experimental. This is a new, experimental feature — the control protocol, tool surface, and behavior may change without notice, and it is not yet covered by any stability guarantee. It is opt-in (OID_AGENT=1) and exposes debuggee memory to local processes; enable it only in trusted, local development. Feedback welcome.

How it works

Two cooperating pieces, connected over a localhost socket:

  • The in-debugger endpoint (part of OID's oid.py, stdlib-only) starts inside your debugger's embedded Python when OID_AGENT=1 is set. It writes a per-session discovery file (host, port, random token) into a private per-user directory.
  • The oid-mcp server (this package) is launched by your MCP client, reads the discovery file, connects with the token, and does the heavy lifting (decode, PNG rendering, stats, .npy) outside the fragile debugger process.

You run the debugger; the MCP client runs oid-mcp. They find each other through the discovery directory, so both must be able to read the same directory (see Troubleshooting).

Prerequisites

  • A built and installed OpenImageDebugger with a deployed oid.py. See the top-level README's Building the Open Image Debugger.
  • A debugger with embedded Python: gdb, or (on macOS) Homebrew lldb — the same debugger you already use with OID.
  • uv — runs the server in a managed virtualenv, no manual pip install needed. Install with curl -LsSf https://astral.sh/uv/install.sh | sh (or brew install uv).
  • An MCP-capable client (e.g. Claude Code).

Deploy

  1. Verify the server launches (optional but recommended). From a shell:

    bash
    uv run --directory /path/to/OpenImageDebugger/resources/oidmcp oid-mcp

    The first run resolves mcp/numpy/pillow into a local venv. It prints an experimental/security warning to stderr and then waits for MCP traffic on stdin — that blocking wait means it started correctly. Press Ctrl-C to exit.

  2. Register it with your MCP client. Every stdio MCP client uses the same mcpServers schema — only the file location differs. Each client spawns its own oid-mcp process, so you can register it in several clients at once; they all discover the same debug session.

    Claude Code — one-liner:

    bash
    claude mcp add oid -- \  uv run --directory /path/to/OpenImageDebugger/resources/oidmcp oid-mcp

    or add it to .mcp.json:

    json
    {  "mcpServers": {    "oid": {      "command": "uv",      "args": ["run", "--directory",               "/path/to/OpenImageDebugger/resources/oidmcp",               "oid-mcp"]    }  }}

    Cursor — put the same entry in ~/.cursor/mcp.json (global, all projects) or <workspace>/.cursor/mcp.json (one project). Settings → MCP / Tools & Integrations → Add new MCP server opens that file. The tools are only usable from Cursor's Agent chat.

    json
    {  "mcpServers": {    "oid": {      "command": "/absolute/path/to/uv",      "args": ["run", "--directory",               "/path/to/OpenImageDebugger/resources/oidmcp",               "oid-mcp"]    }  }}

    Use an absolute command path in desktop editors. Cursor and other GUI IDEs do not inherit your shell PATH, so a bare "uv" often fails to launch. Use the output of command -v uv (e.g. /opt/homebrew/bin/uv with Apple-Silicon Homebrew). The same goes for any interpreter the client can't resolve on its own.

    Optional environment variables (set them on the server entry via your client's env field, and — for OID_AGENT_DIR — on the debugger too):

    VariableDefaultPurpose
    OID_MCP_MAX_BYTES268435456 (256 MiB)Reject buffers larger than this before transfer
    OID_AGENT_DIR~/.oid-agent/ (%LOCALAPPDATA%\oid-agent on Windows)Discovery directory shared by debugger and server

    Discovery location. The default directory is derived from your home directory (via the password database), so a GUI-spawned oid-mcp and a terminal debugger resolve the same path regardless of $TMPDIR/$HOME. To relocate it, set OID_AGENT_DIR in both environments to the same absolute path (~ is not expanded).

Use

  1. Start the debugger with the endpoint enabled and OID loaded:

    bash
    OID_AGENT=1 gdb ./your-program(gdb) source /path/to/OpenImageDebugger/oid.py

    lldb works the same way:

    bash
    OID_AGENT=1 lldb ./your-program(lldb) command script import /path/to/OpenImageDebugger/oid.py

    (If oid.py is already in your ~/.gdbinit / ~/.lldbinit, just launch the debugger with OID_AGENT=1 in its environment.)

  2. Run to a breakpoint. The endpoint activates and publishes its discovery file on the first stop. The OID viewer window also opens as usual — plot needs it, the other tools do not.

  3. Drive it from the agent. A typical flow:

    text
    list_sessions()                       # confirm the server sees your debuggerlist_buffers()                        # what's observable at this stopview("frame")                         # look at the whole bufferview("frame", region=[100,100,64,64]) # zoom into a suspicious spotstats("frame")                        # min/max/mean/std, NaN/Inf/zero countsvalues("frame", x=100, y=100, w=4, h=4)  # exact numbers for a tiny cropdump("frame")                         # lossless .npy for offline analysisplot("frame")                         # mirror it into the human's viewer

    Every tool accepts session=<pid> to target a specific debugger when more than one is live; it defaults to the most recently started session.

Viewer sessions

The pixel tools (view, stats, values, dump, list_buffers) don't require a debugger at all. A viewer started standalone with the agent endpoint enabled:

bash
OID_AGENT=1 oidwindow --open path/to/image.png

exposes the same endpoint even with no debugger attached, so an agent can inspect whatever a user currently has open in the viewer.

When a debugger did spawn the viewer, that viewer's session carries a debugger_pid back-pointer, so set_view/get_view accept either the viewer's own pid or its debugger's pid to address that window. (The pixel tools — view/stats/values/dump/list_buffers — prefer the debugger's own buffers when given a debugger pid, and fall back to the viewer only when there's no live debugger session.) list_sessions() reports the pairing (see below).

set_view/get_view always target a viewer (there's nothing to move in a debugger without one), resolved the same way: a viewer pid, or a debugger pid paired to a live viewer.

Tools

ToolPurpose
list_sessions(){"debuggers": [...], "viewers": [...]} — live debug sessions and viewer windows (all tools take session=<pid>); each viewer entry shows its debugger_pid pairing (null for a standalone viewer)
list_buffers()Observable buffer symbols at the current stop (debugger or viewer session)
view(symbol, region?, channel?, vmin?, vmax?, max_px?)PNG rendering; region is the stateless zoom
stats(symbol, region?)Per-channel min/max/mean/std, NaN/Inf/zero counts
values(symbol, x, y, w, h, channel?)Exact numbers (≤1024 per call)
dump(symbol, path?, overwrite?)Lossless .npy dump into the per-user dump directory; path is a filename within it (not an arbitrary path); refuses to overwrite an existing file unless overwrite=true
plot(symbol)Mirror into the human viewer window
set_view(session?, buffer?, center?, zoom?, rotation_deg?, channel?, auto_contrast?)Set the viewer's view absolutely (idempotent — it sets state, it does not nudge); omitted fields keep their current value; channel is 0, 1, 2, or "all"; auto_contrast is a global viewer toggle, not per-buffer
get_view(session?)Read the viewer's current buffer/center/zoom/rotation_deg/channel/auto_contrast

Notes

  • The endpoint only starts when OID_AGENT=1 is set; it binds localhost with a per-session token (discovery files under ~/.oid-agent/, override with OID_AGENT_DIR). It exposes debuggee memory to local processes that can read those files — the same trust domain as your user account.
  • Buffers transfer fully on first access per stop and are cached; the cap is OID_MCP_MAX_BYTES (default 256 MiB).
  • The debuggee must be stopped for symbol evaluation; while it runs, tools return a retryable error.
  • The viewer window still opens on the first debugger stop (normal OID behavior); plot requires it, the other tools do not.

Troubleshooting

  • no live OID debug session found — the server can't see a session. Check, in order: OID_AGENT=1 was set in the debugger's environment; oid.py was actually sourced/imported; the debuggee has stopped at a breakpoint at least once; and the debugger and oid-mcp agree on the discovery directory. If they run under different TMPDIR values (common on macOS, where each process may get its own per-user temp dir), set OID_AGENT_DIR to the same absolute path on both sides.
  • Refusing to read OID discovery files from … (stderr) — the discovery directory is a symlink, is not owned by you, or is group/world-accessible, so a token there can't be trusted. Point OID_AGENT_DIR at a private directory you own with mode 0700.
  • The debuggee is running — pause at (or step to) a breakpoint; symbols can only be evaluated while stopped, then retry.
  • Buffer exceeds the transfer cap — raise OID_MCP_MAX_BYTES (bytes) on the server entry, or narrow what you fetch.

來源:resources/oidmcp/README.md,提交 456b918

工具

9

list_sessions

List live OID debug sessions and viewer windows this server can reach. Each viewer shows its debugger_pid pairing (None for a standalone oidwindow), so a caller can target either a debugger's session pid or its viewer window explicitly.

無需輸入參數。

list_buffers

List symbols observable as image buffers at the current stop. session: a debugger or viewer pid from list_sessions(); defaults to the most recently started live debugger session, or the most recently started live viewer window if none is live.

輸入參數session

view

Look at a buffer as an image. region: [x, y, w, h] crop in displayed coordinates (the stateless zoom: view the whole buffer, spot the artifact, view that region). channel: render one storage channel as grayscale. vmin/vmax: fix the normalization range (comparable across buffers); default normalizes per channel over the full buffer, so zooming never changes brightness. NaN pixels render magenta.

輸入參數vmaxvminmax_pxregionsymbol必填channelsession

stats

Per-channel min/max/mean/std and NaN/Inf/zero counts.

輸入參數regionsymbol必填session

values

Exact pixel values for a small crop (at most 1024 numbers).

輸入參數h必填w必填x必填y必填symbol必填channelsession

dump

Save the buffer losslessly as .npy; returns the file path. Refuses to overwrite an existing file unless overwrite=true, so an unintended path cannot clobber your data.

輸入參數pathsymbol必填sessionoverwrite

plot

Mirror a buffer into the human's OID viewer window.

輸入參數symbol必填session

set_view

Set the OID viewer's view of a buffer (absolute/idempotent). Only the fields you pass are changed; omitted fields keep their current value. session: a viewer pid or a paired debugger pid, as for the pixel tools. channel selects a single display channel by 0-based index (``0``, ``1``, ``2``) or ``"all"`` to restore the natural layout. auto_contrast is a global viewer setting (not per-buffer), matching get_view.

輸入參數zoombuffercenterchannelsessionrotation_degauto_contrast

get_view

Read the OID viewer's current view state. Returns buffer/center/zoom/rotation_deg/channel/auto_contrast. auto_contrast is global (not per-buffer).

輸入參數session

版本歷史

2
  1. v0.3.6最新Oct 26, 2026
  2. v0.3.5Sep 16, 2026

評分

已滿足適用檢查項的 90%

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

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

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

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分