feat(mcp): connection health toolbar with bulk Retry All / Disconnect All actions
Summary
- New MCP Connection Health Toolbar in the left pane of
Channels → ChannelConfigPanel → McpServersTab. Surfaces aggregate per-state counts (connected / connecting / error / idle) and exposes two bulk actions that previously required clicking into each server one at a time. - Retry All
(N)— visible only when there are errored servers. Iterates through them viamcpClientsApi.connect(id)wrapped inPromise.allSettledso one bad apple doesn't abort the batch, then refreshes statuses once at the end. - Disconnect All
(N)— visible only when there are connected servers. Gated behind arole="dialog" aria-modalconfirmation dialog before the bulk RPC fires. - The status summary is announced through a
role="status" aria-live="polite"region so screen-reader users hear updates as the 5-second polling loop refreshes. Status dots arearia-hidden. Buttons have descriptivearia-labels with interpolated counts. - 15 new i18n keys under
mcp.health.*mirrored across all 13 locale chunks (English values used as untranslated placeholders per the repo's standard pattern). - 17 new Vitest tests covering count aggregation, conditional button rendering, dialog open/cancel/confirm flow, partial-failure orchestration via
Promise.allSettled, error surfacing throughrole="alert", and the a11y attribute contract on every interactive element.
Problem
MCP servers in this app can drift into error state for legitimate reasons — a key expired, a managed runtime restart cycle, a flaky upstream HTTP-remote server. Today, recovering means clicking each errored server individually in the list, navigating to its detail view, and hitting connect. With three or four servers it's tedious; with the ten-plus shape that real Smithery users hit, it's a chore.
Disconnect-all is symmetric — useful during debugging ("what changes if I cut all MCP connections?"), useful during shutdown, useful for the user who just installed a server with bad env vars and wants a clean reset across the board.
There's also no aggregate at-a-glance status. The list shows per-server dots, but counting "how many am I currently connected to?" requires scanning. For users with a dozen servers, that scan happens visually every time they open the tab.
Solution
New component McpConnectionHealthToolbar.tsx
Renders only when statuses.length > 0 — preserves the existing "empty install + Browse catalog CTA" empty state by not competing for vertical space.
Layout (compact, fits the 224px left pane):
┌────────────────────────────────────────┐
│ HEALTH Retry all (1) Disconnect │
│ all (3) │
│ ● 3 connected ● 1 error ● 2 idle │
└────────────────────────────────────────┘
Status pills use the existing color vocabulary from McpStatusBadge (sage/amber/coral/stone). Dots flow on a flex flex-wrap row so the layout doesn't break at narrower widths.
Aggregation (in computeHealthCounts, exported as a pure helper):
- Single pass over
statusesproducingconnectedIds,errorIds, and counts forconnecting/disconnected.useMemokeyed onstatusesso the bulk action targets don't recompute on unrelated re-renders. connectedIdsanderrorIdsare arrays (not just counts) — the same memoization payload powers both the visual badges and the bulk-action callbacks, so there's no risk of the displayed count diverging from the IDs that would be acted on.
Bulk action flow (Retry All):
- Click
Retry all (N)— callsonReconnect(errorIds); setsisOperating=trueto disable both buttons. - Parent (
McpServersTab.handleBulkReconnect) doesPromise.allSettled(errorIds.map(id => mcpClientsApi.connect(id)))followed byfetchStatuses(). - On resolve,
isOperating=false; the next render reflects the new statuses; the buttons re-enable. - On parent throw:
setOpError(err.message)displays the failure in arole="alert"paragraph below the summary. Falls back tot('mcp.health.opErrorGeneric')for non-Error throws.
Bulk action flow (Disconnect All):
- Click
Disconnect all (N)— opens confirmation dialog withrole="dialog" aria-modal="true"and explicitaria-labelledby/aria-describedbyreferencing the title and body IDs. - Cancel → close dialog,
onDisconnectnever fires. - Confirm → close dialog, then run the same
Promise.allSettledorchestration viaonDisconnect(connectedIds).
Wiring in McpServersTab.tsx
- Imports the new component.
- Adds
handleBulkReconnectandhandleBulkDisconnectasuseCallbacks alongside the existinghandleInstallSuccess/handleUninstalledhandlers. Both callPromise.allSettledon per-server RPC thenfetchStatuses()for one round-trip refresh. - Renders
<McpConnectionHealthToolbar>above<InstalledServerList>in the left pane, after the existingloadErrorblock.
i18n
15 new keys under the mcp.health.* namespace added to app/src/lib/i18n/en.ts AND to app/src/lib/i18n/chunks/en-1.ts (the runtime chunk that already holds the existing mcp.* keys). All 12 non-English locale chunks (ar-1.ts … zh-CN-1.ts) get the same six keys with the English value as the untranslated placeholder, per the project pattern that scripts/i18n-coverage.ts enforces.
Verified locally:
$ pnpm i18n:check
…
## zh-CN (2997 keys)
missing: 0 extra: 0 drifted chunks: 0
per-chunk: 1:1206/1206 2:387/387 3:389/389 4:391/391 5:629/629
(same shape for ar, bn, de, es, fr, hi, id, it, ko, pt, ru)
EXIT: 0
Submission Checklist
- [x] Tests added — 17 new tests in
McpConnectionHealthToolbar.test.tsx. Cover: empty-state return-null path; correct count aggregation across mixed status sets; conditional rendering of connecting / error pills only when non-zero; conditional rendering of Retry All only when errors exist; conditional rendering of Disconnect All only when connected exist; "Retry all" callsonReconnectwith exactly the errored IDs; "Disconnect all" opens a confirmation dialog rather than firing directly; cancel closes the dialog without callingonDisconnect; confirm firesonDisconnectwith exactly the connected IDs and closes the dialog; both action buttons are disabled during a pending bulk operation; errors thrown fromonReconnectsurface viarole="alert"; non-Error throws fall back to a generic message; the summary region hasrole="status"+aria-live="polite"+ a descriptivearia-label; the confirmation dialog body interpolates the correct connected count. - [x] Diff coverage ≥ 80% — every branch in
McpConnectionHealthToolbar.tsxand the newhandleBulkReconnect/handleBulkDisconnectcallbacks inMcpServersTab.tsxare exercised by the test suite. Local Vitest: 91/91 passing across the full MCP suite (8 test files); no regression in any pre-existing test. - [x] Coverage matrix updated — N/A: enhancement to existing MCP feature row, no new feature ID added or removed.
- [x] All affected feature IDs listed under
## Related— N/A. - [x] No new external network dependencies introduced — uses the existing
mcpClientsApi.connect/mcpClientsApi.disconnectround-tripped through the existing JSON-RPC. - [x] Manual smoke checklist updated if release-cut surfaces touched — N/A.
- [x] Linked issue closed via
Closes #NNNin## Related— no specific issue; organic UX improvement on the MCP surface.
Impact
- Runtime/platform: Desktop only —
McpServersTabis desktop-only viaChannelConfigPanel. No iOS / web impact. - Performance: Status aggregation is O(n) per render, memoized. Bulk actions are N parallel RPCs via
Promise.allSettled— strictly equivalent to a user manually triggering N connects/disconnects, just dispatched together. No new polling loop. - Security: Disconnect is gated behind a confirmation dialog (
role="dialog" aria-modal). The dialog body explicitly states secrets and configurations are preserved, addressing the "did I just lose my install state?" anxiety. - Backward compatibility: The toolbar returns
nullwhenstatuses.length === 0, preserving the existing zero-installed flow byte-for-byte. All pre-existing MCP tests still pass unchanged. - i18n: English values everywhere by default; the same 15 keys exist in every locale's chunks as untranslated placeholders, ready for native-speaker translation in follow-up PRs (they count toward each locale's
untranslatedtotal). - A11y: Live region for status changes; explicit
aria-labels with interpolated counts on action buttons;role="dialog" aria-modal aria-labelledby aria-describedbyon the confirmation modal; decorativearia-hiddenstatus dots;role="alert"for operation errors.
Related
- Closes:
- Follow-up PR(s)/TODOs:
- Native-speaker translation of the 15 new
mcp.health.*keys across the 12 non-English locales (currently fall back to English placeholders; flagged in each locale'suntranslatedcount). - Optional future: a "Refresh now" button next to the toolbar for users who want an immediate poll instead of waiting up to 5 seconds for the next tick. Skipped here to keep scope tight.
- Native-speaker translation of the 15 new
AI Authored PR Metadata
Linear Issue
- Key: N/A
- URL: N/A
Commit & Branch
- Branch:
feat/mcp-connection-health-toolbar - Commit SHA: (filled by GitHub after push)
Validation Run
All four key gates passed locally:
- [x]
pnpm --filter openhuman-app compile— clean (tsc --noEmit, no output = success). - [x]
pnpm --filter openhuman-app lint— clean for new files. The full repo currently produces 62 warnings (0 errors), of which zero are in the files this PR adds or modifies; the single warning atMcpServersTab.tsx:70:18is the pre-existingsetLoading(false)inside the initial-loaduseEffect, untouched by this PR. - [x]
pnpm vitest run src/components/channels/mcp/— 91/91 passing including the 17 new tests and all pre-existing MCP component tests (no regression). - [x]
pnpm i18n:check— exit 0, every locale at1:1206/1206parity, 0 missing keys, 0 extra keys, 0 drift.
Validation Blocked
command:pnpm --filter openhuman-app format:check(chainscargo fmt --checkvia the workspace script) and the husky pre-push hook (which runspnpm format→cargo fmt).error:'cargo' is not recognized as an internal or external command, operable program or batch file.— no Rust toolchain installed on the dev machine.impact:Usedgit push --no-verifyper CLAUDE.md's allowance for unrelated pre-existing breakage. This PR touches zero Rust files, socargo fmt --checkwould have been a no-op for the changed files. Prettier on the changed TS files runs in CI on a clean Linux checkout with LF line endings; verified locally that the new files were written with LF.
Behavior Changes
- Intended behavior change: Surfaces aggregate MCP connection health in the tab pane; introduces bulk Retry All / Disconnect All as new user actions gated behind appropriate state (errors exist / connections exist) and confirmation (for disconnect).
- User-visible effect: At-a-glance health for power users with many MCP servers; one-click recovery of bulk error states; one-confirmation cut-all-connections for debugging or reset.
Parity Contract
- Legacy behavior preserved: When
statuses.length === 0, the toolbar returnsnull— the existing layout renders exactly as before. All pre-existing MCP tests pass unchanged. Per-server connect/disconnect via the existing detail view is untouched. - Guard/fallback/dispatch parity checks:
Promise.allSettledensures partial failures within a bulk action don't abort the rest; the next poll tick reconciles any drift; thrown errors at the orchestration boundary surface throughrole="alert"rather than being swallowed.
Duplicate / Superseded PR Handling
- Duplicate PR(s): None known.
- Canonical PR: This one.
- Resolution: N/A.
Summary by CodeRabbit
-
New Features
- MCP connection health toolbar showing live connected/connecting/error/disconnected counts
- "Retry all" bulk reconnect and "Disconnect all" bulk disconnect (with confirmation) actions
-
Accessibility
- Live status announcements and accessible confirmation dialog/alerts
-
Localization
- Added MCP health UI translations in 15 languages
-
Tests
- Comprehensive tests covering rendering, actions, error states, and accessibility behavior
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e10bb09f-b26c-4661-b6ab-a5092f98f519
📥 Commits
Reviewing files that changed from the base of the PR and between 7c132817f3335c3021b06f28672b89d2512a7732 and 3301101c17f5ace3ebd83afc718aad517e0925fe.
📒 Files selected for processing (16)
app/src/components/channels/mcp/McpServersTab.test.tsxapp/src/components/channels/mcp/McpServersTab.tsxapp/src/lib/i18n/chunks/ar-1.tsapp/src/lib/i18n/chunks/bn-1.tsapp/src/lib/i18n/chunks/de-1.tsapp/src/lib/i18n/chunks/en-1.tsapp/src/lib/i18n/chunks/es-1.tsapp/src/lib/i18n/chunks/fr-1.tsapp/src/lib/i18n/chunks/hi-1.tsapp/src/lib/i18n/chunks/id-1.tsapp/src/lib/i18n/chunks/it-1.tsapp/src/lib/i18n/chunks/ko-1.tsapp/src/lib/i18n/chunks/pt-1.tsapp/src/lib/i18n/chunks/ru-1.tsapp/src/lib/i18n/chunks/zh-CN-1.tsapp/src/lib/i18n/en.ts
✅ Files skipped from review due to trivial changes (5)
- app/src/lib/i18n/chunks/en-1.ts
- app/src/lib/i18n/chunks/id-1.ts
- app/src/lib/i18n/chunks/hi-1.ts
- app/src/lib/i18n/chunks/zh-CN-1.ts
- app/src/lib/i18n/chunks/ar-1.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- app/src/lib/i18n/chunks/fr-1.ts
- app/src/lib/i18n/chunks/it-1.ts
- app/src/lib/i18n/chunks/pt-1.ts
- app/src/lib/i18n/chunks/de-1.ts
- app/src/lib/i18n/chunks/ru-1.ts
- app/src/lib/i18n/chunks/ko-1.ts
- app/src/lib/i18n/en.ts
📝 Walkthrough
Walkthrough
This PR introduces McpConnectionHealthToolbar, a new React component that aggregates MCP server connection health and provides bulk reconnect and disconnect capabilities. The component integrates into McpServersTab with handlers that run parallel operations and report partial failures. Includes comprehensive test coverage and i18n strings across 14 locales.
Changes
MCP Connection Health Toolbar
| Layer / File(s) | Summary |
|---|---|
Component interface and health computation app/src/components/channels/mcp/McpConnectionHealthToolbar.tsx (lines 1–41) |
Public props (statuses, onReconnect, onDisconnect) and HealthCounts shape; computeHealthCounts() derives per-state counts and server ID lists from statuses. |
Component state and async bulk action handlers app/src/components/channels/mcp/McpConnectionHealthToolbar.tsx (lines 73–127) |
Internal state for operation guard, confirm dialog, and error storage; async handlers for "Retry all" and "Disconnect all" with try/catch and operation gating. |
UI rendering with dialogs and accessibility app/src/components/channels/mcp/McpConnectionHealthToolbar.tsx (lines 129–245) |
Conditional action buttons, role="status" aria-live="polite" live region for counts, role="alert" error messaging, and accessible disconnect confirmation modal with aria attributes. |
McpConnectionHealthToolbar test suite app/src/components/channels/mcp/McpConnectionHealthToolbar.test.tsx |
Rendering, count display, conditional buttons, bulk-action flows (confirm/cancel/Escape), async disabling, error handling, and accessibility assertions. |
Integration into McpServersTab app/src/components/channels/mcp/McpServersTab.tsx (lines 16, 143–189, 222–233) |
Import toolbar; implement handleBulkReconnect and handleBulkDisconnect using Promise.allSettled for parallel operations with status refresh and partial-failure error reporting. |
McpServersTab bulk-action integration tests app/src/components/channels/mcp/McpServersTab.test.tsx (lines 69–78, 450–496) |
STATUSES_ERROR fixture and two tests verifying API calls and partial-failure alert surfacing for retry and disconnect operations. |
Internationalization translations app/src/lib/i18n/chunks/{ar,bn,de,en-1,es,fr,hi,id,it,ko,pt,ru,zh-CN}-*.ts, app/src/lib/i18n/en.ts |
mcp.health.* keys for 14 locales covering health title/aria, connection-state counts, bulk action labels/aria, disconnect confirmation dialog, and bulk operation error messages. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
- graycyrus
- oxoxDev
🐰 A toolbar springs to health,
Counting servers, retrying all,
With dialogs so wise—
Async guards do their dance,
Translations bloom worldwide! ✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately and concisely summarizes the main change: adding a connection health toolbar component with bulk Retry All and Disconnect All actions for MCP servers. It is specific, clear, and directly reflects the primary objective of the changeset. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
I see @oxoxDev has requested changes — deferring to their feedback. Will review once those are addressed.
Thanks @oxoxDev! Addressed in the latest push:
Nit — Esc on the Disconnect-all dialog: added an Escape handler that closes the confirmation without firing the bulk RPC, matching the modal-dismiss affordance of the other MCP dialogs. The listener attaches only while the dialog is open and is declared before the component's early return (rules of hooks). New test pins Esc → dialog closed + onDisconnect not called.
Major — i18n parity (pl): rebased onto current main. pl-1.ts uses a ...en1 spread so it inherits every key with English fallback automatically — i18n:check passes EXIT 0 with 0 missing (incl. pl), no per-key edits needed. (My #2655 inventory feature landed on main in the meantime, so the merge also reconciles the toolbar + inventory wiring/keys as a union.)
The Retry-All success/failure-count nit and the dialog-snapshot question are good follow-ups; happy to take them in a focused PR so this one stays scoped to the toolbar.
Validation: i18n:check EXIT 0, 18 toolbar tests pass, tsc clean, eslint clean, prettier clean.
I see @oxoxDev has requested changes — deferring to their feedback. Will review once those are addressed.