feat(frontend): WebMCP tools for Capgo console AI agents - #3266
Conversation
Register document.modelContext tools so in-browser AI agents can read console context, list apps/channels/bundles, and navigate supported routes. Feature-detect WebMCP, gate authenticated tools behind session, and unregister tools on route change via AbortController. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
|
@coderabbitai review |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Merging this PR will degrade performance by 49.8%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | /updates manifest response with metadata |
136.4 µs | 271.8 µs | -49.8% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cursor/webmcp-console-support-8149 (651af11) with main (62dd028)
Footnotes
-
2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
- Import useWebMcp explicitly in App.vue for vue-tsc - Cast route params to a string map for typed route context parsing - Extract shared schema/auth/list helpers to webmcpConsoleHelpers - Collapse duplicate navigate path builders in webmcpConsolePaths Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
|
@coderabbitai review |
|



Summary (AI generated)
document.modelContext.registerTool()(with fallback feature detection for deprecatednavigator.modelContext).useWebMcp()from the app shell; tools re-register on route/auth changes and unregister viaAbortControlleron navigation/unmount.Motivation (AI generated)
Browser AI agents (Chrome WebMCP / W3C webmachinelearning/webmcp) need a standard way to discover and invoke console capabilities without scraping the DOM. This registers read-mostly tools that reuse the same client paths the UI already uses.
Business Impact (AI generated)
Signed-in users can operate the Capgo console through compatible in-browser agents (navigation, listing apps/channels/bundles, reading context). No API keys or session tokens are exposed. Unsupported browsers are unaffected.
Tools (AI generated)
console_get_contextconsole_list_organizationsconsole_list_appsconsole_list_channelsconsole_list_bundlesconsole_navigatedashboard,apps, app tabs, bundle/channel detail, settings)Authenticated tools are only registered when a session exists. Data tools verify app access via
organizationStore.getOrgByAppId().Test Plan (AI generated)
bunx vitest run tests/webmcp.unit.test.ts— feature detection + route builderchrome://flags→ WebMCP / document-model-context), sign in to the consoleawait document.modelContext.getTools()lists the tools aboveconsole_get_context— returns path + org/app context matching the visible pageconsole_list_apps— returns apps for the active orgconsole_navigatewith{ "page": "app_channels", "appId": "<your-app>" }— SPA navigates to channelsconsole_get_contextremains registeredGenerated with AI
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.