Skip to content

feat(config): add showMcpUI setting to enable/disable MCP UI widgets#494

Open
edgarsskore wants to merge 4 commits into
mainfrom
feat/config-ui-enable
Open

feat(config): add showMcpUI setting to enable/disable MCP UI widgets#494
edgarsskore wants to merge 4 commits into
mainfrom
feat/config-ui-enable

Conversation

@edgarsskore

@edgarsskore edgarsskore commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Add a user-editable showMcpUI config field that explicitly controls whether tools advertise interactive UI widgets. Decision priority: explicit override > A/B experiment assignment > default ON.

  • The decision is resolved once per server process so a session renders consistently; changing the setting takes effect after the client restarts the MCP server (mid-session tools-list flips confuse hosts that bind UI to the cached list).
  • set_config_value response and the field description note the restart requirement.
  • Config editor shows the effective decision when the value is unset, so the toggle reflects reality instead of rendering unset as off.
  • Config editor now shows a quiet inline "Saved" confirmation next to the setting that changed (covers toggles, inputs, shell select, and list modals); errors keep the floating tooltip.

Summary by CodeRabbit

  • New Features
    • Added a new configuration option to explicitly control whether MCP UI widgets render; unset uses automatic behavior.
    • Config viewer now shows the effective (tri-state) value for this setting.
    • Updating the option includes a note that it takes effect after an app restart.
  • UI Improvements
    • Config editor now displays per-setting “Saved” confirmation chips after successful updates.
  • Tests
    • Added coverage for MCP UI user-override behavior, including non-boolean override handling.

Add a user-editable showMcpUI config field that explicitly controls
whether tools advertise interactive UI widgets. Decision priority:
explicit override > A/B experiment assignment > default ON.

- The decision is resolved once per server process so a session renders
  consistently; changing the setting takes effect after the client
  restarts the MCP server (mid-session tools-list flips confuse hosts
  that bind UI to the cached list).
- set_config_value response and the field description note the restart
  requirement.
- Config editor shows the effective decision when the value is unset,
  so the toggle reflects reality instead of rendering unset as off.
- Config editor now shows a quiet inline "Saved" confirmation next to
  the setting that changed (covers toggles, inputs, shell select, and
  list modals); errors keep the floating tooltip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a new boolean showMcpUI server config key and wiring, lets a user override short-circuit A/B experiment logic (cached per server session), updates config tools to show the effective tri-state value and restart note, and adds per-row inline save confirmations in the config editor.

Changes

MCP UI Override with Inline Save Feedback

Layer / File(s) Summary
Config field schema setup
src/config-field-definitions.ts, src/config-manager.ts
showMcpUI is defined as a new boolean field in CONFIG_FIELD_DEFINITIONS and added as an optional property to ServerConfig with comment about override/automatic semantics.
AB test override logic and tests
src/utils/mcp-ui-ab-test.ts, test/ab-test.test.js
Adds getUserOverride dependency; resolveMcpUiPreviewDecision checks getUserOverride() and returns boolean overrides immediately, bypassing A/B assignment; shouldShowMcpUiPreviews caches the resolved decision per process. Tests exercise false/true/non-boolean override precedence and experiment fall-through.
Config tools implementation
src/tools/config.ts
getConfig awaits shouldShowMcpUiPreviews() to compute effectiveShowMcpUI and substitutes it when the stored value is undefined; setConfigValue augments successful responses for showMcpUI with a restart-required notice.
Server tool descriptions and telemetry
src/server.ts
Updated get_config and set_config_value tool descriptions to document the showMcpUI key and its restart-required behavior; server now records set_config_value_bool telemetry when the updated config key is showMcpUI.
Config editor inline save feedback
src/ui/config-editor/src/app.ts, src/ui/styles/apps/config-editor.css
apply() now returns a success tooltip payload; UI renders a hidden per-entry .setting-save-status span and manages per-key timers; emitTooltip accepts an optional key so success shows a row-specific "Saved" chip; all control handlers (toggle, number input blur, shell select, custom shell commit, string edit) and modal save callbacks pass entry.key. CSS adds styling for the save-status element.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

size:L

Poem

