Mcp Watchdog
Opencode plugin: auto-check and reconnect failed MCP servers, with TUI toast status
0
836
近 7 天 24
38.0
生态多维模型
5 天前
2026-09-30
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@mrcarb0n/opencode-mcp-watchdog@1.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@mrcarb0n/opencode-mcp-watchdog@1.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @mrcarb0n/opencode-mcp-watchdogOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Opencode plugin: on every startup it checks all configured MCP servers via opencode's own API, reconnects the failed ones, and shows a TUI toast summary. No sidecar processes — opencode core keeps owning MCP lifecycles.
Install
Via config (npm):
{ "plugin": ["@mrcarb0n/opencode-mcp-watchdog"] }
Restart opencode — Bun installs it automatically. ~8s after launch, if anything needs attention you get a toast like:
MCP watchdog (startup)
14/15 connected · failed: github (spawn npx ENOENT…) · disabled: git
All-green startups stay quiet. Reconnects run sequentially (parallel
npx spawns thundering-herd the registry into probe timeouts). If the
status probe itself times out, the toast says showing last-known
instead of presenting stale data as fresh. Unknown states are listed
under other: name (status).
Local alternative (build first, then copy the bundle):
npm run build
cp dist/index.js ~/.config/opencode/plugins/mcp-watchdog.js
Tool
mcp_watchdog with one arg:
status— list every server with state (✓ connected,✗ failed,○ disabled,⚠ needs_auth)reconnect— reconnect failed servers now (always runs, bypasses the cooldown), report what recovered plus the reason for each still-failing server
Triggers
| Trigger | Behavior |
|---|---|
| Startup (+8s) | check + heal, toasts only if something recovered/failed |
server.connected |
check + heal + toast (15s cooldown from run end; concurrent triggers share one run) |
session.error |
silent heal, toasts only if something recovered/failed |
Servers reporting needs_auth / needs_client_registration are listed, never
retried. Outside the TUI (serve/web/headless) the summary is logged
(mcp-watchdog service, info level) instead of toasted and the
tool keeps working.
Development
Requires Node.js 18+.
npm install # install dependencies
npm run build # compile src/ to dist/
npm test # build + run test suite
npm run check # typecheck without emitting
npm run lint # eslint
npm run format # prettier check
Push single commits to main with
conventional commit messages —
release-please accumulates them into a release PR, and merging it publishes
the next version automatically.
同类生态推荐
Browser
opencode-browser
OpenCode plugin that integrates Browser MCP for browser automation
Qoder Bridge
opencode-qoder-bridge
Qoder provider plugin for OpenCode powered by the official Qoder Agent SDK, with streaming, tools, MCP, sessions, multimodal input, and quota tracking.
Navigator
opencode-navigator
Search, navigate, and manage OpenCode sessions from the TUI