@frontmcp/plugin-webmcp 1.9.1-rc.3 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.mjs +4 -2
- package/esm/package.json +4 -4
- package/index.js +4 -2
- package/package.json +4 -4
- package/webmcp.bridge.d.ts.map +1 -1
package/esm/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import { randomUUID, runRequestExclusive } from "@frontmcp/utils";
|
|
21
21
|
var MAX_WEBMCP_NAME_LENGTH = 128;
|
|
22
22
|
var INVALID_NAME_CHARACTERS = /[^A-Za-z0-9_.-]/g;
|
|
23
|
+
var ANONYMOUS_SUBJECT = "anon:webmcp";
|
|
23
24
|
function resolveDocumentModelContext() {
|
|
24
25
|
const modelContext = globalThis.document?.modelContext;
|
|
25
26
|
return typeof modelContext === "object" && modelContext !== null && typeof modelContext.registerTool === "function" ? modelContext : void 0;
|
|
@@ -251,11 +252,12 @@ var WebMcpBridge = class {
|
|
|
251
252
|
const option = this.options.authContext;
|
|
252
253
|
const authContext = typeof option === "function" ? await option() : option;
|
|
253
254
|
const user = authContext?.user;
|
|
254
|
-
const
|
|
255
|
+
const signedIn = typeof user?.sub === "string";
|
|
256
|
+
const sub = signedIn ? user.sub : ANONYMOUS_SUBJECT;
|
|
255
257
|
const iss = typeof user?.["iss"] === "string" ? user["iss"] : "webmcp";
|
|
256
258
|
return {
|
|
257
259
|
sessionId: authContext?.sessionId ?? this.sessionId,
|
|
258
|
-
user: { ...user, iss, sub },
|
|
260
|
+
user: { ...user, iss, sub, ...!signedIn && { anonymous: true } },
|
|
259
261
|
scopes: [],
|
|
260
262
|
clientId: sub,
|
|
261
263
|
...authContext?.token !== void 0 && { token: authContext.token },
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-webmcp",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "WebMCP plugin for FrontMCP - expose an in-browser FrontMCP server's tools to browser agents through document.modelContext",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@frontmcp/sdk": "1.9.
|
|
53
|
-
"@frontmcp/utils": "1.9.
|
|
52
|
+
"@frontmcp/sdk": "1.9.2",
|
|
53
|
+
"@frontmcp/utils": "1.9.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@frontmcp/lazy-zod": "1.9.
|
|
56
|
+
"@frontmcp/lazy-zod": "1.9.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"reflect-metadata": "^0.2.2"
|
package/index.js
CHANGED
|
@@ -45,6 +45,7 @@ var import_sdk = require("@frontmcp/sdk");
|
|
|
45
45
|
var import_utils = require("@frontmcp/utils");
|
|
46
46
|
var MAX_WEBMCP_NAME_LENGTH = 128;
|
|
47
47
|
var INVALID_NAME_CHARACTERS = /[^A-Za-z0-9_.-]/g;
|
|
48
|
+
var ANONYMOUS_SUBJECT = "anon:webmcp";
|
|
48
49
|
function resolveDocumentModelContext() {
|
|
49
50
|
const modelContext = globalThis.document?.modelContext;
|
|
50
51
|
return typeof modelContext === "object" && modelContext !== null && typeof modelContext.registerTool === "function" ? modelContext : void 0;
|
|
@@ -276,11 +277,12 @@ var WebMcpBridge = class {
|
|
|
276
277
|
const option = this.options.authContext;
|
|
277
278
|
const authContext = typeof option === "function" ? await option() : option;
|
|
278
279
|
const user = authContext?.user;
|
|
279
|
-
const
|
|
280
|
+
const signedIn = typeof user?.sub === "string";
|
|
281
|
+
const sub = signedIn ? user.sub : ANONYMOUS_SUBJECT;
|
|
280
282
|
const iss = typeof user?.["iss"] === "string" ? user["iss"] : "webmcp";
|
|
281
283
|
return {
|
|
282
284
|
sessionId: authContext?.sessionId ?? this.sessionId,
|
|
283
|
-
user: { ...user, iss, sub },
|
|
285
|
+
user: { ...user, iss, sub, ...!signedIn && { anonymous: true } },
|
|
284
286
|
scopes: [],
|
|
285
287
|
clientId: sub,
|
|
286
288
|
...authContext?.token !== void 0 && { token: authContext.token },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-webmcp",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "WebMCP plugin for FrontMCP - expose an in-browser FrontMCP server's tools to browser agents through document.modelContext",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@frontmcp/sdk": "1.9.
|
|
53
|
-
"@frontmcp/utils": "1.9.
|
|
52
|
+
"@frontmcp/sdk": "1.9.2",
|
|
53
|
+
"@frontmcp/utils": "1.9.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@frontmcp/lazy-zod": "1.9.
|
|
56
|
+
"@frontmcp/lazy-zod": "1.9.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"reflect-metadata": "^0.2.2"
|
package/webmcp.bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webmcp.bridge.d.ts","sourceRoot":"","sources":["../src/webmcp.bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,cAAc,EAEnB,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,g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