🐰✨ I nudged a toggle, hid or showed with care,
A/B tests bowed down when users chose their share,
The editor chirps "Saved" beside each little row,
No floating noise, just tiny green glow,
One session decides — then off I hop, hooray! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 describes the main change: adding a new showMcpUI configuration setting to control MCP UI widget visibility across the codebase.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/config-ui-enable

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@edgarsskore edgarsskore marked this pull request as ready for review June 10, 2026 11:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/ui/config-editor/src/app.ts`:
- Line 593: The inline save-status chip (the <span class="setting-save-status"
data-save-status-key="${escapeHtml(entry.key)}" ...>) lacks live-region
semantics; update the span rendered in app.ts (the element that uses class
"setting-save-status" and data-save-status-key) to include role="status",
aria-live="polite", and aria-atomic="true" so assistive tech announces save
confirmations, and apply the same attributes to the other occurrences of the
same span (lines around where controlHtml is injected).
- Around line 642-643: The selector built with
querySelector(`[data-save-status-key="${key}"]`) can break for keys containing
CSS-special characters; update the lookup to escape the key using CSS.escape
before embedding it in the selector so the element is reliably found (i.e.,
replace the plain `${key}` usage when constructing the selector for
data-save-status-key used to set const chip = container.querySelector(...)).
Ensure you reference CSS.escape(key) so the selection logic always returns the
correct HTMLElement or null.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c5429b6-1fa3-4dd9-b532-09f72ca58612

📥 Commits

Reviewing files that changed from the base of the PR and between 7126346 and d3f6696.

📒 Files selected for processing (8)
  • src/config-field-definitions.ts
  • src/config-manager.ts
  • src/server.ts
  • src/tools/config.ts
  • src/ui/config-editor/src/app.ts
  • src/ui/styles/apps/config-editor.css
  • src/utils/mcp-ui-ab-test.ts
  • test/ab-test.test.js

Comment thread src/ui/config-editor/src/app.ts Outdated
Comment thread src/ui/config-editor/src/app.ts Outdated
edgarsskore and others added 3 commits June 10, 2026 14:55
The inline save-status chip replaced the floating live-region tooltip for
success messages, which dropped screen-reader announcements. Mark the chip
as a polite atomic status region so saves are announced again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keys currently come from CONFIG_FIELD_KEYS and are selector-safe, but the
editor accepts arbitrary entry keys from structuredContent, so escape before
embedding in querySelector.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
set_config_value already tagged server_call_tool with the key name, so we
knew the setting was used but not which way it was set. Tag the boolean
value for showMcpUI specifically (no path/PII concern); other config keys
stay key-name only.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/server.ts`:
- Around line 1231-1233: The telemetry capture for the showMcpUI configuration
is not validating the input type before stringifying it. Add a type guard to
verify that the value is actually a boolean using typeof check before setting
telemetryData.set_config_value_bool. Only when the value passes the boolean type
check should you then stringify it and assign it to the telemetry field. This
prevents malformed client payloads from leaking arbitrary text into the
telemetry metric.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0023003-4c9c-4b51-a2dc-71865b001252

📥 Commits

Reviewing files that changed from the base of the PR and between 6e685ea and c2c70c0.

📒 Files selected for processing (1)
  • src/server.ts

Comment thread src/server.ts
Comment on lines +1231 to +1233
if ((args as any).key === 'showMcpUI') {
telemetryData.set_config_value_bool = String((args as any).value);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard telemetry capture to booleans only before stringifying.

On Line 1232, String((args as any).value) records any input type for showMcpUI before validation runs. A malformed client payload could leak arbitrary text into telemetry and corrupt the intended boolean metric. Only emit this field when typeof value === 'boolean'.

Suggested patch
-            if ((args as any).key === 'showMcpUI') {
-                telemetryData.set_config_value_bool = String((args as any).value);
-            }
+            if ((args as any).key === 'showMcpUI' && typeof (args as any).value === 'boolean') {
+                telemetryData.set_config_value_bool = String((args as any).value);
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ((args as any).key === 'showMcpUI') {
telemetryData.set_config_value_bool = String((args as any).value);
}
if ((args as any).key === 'showMcpUI' && typeof (args as any).value === 'boolean') {
telemetryData.set_config_value_bool = String((args as any).value);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/server.ts` around lines 1231 - 1233, The telemetry capture for the
showMcpUI configuration is not validating the input type before stringifying it.
Add a type guard to verify that the value is actually a boolean using typeof
check before setting telemetryData.set_config_value_bool. Only when the value
passes the boolean type check should you then stringify it and assign it to the
telemetry field. This prevents malformed client payloads from leaking arbitrary
text into the telemetry metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants