Skip to content

feat(clerk-js): add experimental WebMCP tools for browser agents - #9899

Draft
djgould wants to merge 8 commits into
mainfrom
devin/webmcp-sdk-support-e338ca
Draft

djgould wants to merge 8 commits into
mainfrom
devin/webmcp-sdk-support-e338ca

Conversation

@djgould

@djgould djgould commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds opt-in experimental: { webmcp: true }. In browsers with WebMCP (document.modelContext), clerk-js registers tools so in-browser agents can sign in to Clerk apps without handling credentials:

  • clerk_get_auth_state: auth state, or the instance's sign-in methods when signed out
  • clerk_sign_in: passkey and saved-password sign-in through browser prompts, OAuth/enterprise SSO redirect, email link, email/SMS code
  • clerk_submit_code: first-factor, MFA and new-device codes
  • clerk_switch_organization, clerk_sign_out

The tools are registered once and check the auth state when called.

Each tool call dispatches a clerk:webmcp event on window with { tool, status, strategy }, so apps can track agent activity in their own analytics.

The module is lazy-loaded with no runtime @clerk/shared imports. clerk.js and clerk.no-rhc.js inline it, so bundlewatch limits go up for clerk.js (554→556KB), clerk.no-rhc.js (320→323KB) and clerk.legacy.browser.js (122.5→124KB, which had 0.03KB headroom).

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Oct 5, 2026 6:58pm UTC
swingset Ready Ready Preview Oct 5, 2026 6:58pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d5f1de4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/chrome-extension Patch
@clerk/electron Patch
@clerk/expo Patch
@clerk/mosaic Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/swingset Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 23, 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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9899

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9899

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9899

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9899

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9899

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9899

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9899

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9899

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@9899

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9899

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9899

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9899

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9899

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9899

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9899

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@9899

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9899

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9899

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9899

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9899

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9899

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9899

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9899

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9899

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9899

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9899

commit: d5f1de4

djgould and others added 6 commits October 5, 2026 12:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… or saved password is used

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d one isn't available

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no saved password is chosen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hem on sign-in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apps can listen on window and send agent activity to their own analytics. The event carries the tool name, result status and sign-in strategy, never the identifier or code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
Preview – swingset — d5f1de4f Deployed Oct 5, 2026 by vercel[bot]
Preview – clerk-js-sandbox — d5f1de4f Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant