Skip to content

fix: MCP server runtime toggle & AppCapability MCP-only separation - #483

Merged
shanselman merged 1 commit into
openclaw:masterfrom
ranjeshj:fix/mcp-server-runtime-toggle
May 21, 2026
Merged

shanselman merged 1 commit into
openclaw:masterfrom
ranjeshj:fix/mcp-server-runtime-toggle

Conversation

@ranjeshj

Copy link
Copy Markdown
Contributor

Summary

Fixes the broken Local MCP Server toggle in Settings — enabling/disabling MCP at runtime now correctly starts/stops the HTTP server. Also separates \AppCapability\ (app.* tools) from the gateway so they're MCP-only.

Changes

1. Runtime MCP toggle (\NodeService.SetMcpEnabled)

  • _enableMcpServer\ was
    eadonly\ — toggling MCP in the UI never started/stopped the server
  • Added \SetMcpEnabled(bool)\ that starts/stops the MCP HTTP server at runtime
  • Called from \OnSettingsSaved\ after every settings save

2. Classifier fix (\SettingsChangeImpact)

  • Separated \EnableMcpServer\ from \EnableNodeMode\ — MCP toggle now returns \UiOnly\ instead of \NodeReconnectRequired, avoiding unnecessary gateway disconnects

3. AppCapability → MCP-only

  • Moved \AppCapability\ creation from \NodeService.RegisterCapabilities()\ to \App.xaml.cs\
  • Registered via new \RegisterMcpOnlyCapability()\ — app.* tools appear in MCP \ ools/list\ but are NOT exposed to the gateway
  • Added _mcpOnlyCapabilities\ list merged into the bridge lambda
  • Wired \WireAppCapabilityHandlers()\ after all capability registration paths (was defined but never called — pre-existing bug)

Testing

  • Build ✅ (all 4 projects)
  • Shared tests: 1803 passed, 28 skipped ✅
  • Tray tests: 1149 passed ✅
  • Connection tests: 228 passed (3 new) ✅
  • End-to-end: 37/39 MCP tools verified via curl (tts.speak = provider init, browser.proxy = needs gateway auth)

- Make NodeService._enableMcpServer mutable with SetMcpEnabled(bool) for
  runtime start/stop of the local MCP HTTP server when the user toggles
  EnableMcpServer in the Settings UI.
- Separate EnableMcpServer from EnableNodeMode in SettingsChangeClassifier
  so toggling MCP returns UiOnly (no unnecessary gateway reconnect).
- Move AppCapability out of NodeService into App.xaml.cs — registered via
  RegisterMcpOnlyCapability() so app.* tools are MCP-only and not exposed
  to the gateway. Wire handlers after capability registration in all paths
  (AttachClient, StartLocalOnlyAsync, SetMcpEnabled).
- Add _mcpOnlyCapabilities list and merge into MCP bridge lambda so
  MCP-only tools appear in tools/list without gateway registration.
- Add 3 new SettingsChangeImpact classifier tests.

Verified: build passes, 1803 shared / 1149 tray / 228 connection tests
pass, 37/39 MCP tools verified end-to-end via curl.

Co-authored-by: Copilot <[email protected]>
@shanselman
shanselman merged commit d7d7661 into openclaw:master May 21, 2026
18 checks passed
shanselman added a commit that referenced this pull request May 21, 2026
Gate system.run and system.run.prepare behind the Permissions page toggle while keeping the rest of the system capability registered. Rebuild node capabilities from current settings on reconnect so permission changes take effect without restarting the tray.

Resolved against #483/#488 after local validation.

Co-authored-by: Copilot <[email protected]>
@clawsweeper clawsweeper Bot mentioned this pull request Jun 26, 2026
10 of 17 tasks
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