Repository navigation
fix(webui): label each MCP server's connection state on the plugin row (D-3) - #27
Merged
Merged
Conversation
Roadmap D-3 (as transcribed): MCP 插件连不上时,界面上要看得见. The runtime already classifies every server (LocalMcpPublicServerStatus: available / configured / disabled / error / unavailable) and attaches the failure's own reason to the two trouble states — the panel's MCP rows rendered none of it, so a server that could not connect was visually identical to a healthy one, and the only difference left on the row was its tool count not appearing anywhere either. The row now carries a status chip in the slot the apps area already uses for its runtime state: 已连接 / 未连接 / 已停用 for the calm states (configured is deliberately NOT trouble — enabled and resting is a server that connects on use), 连接失败 in the danger tone and 不可用 in the warning tone for the trouble states, each with the runtime's own reason string as visible inline text (ellipsis-clamped with the full text on the title, so a long server error cannot push the 编辑/删除/开关 strip out of the row). The mapping lives in an exported pure function, describeWebuiMcpServerStatus, reading the loose row shape the panel already uses. The browser fixture gains setPluginManagementResult(action, result) so a listing with every connection state can be staged for the panel's reload. Tests: plugin-mcp-status.test.tsx (6 — each state's label, reason passthrough for error/unavailable including the errorMessage key, trouble states do not share the neutral tone, unknown status claims nothing, plus row-wiring source assertions) and plugin-mcp-status.spec.mjs (2 browser cases walking the real path — rail 插件 → 管理 → MCP — reading placed, loaded rows: failure states labelled with their server's own reason, calm states labelled so trouble has honest neighbours, and no invented reasons).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Roadmap D-3(转述口径,fork 的 issues 已禁用、roadmap 在团队侧,仓内无 D-3 字样可核): 「MCP 插件连不上时,界面上要看得见」.
Investigation first. The runtime already classifies every MCP server and puts it on the wire —
LocalMcpPublicServerStatus(local-runtime-v2/src/service/mcp/contracts.ts) carriesstatus: available | configured | disabled | error | unavailableplus the failure's own reason string on the two trouble states, produced bylistPublicServerStatuses(runtimeErrors→error+ reason; static prerequisites missing →unavailable+ reason). The WebUI panel's MCP rows rendered none of it: themcparea's row had only 编辑 / 删除 / 启用开关 — a server that could not connect was visually identical to a healthy one. (appStatusexists but is rendered only in theappsarea.)Fix — a status chip in the slot the apps area already uses, plus the reason as visible text:
describeWebuiMcpServerStatus(exported pure function inPluginManagement.tsx): maps the row's loose status onto a labelled view — 已连接 / 未连接 / 已停用 for the calm states (configuredis deliberately NOT trouble: enabled-and-resting is a server that connects on use), 连接失败 in the danger tone and 不可用 in the warning tone for the trouble states, each carrying the runtime's own reason (error/errorMessagekeys)..webui-plugin-mcp-status).Browser verification (built client, real Chromium, walked the real path): rail 插件 → 管理 → MCP tab with a staged listing covering all five states —
Before the change the same listing rendered no status text anywhere in the rows.
Validation
pnpm test:webui— 83 files / 1653 tests passed, including newplugin-mcp-status.test.tsx(6 cases: per-state labels, reason passthrough for both trouble states incl. theerrorMessagekey, trouble tones ≠ neutral tone, unknown-claims-nothing, row-wiring source assertions).npx playwright test— 88/88 passed, including newplugin-mcp-status.spec.mjs(2 cases, harness-importedtest: failure states labelled with their server's own reason via the real rail→管理→MCP path; calm states labelled so trouble has honest neighbours; no invented reasons).pnpm typecheck:webui-full,pnpm check:source(inventory regenerated),pnpm verify— passed, 20 gates on darwin.setPluginManagementResult(action, result)keyed per action; default stays{}, existing specs untouched.NOT RUN / boundaries
pnpm dev:serversession with a real failing server config). The status/reason fields consumed are the runtime's own contract, source-verified atlistPublicServerStatuses.Publication and contribution checks
release/public-source.json; new tests are declared intest/vitest-suites.jsonwhere applicable.Maintainer handoff
Publication scope or license changes (if any): none.
Shared-source port: not needed.