Skip to content
Draft
6 changes: 6 additions & 0 deletions .changeset/experimental-webmcp-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': minor
'@clerk/shared': minor
---

Add an experimental `webmcp` option (`experimental: { webmcp: true }`). In browsers that support [WebMCP](https://webmachinelearning.github.io/webmcp/), Clerk registers tools that let browser agents check auth state, sign in, submit verification codes, switch organizations and sign out, without ever taking a password or returning a token. Each tool call dispatches a `clerk:webmcp` event on `window` with the tool name, result status and sign-in strategy, so you can track agent activity in your own analytics.
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "556KB" },
{ "path": "./dist/clerk.js", "maxSize": "557KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "83KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "126KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "322.25KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "324.25KB" },
{ "path": "./dist/clerk.native.js", "maxSize": "82KB" },
{ "path": "./dist/vendors*.js", "maxSize": "7KB" },
{ "path": "./dist/coinbase*.js", "maxSize": "36KB" },
Expand Down
9 changes: 9 additions & 0 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3622,6 +3622,7 @@ export class Clerk implements ClerkInterface {
this.#clearClerkQueryParams();
this.#handleImpersonationFab();
this.#handleKeylessPrompt();
this.#handleWebMcp();

this.#publicEventBus.emit(clerkEvents.Status, initializationDegradedCounter > 0 ? 'degraded' : 'ready');
};
Expand Down Expand Up @@ -3853,6 +3854,14 @@ export class Clerk implements ClerkInterface {
}
};

#handleWebMcp = () => {
if (this.#options.experimental?.webmcp) {
void import(/* webpackChunkName: "webmcp" */ './modules/webmcp')
.then(({ registerWebMcpTools }) => registerWebMcpTools(this))
.catch(noop);
}
};

#buildUrl = (
key: 'signInUrl' | 'signUpUrl',
options: RedirectOptions,
Expand Down
Loading
Loading