Skip to content

feat(frontend): WebMCP tools for Capgo console AI agents - #3266

Draft
riderx wants to merge 2 commits into
mainfrom
cursor/webmcp-console-support-8149
Draft

feat(frontend): WebMCP tools for Capgo console AI agents#3266
riderx wants to merge 2 commits into
mainfrom
cursor/webmcp-console-support-8149

Conversation

@riderx

@riderx riderx commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary (AI generated)

  • Adds WebMCP integration to the Capgo console via document.modelContext.registerTool() (with fallback feature detection for deprecated navigator.modelContext).
  • Mounts useWebMcp() from the app shell; tools re-register on route/auth changes and unregister via AbortController on navigation/unmount.
  • Exposes six console tools grounded in existing Pinia stores and Supabase queries.

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)

Tool Auth readOnlyHint Description
console_get_context No yes Current route, auth state, org, app/channel/bundle/device context
console_list_organizations Yes yes Organizations the user belongs to
console_list_apps Yes yes Apps for current or specified org
console_list_channels Yes yes Channels for an app (PostgREST, same shape as channel table)
console_list_bundles Yes yes Bundles/app versions for an app
console_navigate Yes no SPA navigation to supported pages (dashboard, 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 builder
  • In Chrome Canary 146+ with WebMCP enabled (chrome://flags → WebMCP / document-model-context), sign in to the console
  • DevTools console: await document.modelContext.getTools() lists the tools above
  • Call console_get_context — returns path + org/app context matching the visible page
  • Call console_list_apps — returns apps for the active org
  • Call console_navigate with { "page": "app_channels", "appId": "<your-app>" } — SPA navigates to channels
  • Sign out — only console_get_context remains registered
  • Browsers without WebMCP — console loads normally, no errors

Generated with AI

Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

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>
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@riderx
riderx deployed to deepsec-pr September 5, 2026 21:22 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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

@codspeed-hq

codspeed-hq Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 49.8%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 42 untouched benchmarks
⏩ 2 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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>
@cursor
cursor Bot deployed to deepsec-pr September 5, 2026 22:08 Active
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2026

Copy link
Copy Markdown

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