@mcp-b/global 5.0.1 → 5.1.0
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/dist/index.iife.js +10 -4
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/global.ts","../src/index.ts"],"sourcesContent":["import { IframeChildTransport, TabServerTransport } from '@mcp-b/transports';\nimport { initializeWebMCPPolyfill } from '@mcp-b/webmcp-polyfill';\nimport { BrowserMcpServer, isBrowserMcpServer } from '@mcp-b/webmcp-ts-sdk';\nimport type { ModelContext } from '@mcp-b/webmcp-types';\nimport type { Transport } from '@modelcontextprotocol/server';\nimport type { WebModelContextInitOptions } from './types.js';\n\ninterface RuntimeState {\n native: ModelContext;\n server: BrowserMcpServer;\n transport: Transport;\n previousDocumentModelContextDescriptor: PropertyDescriptor | undefined;\n previousNavigatorModelContextDescriptor: PropertyDescriptor | undefined;\n}\n\nlet runtime: RuntimeState | null = null;\n\nfunction isBrowserEnvironment(): boolean {\n return typeof window !== 'undefined' && typeof window.navigator !== 'undefined';\n}\n\nfunction readCurrentModelContext(): ModelContext | undefined {\n return document.modelContext ?? navigator.modelContext;\n}\n\nfunction canReplaceModelContext(target: Document | Navigator): boolean {\n const descriptor = Object.getOwnPropertyDescriptor(target, 'modelContext');\n return descriptor ? descriptor.configurable === true : Object.isExtensible(target);\n}\n\nfunction replaceDocumentModelContext(value: unknown): void {\n Object.defineProperty(document, 'modelContext', {\n configurable: true,\n enumerable: true,\n writable: false,\n value,\n });\n\n if (document.modelContext !== value) {\n console.error(\n '[WebModelContext] Failed to replace document.modelContext.',\n 'Descriptor:',\n Object.getOwnPropertyDescriptor(document, 'modelContext')\n );\n }\n}\n\nfunction replaceNavigatorModelContext(value: unknown): void {\n Object.defineProperty(navigator, 'modelContext', {\n configurable: true,\n enumerable: true,\n writable: false,\n value,\n });\n\n if (navigator.modelContext !== value) {\n console.error(\n '[WebModelContext] Failed to replace navigator.modelContext.',\n 'Descriptor:',\n Object.getOwnPropertyDescriptor(navigator, 'modelContext')\n );\n }\n}\n\nfunction restoreProperty(\n target: Document | Navigator,\n key: 'modelContext',\n descriptor: PropertyDescriptor | undefined\n): void {\n if (descriptor) Object.defineProperty(target, key, descriptor);\n else Reflect.deleteProperty(target, key);\n}\n\n/**\n * Replace both modelContext surfaces with the given value.\n *\n * document.modelContext is canonical. @mcp-b/global still supports old\n * navigator-first users, so the bridge exposes the BrowserMcpServer wrapper\n * through both properties.\n */\nfunction replaceModelContext(\n value: unknown,\n previousDocumentDescriptor: PropertyDescriptor | undefined,\n previousNavigatorDescriptor: PropertyDescriptor | undefined\n): void {\n try {\n replaceDocumentModelContext(value);\n replaceNavigatorModelContext(value);\n } catch (error) {\n restoreProperty(document, 'modelContext', previousDocumentDescriptor);\n restoreProperty(navigator, 'modelContext', previousNavigatorDescriptor);\n throw error;\n }\n}\n\nfunction createTransport(config: WebModelContextInitOptions['transport']): Transport {\n const inIframe = window.parent !== window;\n\n if (inIframe && config?.iframeServer !== false) {\n return new IframeChildTransport(\n typeof config?.iframeServer === 'object' ? config.iframeServer : { allowedOrigins: ['*'] }\n );\n }\n\n if (config?.tabServer === false) {\n throw new Error('tabServer transport is disabled and iframe transport was not selected');\n }\n\n return new TabServerTransport(\n typeof config?.tabServer === 'object' ? config.tabServer : { allowedOrigins: ['*'] }\n );\n}\n\n/** Installs the global bridge on `document.modelContext`. */\nexport function initializeWebModelContext(options?: WebModelContextInitOptions): void {\n if (!isBrowserEnvironment() || globalThis.isSecureContext === false) {\n return;\n }\n\n if (runtime) {\n return;\n }\n\n // Cross-bundle guard: if modelContext is already a BrowserMcpServer\n // (set by another bundle in this window), skip initialization.\n const existingContext = readCurrentModelContext();\n if (existingContext && isBrowserMcpServer(existingContext)) {\n return;\n }\n\n // 1. Install polyfill (provides modelContext + modelContextTesting)\n initializeWebMCPPolyfill({\n installTestingShim: options?.installTestingShim ?? true,\n });\n\n // 2. Save reference to the polyfill's (or native) context\n const native = readCurrentModelContext();\n if (!native) {\n throw new Error('modelContext is not available');\n }\n\n // Some browser hosts expose a frozen native context through non-configurable\n // own properties. It is already usable and cannot legally be wrapped.\n if (!canReplaceModelContext(document) || !canReplaceModelContext(navigator)) {\n return;\n }\n\n // 3. Resolve transport before mutating either browser surface.\n const transport = createTransport(options?.transport);\n\n // 4. Create server with native mirroring\n const hostname = window.location.hostname || 'localhost';\n const server = new BrowserMcpServer({ name: `${hostname}-webmcp`, version: '1.0.0' }, { native });\n\n // 5. Replace both the canonical document surface and compatibility alias.\n const previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(\n document,\n 'modelContext'\n );\n const previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(\n navigator,\n 'modelContext'\n );\n try {\n replaceModelContext(\n server,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor\n );\n runtime = {\n native,\n server,\n transport,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor,\n };\n } catch (error) {\n void server.close();\n void transport.close();\n throw error;\n }\n\n void (async () => {\n try {\n await server.syncNativeTools();\n } catch (error) {\n console.warn('[WebModelContext] Native WebMCP tool synchronization failed:', error);\n }\n\n if (runtime?.server !== server) {\n return;\n }\n\n try {\n await server.connect(transport);\n } catch (error) {\n console.error('[WebModelContext] Failed to connect MCP transport:', error);\n if (runtime?.server === server) {\n cleanupWebModelContext();\n }\n }\n })();\n}\n\nexport function cleanupWebModelContext(): void {\n if (!runtime) {\n return;\n }\n\n const {\n server,\n transport,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor,\n } = runtime;\n runtime = null;\n\n void server.close();\n void transport.close();\n\n // Restore the descriptors that existed before we wrapped with BrowserMcpServer.\n // We intentionally do NOT call cleanupWebMCPPolyfill() here — the polyfill\n // manages its own lifecycle (auto-init, testing shim) independently.\n restoreProperty(document, 'modelContext', previousDocumentModelContextDescriptor);\n restoreProperty(navigator, 'modelContext', previousNavigatorModelContextDescriptor);\n}\n","import { cleanupWebModelContext, initializeWebModelContext } from './global.js';\n\nexport { cleanupWebModelContext, initializeWebModelContext };\n\nexport type { TransportConfiguration, WebModelContextInitOptions } from './types.js';\n\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n const options = window.__webModelContextOptions;\n const shouldAutoInitialize = options?.autoInitialize !== false;\n\n if (shouldAutoInitialize) {\n try {\n initializeWebModelContext(options);\n } catch (error) {\n console.error('[WebModelContext] Auto-initialization failed:', error);\n }\n }\n}\n"],"mappings":";;;;;AAeA,IAAI,UAA+B;AAEnC,SAAS,uBAAgC;CACvC,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,cAAc;;AAGtE,SAAS,0BAAoD;CAC3D,OAAO,SAAS,gBAAgB,UAAU;;AAG5C,SAAS,uBAAuB,QAAuC;CACrE,MAAM,aAAa,OAAO,yBAAyB,QAAQ,eAAe;CAC1E,OAAO,aAAa,WAAW,iBAAiB,OAAO,OAAO,aAAa,OAAO;;AAGpF,SAAS,4BAA4B,OAAsB;CACzD,OAAO,eAAe,UAAU,gBAAgB;EAC9C,cAAc;EACd,YAAY;EACZ,UAAU;EACV;EACD,CAAC;CAEF,IAAI,SAAS,iBAAiB,OAC5B,QAAQ,MACN,8DACA,eACA,OAAO,yBAAyB,UAAU,eAAe,CAC1D;;AAIL,SAAS,6BAA6B,OAAsB;CAC1D,OAAO,eAAe,WAAW,gBAAgB;EAC/C,cAAc;EACd,YAAY;EACZ,UAAU;EACV;EACD,CAAC;CAEF,IAAI,UAAU,iBAAiB,OAC7B,QAAQ,MACN,+DACA,eACA,OAAO,yBAAyB,WAAW,eAAe,CAC3D;;AAIL,SAAS,gBACP,QACA,KACA,YACM;CACN,IAAI,YAAY,OAAO,eAAe,QAAQ,KAAK,WAAW;MACzD,QAAQ,eAAe,QAAQ,IAAI;;;;;;;;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;EACd,AAAK,OAAO,OAAO;EACnB,AAAK,UAAU,OAAO;EACtB,MAAM;;CAGR,CAAM,YAAY;EAChB,IAAI;GACF,MAAM,OAAO,iBAAiB;WACvB,OAAO;GACd,QAAQ,KAAK,gEAAgE,MAAM;;EAGrF,IAAI,SAAS,WAAW,QACtB;EAGF,IAAI;GACF,MAAM,OAAO,QAAQ,UAAU;WACxB,OAAO;GACd,QAAQ,MAAM,sDAAsD,MAAM;GAC1E,IAAI,SAAS,WAAW,QACtB,wBAAwB;;KAG1B;;AAGN,SAAgB,yBAA+B;CAC7C,IAAI,CAAC,SACH;CAGF,MAAM,EACJ,QACA,WACA,wCACA,4CACE;CACJ,UAAU;CAEV,AAAK,OAAO,OAAO;CACnB,AAAK,UAAU,OAAO;CAKtB,gBAAgB,UAAU,gBAAgB,uCAAuC;CACjF,gBAAgB,WAAW,gBAAgB,wCAAwC;;;;;AC1NrF,IAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;CACpE,MAAM,UAAU,OAAO;CAGvB,IAF6B,SAAS,mBAAmB,OAGvD,IAAI;EACF,0BAA0B,QAAQ;UAC3B,OAAO;EACd,QAAQ,MAAM,iDAAiD,MAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/global.ts","../src/index.ts"],"sourcesContent":["import { IframeChildTransport, TabServerTransport } from '@mcp-b/transports';\nimport { initializeWebMCPPolyfill } from '@mcp-b/webmcp-polyfill';\nimport { BrowserMcpServer, isBrowserMcpServer } from '@mcp-b/webmcp-ts-sdk';\nimport type { ModelContext } from '@mcp-b/webmcp-types';\nimport type { Transport } from '@modelcontextprotocol/server';\nimport type { WebModelContextInitOptions } from './types.js';\n\ninterface RuntimeState {\n server: BrowserMcpServer;\n transport: Transport;\n previousDocumentModelContextDescriptor: PropertyDescriptor | undefined;\n previousNavigatorModelContextDescriptor: PropertyDescriptor | undefined;\n}\n\nlet runtime: RuntimeState | null = null;\n\nfunction isBrowserEnvironment(): boolean {\n return typeof window !== 'undefined' && typeof window.navigator !== 'undefined';\n}\n\nfunction readCurrentModelContext(): ModelContext | undefined {\n return document.modelContext ?? navigator.modelContext;\n}\n\nfunction canReplaceModelContext(target: Document | Navigator): boolean {\n const descriptor = Object.getOwnPropertyDescriptor(target, 'modelContext');\n return descriptor ? descriptor.configurable === true : Object.isExtensible(target);\n}\n\nfunction replaceDocumentModelContext(value: unknown): void {\n Object.defineProperty(document, 'modelContext', {\n configurable: true,\n enumerable: true,\n writable: false,\n value,\n });\n\n if (document.modelContext !== value) {\n console.error(\n '[WebModelContext] Failed to replace document.modelContext.',\n 'Descriptor:',\n Object.getOwnPropertyDescriptor(document, 'modelContext')\n );\n }\n}\n\nfunction replaceNavigatorModelContext(value: unknown): void {\n Object.defineProperty(navigator, 'modelContext', {\n configurable: true,\n enumerable: true,\n writable: false,\n value,\n });\n\n if (navigator.modelContext !== value) {\n console.error(\n '[WebModelContext] Failed to replace navigator.modelContext.',\n 'Descriptor:',\n Object.getOwnPropertyDescriptor(navigator, 'modelContext')\n );\n }\n}\n\nfunction restoreProperty(\n target: Document | Navigator,\n key: 'modelContext',\n descriptor: PropertyDescriptor | undefined\n): void {\n if (descriptor) Object.defineProperty(target, key, descriptor);\n else Reflect.deleteProperty(target, key);\n}\n\n/**\n * Replace both modelContext surfaces with the given value.\n *\n * document.modelContext is canonical. @mcp-b/global still supports old\n * navigator-first users, so the bridge exposes the BrowserMcpServer wrapper\n * through both properties.\n */\nfunction replaceModelContext(\n value: unknown,\n previousDocumentDescriptor: PropertyDescriptor | undefined,\n previousNavigatorDescriptor: PropertyDescriptor | undefined\n): void {\n try {\n replaceDocumentModelContext(value);\n replaceNavigatorModelContext(value);\n } catch (error) {\n restoreProperty(document, 'modelContext', previousDocumentDescriptor);\n restoreProperty(navigator, 'modelContext', previousNavigatorDescriptor);\n throw error;\n }\n}\n\nfunction createTransport(config: WebModelContextInitOptions['transport']): Transport {\n const inIframe = window.parent !== window;\n\n if (inIframe && config?.iframeServer !== false) {\n return new IframeChildTransport(\n typeof config?.iframeServer === 'object' ? config.iframeServer : { allowedOrigins: ['*'] }\n );\n }\n\n if (config?.tabServer === false) {\n throw new Error('tabServer transport is disabled and iframe transport was not selected');\n }\n\n return new TabServerTransport(\n typeof config?.tabServer === 'object' ? config.tabServer : { allowedOrigins: ['*'] }\n );\n}\n\n/** Installs the global bridge on `document.modelContext`. */\nexport function initializeWebModelContext(options?: WebModelContextInitOptions): void {\n if (!isBrowserEnvironment() || globalThis.isSecureContext === false) {\n return;\n }\n\n if (runtime) {\n return;\n }\n\n // Cross-bundle guard: if modelContext is already a BrowserMcpServer\n // (set by another bundle in this window), skip initialization.\n const existingContext = readCurrentModelContext();\n if (existingContext && isBrowserMcpServer(existingContext)) {\n return;\n }\n\n // 1. Install polyfill (provides modelContext + modelContextTesting)\n initializeWebMCPPolyfill({\n installTestingShim: options?.installTestingShim ?? true,\n });\n\n // 2. Save reference to the polyfill's (or native) context\n const native = readCurrentModelContext();\n if (!native) {\n throw new Error('modelContext is not available');\n }\n\n // Some browser hosts expose a frozen native context through non-configurable\n // own properties. It is already usable and cannot legally be wrapped.\n if (!canReplaceModelContext(document) || !canReplaceModelContext(navigator)) {\n return;\n }\n\n // 3. Resolve transport before mutating either browser surface.\n const transport = createTransport(options?.transport);\n\n // 4. Create server with native mirroring\n const hostname = window.location.hostname || 'localhost';\n const server = new BrowserMcpServer({ name: `${hostname}-webmcp`, version: '1.0.0' }, { native });\n\n // 5. Replace both the canonical document surface and compatibility alias.\n const previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(\n document,\n 'modelContext'\n );\n const previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(\n navigator,\n 'modelContext'\n );\n try {\n replaceModelContext(\n server,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor\n );\n runtime = {\n server,\n transport,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor,\n };\n } catch (error) {\n void server.close();\n void transport.close();\n throw error;\n }\n\n void (async () => {\n try {\n await server.syncNativeTools();\n } catch (error) {\n console.warn('[WebModelContext] Native WebMCP tool synchronization failed:', error);\n }\n\n if (runtime?.server !== server) {\n return;\n }\n\n try {\n await server.connect(transport);\n } catch (error) {\n console.error('[WebModelContext] Failed to connect MCP transport:', error);\n if (runtime?.server === server) {\n cleanupWebModelContext();\n }\n }\n })();\n}\n\nexport function cleanupWebModelContext(): void {\n if (!runtime) {\n return;\n }\n\n const {\n server,\n transport,\n previousDocumentModelContextDescriptor,\n previousNavigatorModelContextDescriptor,\n } = runtime;\n runtime = null;\n\n void server.close();\n void transport.close();\n\n // Restore the descriptors that existed before we wrapped with BrowserMcpServer.\n // We intentionally do NOT call cleanupWebMCPPolyfill() here — the polyfill\n // manages its own lifecycle (auto-init, testing shim) independently.\n restoreProperty(document, 'modelContext', previousDocumentModelContextDescriptor);\n restoreProperty(navigator, 'modelContext', previousNavigatorModelContextDescriptor);\n}\n","import { cleanupWebModelContext, initializeWebModelContext } from './global.js';\n\nexport { cleanupWebModelContext, initializeWebModelContext };\n\nexport type { TransportConfiguration, WebModelContextInitOptions } from './types.js';\n\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n const options = window.__webModelContextOptions;\n const shouldAutoInitialize = options?.autoInitialize !== false;\n\n if (shouldAutoInitialize) {\n try {\n initializeWebModelContext(options);\n } catch (error) {\n console.error('[WebModelContext] Auto-initialization failed:', error);\n }\n }\n}\n"],"mappings":";;;;;AAcA,IAAI,UAA+B;AAEnC,SAAS,uBAAgC;CACvC,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,cAAc;AACtE;AAEA,SAAS,0BAAoD;CAC3D,OAAO,SAAS,gBAAgB,UAAU;AAC5C;AAEA,SAAS,uBAAuB,QAAuC;CACrE,MAAM,aAAa,OAAO,yBAAyB,QAAQ,cAAc;CACzE,OAAO,aAAa,WAAW,iBAAiB,OAAO,OAAO,aAAa,MAAM;AACnF;AAEA,SAAS,4BAA4B,OAAsB;CACzD,OAA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,0BAA0B,OAAO;CACnC,SAAS,OAAO;EACd,QAAQ,MAAM,iDAAiD,KAAK;CACtE;AAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/global",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "W3C Web Model Context Protocol (WebMCP) API polyfill. Let AI agents like Claude, ChatGPT, and Gemini interact with your website via document.modelContext.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@modelcontextprotocol/server": "2.0.0",
|
|
70
|
-
"@mcp-b/transports": "5.0
|
|
71
|
-
"@mcp-b/webmcp-
|
|
72
|
-
"@mcp-b/webmcp-
|
|
73
|
-
"@mcp-b/webmcp-
|
|
70
|
+
"@mcp-b/transports": "5.1.0",
|
|
71
|
+
"@mcp-b/webmcp-polyfill": "5.1.0",
|
|
72
|
+
"@mcp-b/webmcp-types": "5.1.0",
|
|
73
|
+
"@mcp-b/webmcp-ts-sdk": "5.1.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@modelcontextprotocol/client": "2.0.0",
|
|
77
|
-
"@types/node": "22.
|
|
78
|
-
"@vitest/coverage-v8": "
|
|
79
|
-
"playwright": "^1.
|
|
77
|
+
"@types/node": "22.20.1",
|
|
78
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
79
|
+
"playwright": "^1.62.1",
|
|
80
80
|
"typescript": "^5.8.3",
|
|
81
|
-
"vite-plus": "
|
|
82
|
-
"vitest": "npm:@voidzero-dev/vite-plus-test@
|
|
81
|
+
"vite-plus": "0.1.24",
|
|
82
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.24"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=20"
|
|
@@ -97,8 +97,9 @@
|
|
|
97
97
|
"test:conformance:matrix": "pnpm run test:conformance:polyfill && pnpm run test:conformance:global && pnpm run test:conformance:native",
|
|
98
98
|
"test:conformance:native": "vp test run --config vitest.conformance.native.config.ts --browser.headless",
|
|
99
99
|
"test:conformance:polyfill": "pnpm --filter @mcp-b/webmcp-polyfill run test:conformance",
|
|
100
|
+
"test:coverage": "vp test run --coverage",
|
|
100
101
|
"test:watch": "vp test",
|
|
101
|
-
"typecheck": "tsc --noEmit
|
|
102
|
+
"typecheck": "tsc --noEmit",
|
|
102
103
|
"typecheck:consumer": "tsc --noEmit --strict --skipLibCheck --module preserve --moduleResolution bundler --lib ES2022,DOM type-tests/consumer.ts"
|
|
103
104
|
}
|
|
104
105
|
}
|