@geohar/opencode-svg-mcp

中文文档
0.10.7发布于 2026/11/10GPL-2.0-or-laterTypeScriptES Module零依赖构建来源已验证近 30 天下载 2709

OpenCode plugin: run the svg-mcp MCP server via sharedserver and register its endpoint with OpenCode. Stands down when a combiner already serves svg-mcp.

原始使用文档
文档目录6 节
  1. What it does
  2. Which svg-mcp runs
  3. Install
  4. Options
  5. Requirements
  6. Relationship to the other plugins

@geohar/opencode-svg-mcp

An OpenCode plugin that makes the svg-mcp MCP server available to OpenCode: it starts svg-mcp (supervised by sharedserver) and registers its HTTP MCP endpoint with OpenCode — and stands down when a combiner already serves svg-mcp.

It is the OpenCode counterpart of svg-mcp's Claude Code plugin (a SessionStart shell hook), and mirrors its behaviour exactly.

Using it: author and edit diagrams and SVGs through svg-mcp's tools — create_document, the add_* primitives, boolean for path union/difference, and export_render to render-and-see — rather than hand-writing or textually patching raw SVG XML. That construct → render → see → iterate loop is the point of svg-mcp.

What it does

  1. Stand-down switch. If a combiner already serves svg-mcp, the plugin does nothing — it neither registers a standalone MCP entry nor launches a backend (the combiner owns svg-mcp's lifecycle):
    • MCP_COMBINER=1 — global switch: a combiner serves my MCPs.
    • MCP_COMBINER_SERVES_SVG_MCP=0|1 — per-backend override (wins over the global switch).
  2. Register. Otherwise it injects svg-mcp into OpenCode's mcp config as a type: "remote" endpoint (default http://127.0.0.1:7731/mcp). A svg-mcp entry you defined yourself in opencode.json is left untouched.
  3. Run one warm svg-mcp. It drives sharedserver:
    sharedserver use svg-mcp --pid <opencode-pid> --grace-period 1h \
        -- <svg-mcp serve argv>
    
    sharedserver refcounts by PID with a grace period, so one svg-mcp process is shared across clients (OpenCode, Claude Code, Neovim) and outlives any single one — paying svg-mcp's cold start (numpy + pillow) once. The plugin runs unuse on OpenCode exit.

Which svg-mcp runs

Mirrors the Claude Code hook:

modeargv
defaultuvx svg-mcp@<version> --transport streamable-http --port <port> (pinned)
SVG_MCP_DEV=<dir>uv run --project <dir> svg-mcp … (a dev checkout)
SVG_MCP_DEV=1uv run --project <repo> svg-mcp … (in-repo source, if resolvable)

The default pin is this package's version, kept in lockstep with the svg-mcp PyPI release — so a plugin version and the served code match. (Every published plugin version needs a matching PyPI release, or uvx cannot resolve it.)

Install

Add it to your opencode.json plugin list:

{
  "plugin": [
    "@geohar/opencode-svg-mcp@latest"
  ]
}

With options (all optional — defaults shown):

{
  "plugin": [
    ["@geohar/opencode-svg-mcp@latest", {
      "port": 7731,
      "gracePeriod": "1h",
      "manage": true,
      "register": true,
      "notify": true
    }]
  ]
}

Options

optiondefaultmeaning
mcpName"svg-mcp"key under OpenCode's mcp config
urlhttp://127.0.0.1:<port>/mcpMCP URL to register
registertrueregister the endpoint with OpenCode
managetruelaunch/attach svg-mcp via sharedserver (false → register only)
binaryautopath to the sharedserver binary ($SHAREDSERVER_BIN also honoured)
lockdir—override SHAREDSERVER_LOCKDIR
name"svg-mcp"sharedserver instance name
gracePeriod"1h"sharedserver grace period
logFile—capture svg-mcp output (sharedserver --log-file)
port7731 ($SVG_MCP_PORT)HTTP port svg-mcp serves on
versionpackage version ($SVG_MCP_VERSION)PyPI release to pin
dev$SVG_MCP_DEVdev checkout path, or true/"1" for in-repo source
notifytrueshow TUI toasts for attach/health outcomes

Requirements

  • curl and uv — nothing else. The plugin fetches sharedserver itself on first use if it isn't already present (prebuilt, so no Rust toolchain), and runs svg-mcp via uvx.
  • To supply your own instead: an svg-mcp or sharedserver already on PATH is used as-is, as are the binary option and $SHAREDSERVER_BIN. Neither is silently replaced.

Relationship to the other plugins

svg-mcp behind a combiner is served through mcp-combiner; set MCP_COMBINER=1 (or run mcp-combiner env-disable) and this plugin stands down. The Claude Code counterpart ships in the svg-mcp repo's marketplace.

版本与发布记录

@geohar/opencode-svg-mcp 共发布 32 个版本,首次发布于 2026/07/18;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.10.7latest2026/11/106 天前
0.10.62026/11/097 天前
0.10.52026/11/097 天前
0.10.42026/11/097 天前
0.10.32026/11/097 天前
0.10.22026/11/097 天前

其他发布通道:dev → 0.10.0-dev.2。

关于 @geohar/opencode-svg-mcp 的常见问题

@geohar/opencode-svg-mcp 是什么?

OpenCode plugin: run the svg-mcp MCP server via sharedserver and register its endpoint with OpenCode. Stands down when a combiner already serves svg-mcp.

如何安装 @geohar/opencode-svg-mcp?

在项目目录运行 npm install @geohar/opencode-svg-mcp,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@opencode-ai/plugin(>=1.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@geohar/opencode-svg-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@geohar/opencode-svg-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@geohar/opencode-svg-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@geohar/opencode-svg-mcp 可以商用吗?

@geohar/opencode-svg-mcp 使用 GPL-2.0-or-later 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@geohar/opencode-svg-mcp 的下载量有多少?

根据 npm 官方下载统计,@geohar/opencode-svg-mcp 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,709 次,日均约 90 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@geohar/opencode-svg-mcp 还在维护吗?

最新版本 0.10.7 发布于 2026/11/10(6 天前);至今共发布 32 个版本,其中过去 12 个月发布了 32 个;首次发布于 2026/07/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。