@modelcontextprotocol/server-customer-segmentation 1.3.0 → 1.3.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/dist/mcp-app.html +1 -1
- package/dist/server.js +75 -75
- package/package.json +1 -1
package/dist/mcp-app.html
CHANGED
|
@@ -81,7 +81,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
81
81
|
- omitted: host decides border`)});v({method:_("ui/request-display-mode"),params:v({mode:pn.describe("The display mode being requested.")})});var gm=v({mode:pn.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),mm=F([_("model"),_("app")]).describe("Tool visibility scope - who can access the tool.");v({resourceUri:y().optional(),visibility:I(mm).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
82
82
|
- "model": Tool visible to and callable by the agent
|
|
83
83
|
- "app": Tool callable by the app from this server only`)});v({mimeTypes:I(y()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});v({method:_("ui/download-file"),params:v({contents:I(F([cc,lc])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});v({method:_("ui/message"),params:v({role:_("user").describe('Message role, currently only "user" is supported.'),content:I(On).describe("Message content blocks (text, image, etc.).")})});v({method:_("ui/notifications/sandbox-resource-ready"),params:v({html:y().describe("HTML content to load into the inner iframe."),sandbox:y().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ui.optional().describe("CSP configuration from resource metadata."),permissions:Yi.optional().describe("Sandbox permissions from resource metadata.")})});var bm=v({method:_("ui/notifications/tool-result"),params:Cs.describe("Standard MCP tool execution result.")}),fc=v({toolInfo:v({id:Sn.optional().describe("JSON-RPC id of the tools/call request."),tool:qi.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:em.optional().describe("Current color theme preference."),styles:hm.optional().describe("Style configuration for theming the app."),displayMode:pn.optional().describe("How the UI is currently displayed."),availableDisplayModes:I(pn).optional().describe("Display modes the host supports."),containerDimensions:F([v({height:$().describe("Fixed container height in pixels.")}),v({maxHeight:F([$(),ti()]).optional().describe("Maximum container height in pixels.")})]).and(F([v({width:$().describe("Fixed container width in pixels.")}),v({maxWidth:F([$(),ti()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
84
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:y().optional().describe("User's language and region preference in BCP 47 format."),timeZone:y().optional().describe("User's timezone in IANA format."),userAgent:y().optional().describe("Host application identifier."),platform:F([_("web"),_("desktop"),_("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:v({touch:K().optional().describe("Whether the device supports touch input."),hover:K().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:v({top:$().describe("Top safe area inset in pixels."),right:$().describe("Right safe area inset in pixels."),bottom:$().describe("Bottom safe area inset in pixels."),left:$().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_m=v({method:_("ui/notifications/host-context-changed"),params:fc.describe("Partial context update containing only changed fields.")});v({method:_("ui/update-model-context"),params:v({content:I(On).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Y(y(),J().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});v({method:_("ui/initialize"),params:v({appInfo:Ps.describe("App identification (name and version)."),appCapabilities:pm.describe("Features and capabilities this app provides."),protocolVersion:y().describe("Protocol version this app supports.")})});var ym=v({protocolVersion:y().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ps.describe("Host application identification and version."),hostCapabilities:fm.describe("Features and capabilities provided by the host."),hostContext:fc.describe("Rich context about the host environment.")}).passthrough();function Ji(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function xm(e,t=document.documentElement){for(let[n,s]of Object.entries(e))s!==void 0&&t.style.setProperty(n,s)}function vm(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class km extends Kg{constructor(n,s={},i={autoResize:!0}){super(i);T(this,"_appInfo");T(this,"_capabilities");T(this,"options");T(this,"_hostCapabilities");T(this,"_hostInfo");T(this,"_hostContext");T(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=s,this.options=i,this.setRequestHandler(Ts,o=>(console.log("Received ping:",o.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(am,s=>n(s.params))}set ontoolinputpartial(n){this.setNotificationHandler(cm,s=>n(s.params))}set ontoolresult(n){this.setNotificationHandler(bm,s=>n(s.params))}set ontoolcancelled(n){this.setNotificationHandler(lm,s=>n(s.params))}set onhostcontextchanged(n){this.setNotificationHandler(_m,s=>{this._hostContext={...this._hostContext,...s.params},n(s.params)})}set onteardown(n){this.setRequestHandler(dm,(s,i)=>n(s.params,i))}set oncalltool(n){this.setRequestHandler(hc,(s,i)=>n(s.params,i))}set onlisttools(n){this.setRequestHandler(uc,(s,i)=>n(s.params,i))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,s){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},Cs,s)}async readServerResource(n,s){return await this.request({method:"resources/read",params:n},ac,s)}async listServerResources(n,s){return await this.request({method:"resources/list",params:n},rc,s)}sendMessage(n,s){return this.request({method:"ui/message",params:n},rm,s)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,s){return this.request({method:"ui/update-model-context",params:n},Ri,s)}openLink(n,s){return this.request({method:"ui/open-link",params:n},im,s)}downloadFile(n,s){return this.request({method:"ui/download-file",params:n},om,s)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,s){return this.request({method:"ui/request-display-mode",params:n},gm,s)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,s=0,i=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.
|
|
84
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:y().optional().describe("User's language and region preference in BCP 47 format."),timeZone:y().optional().describe("User's timezone in IANA format."),userAgent:y().optional().describe("Host application identifier."),platform:F([_("web"),_("desktop"),_("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:v({touch:K().optional().describe("Whether the device supports touch input."),hover:K().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:v({top:$().describe("Top safe area inset in pixels."),right:$().describe("Right safe area inset in pixels."),bottom:$().describe("Bottom safe area inset in pixels."),left:$().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_m=v({method:_("ui/notifications/host-context-changed"),params:fc.describe("Partial context update containing only changed fields.")});v({method:_("ui/update-model-context"),params:v({content:I(On).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:Y(y(),J().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});v({method:_("ui/initialize"),params:v({appInfo:Ps.describe("App identification (name and version)."),appCapabilities:pm.describe("Features and capabilities this app provides."),protocolVersion:y().describe("Protocol version this app supports.")})});var ym=v({protocolVersion:y().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ps.describe("Host application identification and version."),hostCapabilities:fm.describe("Features and capabilities provided by the host."),hostContext:fc.describe("Rich context about the host environment.")}).passthrough();function Ji(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function xm(e,t=document.documentElement){for(let[n,s]of Object.entries(e))s!==void 0&&t.style.setProperty(n,s)}function vm(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class km extends Kg{constructor(n,s={},i={autoResize:!0}){super(i);T(this,"_appInfo");T(this,"_capabilities");T(this,"options");T(this,"_hostCapabilities");T(this,"_hostInfo");T(this,"_hostContext");T(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=s,this.options=i,this.setRequestHandler(Ts,o=>(console.log("Received ping:",o.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(am,s=>n(s.params))}set ontoolinputpartial(n){this.setNotificationHandler(cm,s=>n(s.params))}set ontoolresult(n){this.setNotificationHandler(bm,s=>n(s.params))}set ontoolcancelled(n){this.setNotificationHandler(lm,s=>n(s.params))}set onhostcontextchanged(n){this.setNotificationHandler(_m,s=>{this._hostContext={...this._hostContext,...s.params},n(s.params)})}set onteardown(n){this.setRequestHandler(dm,(s,i)=>n(s.params,i))}set oncalltool(n){this.setRequestHandler(hc,(s,i)=>n(s.params,i))}set onlisttools(n){this.setRequestHandler(uc,(s,i)=>n(s.params,i))}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${n})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${n} registered`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,s){if(typeof n=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${n}"). Did you mean: callServerTool({ name: "${n}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:n},Cs,s)}async readServerResource(n,s){return await this.request({method:"resources/read",params:n},ac,s)}async listServerResources(n,s){return await this.request({method:"resources/list",params:n},rc,s)}sendMessage(n,s){return this.request({method:"ui/message",params:n},rm,s)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,s){return this.request({method:"ui/update-model-context",params:n},Ri,s)}openLink(n,s){return this.request({method:"ui/open-link",params:n},im,s)}downloadFile(n,s){return this.request({method:"ui/download-file",params:n},om,s)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,s){return this.request({method:"ui/request-display-mode",params:n},gm,s)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,s=0,i=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.height;a.style.height="max-content";let l=Math.ceil(a.getBoundingClientRect().height);a.style.height=c;let u=Math.ceil(window.innerWidth);(u!==s||l!==i)&&(s=u,i=l,this.sendSizeChanged({width:u,height:l}))}))};o();let r=new ResizeObserver(o);return r.observe(document.documentElement),r.observe(document.body),()=>r.disconnect()}async connect(n=new tm(window.parent,window.parent),s){var i;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Gg}},ym,s);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),(i=this.options)!=null&&i.autoResize&&this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}/*!
|
|
85
85
|
* @kurkle/color v0.3.4
|
|
86
86
|
* https://github.com/kurkle/color#readme
|
|
87
87
|
* (c) 2024 Jukka Kurkela
|
package/dist/server.js
CHANGED
|
@@ -28224,8 +28224,8 @@ import fs from "node:fs/promises";
|
|
|
28224
28224
|
import path from "node:path";
|
|
28225
28225
|
|
|
28226
28226
|
// ../../node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
|
|
28227
|
-
var
|
|
28228
|
-
var
|
|
28227
|
+
var Y = "2026-01-26";
|
|
28228
|
+
var F = "ui/notifications/tool-input-partial";
|
|
28229
28229
|
|
|
28230
28230
|
class j {
|
|
28231
28231
|
eventTarget;
|
|
@@ -28252,7 +28252,7 @@ class j {
|
|
|
28252
28252
|
window.addEventListener("message", this.messageListener);
|
|
28253
28253
|
}
|
|
28254
28254
|
async send(Z, $) {
|
|
28255
|
-
if (Z.method !==
|
|
28255
|
+
if (Z.method !== F)
|
|
28256
28256
|
console.debug("Sending message", Z);
|
|
28257
28257
|
this.eventTarget.postMessage(Z, "*");
|
|
28258
28258
|
}
|
|
@@ -28265,10 +28265,10 @@ class j {
|
|
|
28265
28265
|
sessionId;
|
|
28266
28266
|
setProtocolVersion;
|
|
28267
28267
|
}
|
|
28268
|
-
var
|
|
28268
|
+
var M = exports_external.union([exports_external.literal("light"), exports_external.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
28269
28269
|
var G = exports_external.union([exports_external.literal("inline"), exports_external.literal("fullscreen"), exports_external.literal("pip")]).describe("Display mode for UI presentation.");
|
|
28270
|
-
var
|
|
28271
|
-
var
|
|
28270
|
+
var p = exports_external.union([exports_external.literal("--color-background-primary"), exports_external.literal("--color-background-secondary"), exports_external.literal("--color-background-tertiary"), exports_external.literal("--color-background-inverse"), exports_external.literal("--color-background-ghost"), exports_external.literal("--color-background-info"), exports_external.literal("--color-background-danger"), exports_external.literal("--color-background-success"), exports_external.literal("--color-background-warning"), exports_external.literal("--color-background-disabled"), exports_external.literal("--color-text-primary"), exports_external.literal("--color-text-secondary"), exports_external.literal("--color-text-tertiary"), exports_external.literal("--color-text-inverse"), exports_external.literal("--color-text-ghost"), exports_external.literal("--color-text-info"), exports_external.literal("--color-text-danger"), exports_external.literal("--color-text-success"), exports_external.literal("--color-text-warning"), exports_external.literal("--color-text-disabled"), exports_external.literal("--color-border-primary"), exports_external.literal("--color-border-secondary"), exports_external.literal("--color-border-tertiary"), exports_external.literal("--color-border-inverse"), exports_external.literal("--color-border-ghost"), exports_external.literal("--color-border-info"), exports_external.literal("--color-border-danger"), exports_external.literal("--color-border-success"), exports_external.literal("--color-border-warning"), exports_external.literal("--color-border-disabled"), exports_external.literal("--color-ring-primary"), exports_external.literal("--color-ring-secondary"), exports_external.literal("--color-ring-inverse"), exports_external.literal("--color-ring-info"), exports_external.literal("--color-ring-danger"), exports_external.literal("--color-ring-success"), exports_external.literal("--color-ring-warning"), exports_external.literal("--font-sans"), exports_external.literal("--font-mono"), exports_external.literal("--font-weight-normal"), exports_external.literal("--font-weight-medium"), exports_external.literal("--font-weight-semibold"), exports_external.literal("--font-weight-bold"), exports_external.literal("--font-text-xs-size"), exports_external.literal("--font-text-sm-size"), exports_external.literal("--font-text-md-size"), exports_external.literal("--font-text-lg-size"), exports_external.literal("--font-heading-xs-size"), exports_external.literal("--font-heading-sm-size"), exports_external.literal("--font-heading-md-size"), exports_external.literal("--font-heading-lg-size"), exports_external.literal("--font-heading-xl-size"), exports_external.literal("--font-heading-2xl-size"), exports_external.literal("--font-heading-3xl-size"), exports_external.literal("--font-text-xs-line-height"), exports_external.literal("--font-text-sm-line-height"), exports_external.literal("--font-text-md-line-height"), exports_external.literal("--font-text-lg-line-height"), exports_external.literal("--font-heading-xs-line-height"), exports_external.literal("--font-heading-sm-line-height"), exports_external.literal("--font-heading-md-line-height"), exports_external.literal("--font-heading-lg-line-height"), exports_external.literal("--font-heading-xl-line-height"), exports_external.literal("--font-heading-2xl-line-height"), exports_external.literal("--font-heading-3xl-line-height"), exports_external.literal("--border-radius-xs"), exports_external.literal("--border-radius-sm"), exports_external.literal("--border-radius-md"), exports_external.literal("--border-radius-lg"), exports_external.literal("--border-radius-xl"), exports_external.literal("--border-radius-full"), exports_external.literal("--border-width-regular"), exports_external.literal("--shadow-hairline"), exports_external.literal("--shadow-sm"), exports_external.literal("--shadow-md"), exports_external.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming.");
|
|
28271
|
+
var r = exports_external.record(p.describe(`Style variables for theming MCP apps.
|
|
28272
28272
|
|
|
28273
28273
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
28274
28274
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -28287,30 +28287,30 @@ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
|
28287
28287
|
|
|
28288
28288
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
28289
28289
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);
|
|
28290
|
-
var
|
|
28291
|
-
var
|
|
28292
|
-
var
|
|
28293
|
-
var
|
|
28294
|
-
var
|
|
28290
|
+
var n = exports_external.object({ method: exports_external.literal("ui/open-link"), params: exports_external.object({ url: exports_external.string().describe("URL to open in the host's browser") }) });
|
|
28291
|
+
var q = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough();
|
|
28292
|
+
var O = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough();
|
|
28293
|
+
var I = exports_external.object({ isError: exports_external.boolean().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough();
|
|
28294
|
+
var i = exports_external.object({ method: exports_external.literal("ui/notifications/sandbox-proxy-ready"), params: exports_external.object({}) });
|
|
28295
28295
|
var B = exports_external.object({ connectDomains: exports_external.array(exports_external.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
28296
28296
|
|
|
28297
28297
|
- Maps to CSP \`connect-src\` directive
|
|
28298
28298
|
- Empty or omitted → no network connections (secure default)`), resourceDomains: exports_external.array(exports_external.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"), frameDomains: exports_external.array(exports_external.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"), baseUriDomains: exports_external.array(exports_external.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)") });
|
|
28299
28299
|
var K = exports_external.object({ camera: exports_external.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."), microphone: exports_external.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."), geolocation: exports_external.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."), clipboardWrite: exports_external.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.") });
|
|
28300
|
-
var
|
|
28301
|
-
var
|
|
28302
|
-
var
|
|
28303
|
-
var
|
|
28304
|
-
var
|
|
28305
|
-
var
|
|
28306
|
-
var
|
|
28307
|
-
var
|
|
28308
|
-
var
|
|
28309
|
-
var
|
|
28310
|
-
var
|
|
28311
|
-
var
|
|
28312
|
-
var
|
|
28313
|
-
var
|
|
28300
|
+
var o = exports_external.object({ method: exports_external.literal("ui/notifications/size-changed"), params: exports_external.object({ width: exports_external.number().optional().describe("New width in pixels."), height: exports_external.number().optional().describe("New height in pixels.") }) });
|
|
28301
|
+
var w = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.") }) });
|
|
28302
|
+
var A = exports_external.object({ method: exports_external.literal("ui/notifications/tool-input-partial"), params: exports_external.object({ arguments: exports_external.record(exports_external.string(), exports_external.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).") }) });
|
|
28303
|
+
var P = exports_external.object({ method: exports_external.literal("ui/notifications/tool-cancelled"), params: exports_external.object({ reason: exports_external.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").') }) });
|
|
28304
|
+
var b = exports_external.object({ fonts: exports_external.string().optional() });
|
|
28305
|
+
var g = exports_external.object({ variables: r.optional().describe("CSS variables for theming the app."), css: b.optional().describe("CSS blocks that apps can inject.") });
|
|
28306
|
+
var H = exports_external.object({ method: exports_external.literal("ui/resource-teardown"), params: exports_external.object({}) });
|
|
28307
|
+
var a = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
28308
|
+
var z2 = exports_external.object({ text: exports_external.object({}).optional().describe("Host supports text content blocks."), image: exports_external.object({}).optional().describe("Host supports image content blocks."), audio: exports_external.object({}).optional().describe("Host supports audio content blocks."), resource: exports_external.object({}).optional().describe("Host supports resource content blocks."), resourceLink: exports_external.object({}).optional().describe("Host supports resource link content blocks."), structuredContent: exports_external.object({}).optional().describe("Host supports structured content.") });
|
|
28309
|
+
var s = exports_external.object({ method: exports_external.literal("ui/notifications/request-teardown"), params: exports_external.object({}).optional() });
|
|
28310
|
+
var S = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), openLinks: exports_external.object({}).optional().describe("Host supports opening external URLs."), downloadFile: exports_external.object({}).optional().describe("Host supports file downloads via ui/download-file."), serverTools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."), serverResources: exports_external.object({ listChanged: exports_external.boolean().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."), logging: exports_external.object({}).optional().describe("Host accepts log messages."), sandbox: exports_external.object({ permissions: K.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."), csp: B.optional().describe("CSP domains approved by the host.") }).optional().describe("Sandbox configuration applied by the host."), updateModelContext: z2.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: z2.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
|
|
28311
|
+
var y = exports_external.object({ experimental: exports_external.object({}).optional().describe("Experimental features (structure TBD)."), tools: exports_external.object({ listChanged: exports_external.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."), availableDisplayModes: exports_external.array(G).optional().describe("Display modes the app supports.") });
|
|
28312
|
+
var t = exports_external.object({ method: exports_external.literal("ui/notifications/initialized"), params: exports_external.object({}).optional() });
|
|
28313
|
+
var e = exports_external.object({ csp: B.optional().describe("Content Security Policy configuration for UI resources."), permissions: K.optional().describe("Sandbox permissions requested by the UI resource."), domain: exports_external.string().optional().describe(`Dedicated origin for view sandbox.
|
|
28314
28314
|
|
|
28315
28315
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
28316
28316
|
|
|
@@ -28325,27 +28325,27 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
28325
28325
|
- \`true\`: request visible border + background
|
|
28326
28326
|
- \`false\`: request no visible border + background
|
|
28327
28327
|
- omitted: host decides border`) });
|
|
28328
|
-
var
|
|
28329
|
-
var
|
|
28330
|
-
var
|
|
28331
|
-
var
|
|
28328
|
+
var QQ = exports_external.object({ method: exports_external.literal("ui/request-display-mode"), params: exports_external.object({ mode: G.describe("The display mode being requested.") }) });
|
|
28329
|
+
var _ = exports_external.object({ mode: G.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
28330
|
+
var C = exports_external.union([exports_external.literal("model"), exports_external.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
28331
|
+
var ZQ = exports_external.object({ resourceUri: exports_external.string().optional(), visibility: exports_external.array(C).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
28332
28332
|
- "model": Tool visible to and callable by the agent
|
|
28333
28333
|
- "app": Tool callable by the app from this server only`) });
|
|
28334
|
-
var
|
|
28335
|
-
var
|
|
28336
|
-
var
|
|
28337
|
-
var
|
|
28338
|
-
var
|
|
28339
|
-
var
|
|
28334
|
+
var TQ = exports_external.object({ mimeTypes: exports_external.array(exports_external.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.') });
|
|
28335
|
+
var $Q = exports_external.object({ method: exports_external.literal("ui/download-file"), params: exports_external.object({ contents: exports_external.array(exports_external.union([EmbeddedResourceSchema, ResourceLinkSchema])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.") }) });
|
|
28336
|
+
var JQ = exports_external.object({ method: exports_external.literal("ui/message"), params: exports_external.object({ role: exports_external.literal("user").describe('Message role, currently only "user" is supported.'), content: exports_external.array(ContentBlockSchema).describe("Message content blocks (text, image, etc.).") }) });
|
|
28337
|
+
var XQ = exports_external.object({ method: exports_external.literal("ui/notifications/sandbox-resource-ready"), params: exports_external.object({ html: exports_external.string().describe("HTML content to load into the inner iframe."), sandbox: exports_external.string().optional().describe("Optional override for the inner iframe's sandbox attribute."), csp: B.optional().describe("CSP configuration from resource metadata."), permissions: K.optional().describe("Sandbox permissions from resource metadata.") }) });
|
|
28338
|
+
var T = exports_external.object({ method: exports_external.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
|
|
28339
|
+
var E = exports_external.object({ toolInfo: exports_external.object({ id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."), tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.") }).optional().describe("Metadata of the tool call that instantiated this App."), theme: M.optional().describe("Current color theme preference."), styles: g.optional().describe("Style configuration for theming the app."), displayMode: G.optional().describe("How the UI is currently displayed."), availableDisplayModes: exports_external.array(G).optional().describe("Display modes the host supports."), containerDimensions: exports_external.union([exports_external.object({ height: exports_external.number().describe("Fixed container height in pixels.") }), exports_external.object({ maxHeight: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container height in pixels.") })]).and(exports_external.union([exports_external.object({ width: exports_external.number().describe("Fixed container width in pixels.") }), exports_external.object({ maxWidth: exports_external.union([exports_external.number(), exports_external.undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
28340
28340
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`), locale: exports_external.string().optional().describe("User's language and region preference in BCP 47 format."), timeZone: exports_external.string().optional().describe("User's timezone in IANA format."), userAgent: exports_external.string().optional().describe("Host application identifier."), platform: exports_external.union([exports_external.literal("web"), exports_external.literal("desktop"), exports_external.literal("mobile")]).optional().describe("Platform type for responsive design decisions."), deviceCapabilities: exports_external.object({ touch: exports_external.boolean().optional().describe("Whether the device supports touch input."), hover: exports_external.boolean().optional().describe("Whether the device supports hover interactions.") }).optional().describe("Device input capabilities."), safeAreaInsets: exports_external.object({ top: exports_external.number().describe("Top safe area inset in pixels."), right: exports_external.number().describe("Right safe area inset in pixels."), bottom: exports_external.number().describe("Bottom safe area inset in pixels."), left: exports_external.number().describe("Left safe area inset in pixels.") }).optional().describe("Mobile safe area boundaries in pixels.") }).passthrough();
|
|
28341
|
-
var
|
|
28342
|
-
var
|
|
28343
|
-
var WQ = exports_external.object({ method: exports_external.literal("ui/initialize"), params: exports_external.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities:
|
|
28344
|
-
var
|
|
28345
|
-
var
|
|
28346
|
-
var
|
|
28341
|
+
var k = exports_external.object({ method: exports_external.literal("ui/notifications/host-context-changed"), params: E.describe("Partial context update containing only changed fields.") });
|
|
28342
|
+
var VQ = exports_external.object({ method: exports_external.literal("ui/update-model-context"), params: exports_external.object({ content: exports_external.array(ContentBlockSchema).optional().describe("Context content blocks (text, image, etc.)."), structuredContent: exports_external.record(exports_external.string(), exports_external.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.") }) });
|
|
28343
|
+
var WQ = exports_external.object({ method: exports_external.literal("ui/initialize"), params: exports_external.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: y.describe("Features and capabilities this app provides."), protocolVersion: exports_external.string().describe("Protocol version this app supports.") }) });
|
|
28344
|
+
var R = exports_external.object({ protocolVersion: exports_external.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'), hostInfo: ImplementationSchema.describe("Host application identification and version."), hostCapabilities: S.describe("Features and capabilities provided by the host."), hostContext: E.describe("Rich context about the host environment.") }).passthrough();
|
|
28345
|
+
var U = "ui/resourceUri";
|
|
28346
|
+
var f = "text/html;profile=mcp-app";
|
|
28347
28347
|
|
|
28348
|
-
class
|
|
28348
|
+
class FQ extends Protocol {
|
|
28349
28349
|
_appInfo;
|
|
28350
28350
|
_capabilities;
|
|
28351
28351
|
options;
|
|
@@ -28371,24 +28371,24 @@ class OQ extends Protocol {
|
|
|
28371
28371
|
return this._hostContext;
|
|
28372
28372
|
}
|
|
28373
28373
|
set ontoolinput(Z) {
|
|
28374
|
-
this.setNotificationHandler(
|
|
28374
|
+
this.setNotificationHandler(w, ($) => Z($.params));
|
|
28375
28375
|
}
|
|
28376
28376
|
set ontoolinputpartial(Z) {
|
|
28377
|
-
this.setNotificationHandler(
|
|
28377
|
+
this.setNotificationHandler(A, ($) => Z($.params));
|
|
28378
28378
|
}
|
|
28379
28379
|
set ontoolresult(Z) {
|
|
28380
|
-
this.setNotificationHandler(
|
|
28380
|
+
this.setNotificationHandler(T, ($) => Z($.params));
|
|
28381
28381
|
}
|
|
28382
28382
|
set ontoolcancelled(Z) {
|
|
28383
|
-
this.setNotificationHandler(
|
|
28383
|
+
this.setNotificationHandler(P, ($) => Z($.params));
|
|
28384
28384
|
}
|
|
28385
28385
|
set onhostcontextchanged(Z) {
|
|
28386
|
-
this.setNotificationHandler(
|
|
28386
|
+
this.setNotificationHandler(k, ($) => {
|
|
28387
28387
|
this._hostContext = { ...this._hostContext, ...$.params }, Z($.params);
|
|
28388
28388
|
});
|
|
28389
28389
|
}
|
|
28390
28390
|
set onteardown(Z) {
|
|
28391
|
-
this.setRequestHandler(
|
|
28391
|
+
this.setRequestHandler(H, ($, J) => Z($.params, J));
|
|
28392
28392
|
}
|
|
28393
28393
|
set oncalltool(Z) {
|
|
28394
28394
|
this.setRequestHandler(CallToolRequestSchema, ($, J) => Z($.params, J));
|
|
@@ -28430,7 +28430,7 @@ class OQ extends Protocol {
|
|
|
28430
28430
|
return await this.request({ method: "resources/list", params: Z }, ListResourcesResultSchema, $);
|
|
28431
28431
|
}
|
|
28432
28432
|
sendMessage(Z, $) {
|
|
28433
|
-
return this.request({ method: "ui/message", params: Z },
|
|
28433
|
+
return this.request({ method: "ui/message", params: Z }, I, $);
|
|
28434
28434
|
}
|
|
28435
28435
|
sendLog(Z) {
|
|
28436
28436
|
return this.notification({ method: "notifications/message", params: Z });
|
|
@@ -28439,17 +28439,17 @@ class OQ extends Protocol {
|
|
|
28439
28439
|
return this.request({ method: "ui/update-model-context", params: Z }, EmptyResultSchema, $);
|
|
28440
28440
|
}
|
|
28441
28441
|
openLink(Z, $) {
|
|
28442
|
-
return this.request({ method: "ui/open-link", params: Z },
|
|
28442
|
+
return this.request({ method: "ui/open-link", params: Z }, q, $);
|
|
28443
28443
|
}
|
|
28444
28444
|
sendOpenLink = this.openLink;
|
|
28445
28445
|
downloadFile(Z, $) {
|
|
28446
|
-
return this.request({ method: "ui/download-file", params: Z },
|
|
28446
|
+
return this.request({ method: "ui/download-file", params: Z }, O, $);
|
|
28447
28447
|
}
|
|
28448
28448
|
requestTeardown(Z = {}) {
|
|
28449
28449
|
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
28450
28450
|
}
|
|
28451
28451
|
requestDisplayMode(Z, $) {
|
|
28452
|
-
return this.request({ method: "ui/request-display-mode", params: Z },
|
|
28452
|
+
return this.request({ method: "ui/request-display-mode", params: Z }, _, $);
|
|
28453
28453
|
}
|
|
28454
28454
|
sendSizeChanged(Z) {
|
|
28455
28455
|
return this.notification({ method: "ui/notifications/size-changed", params: Z });
|
|
@@ -28460,25 +28460,25 @@ class OQ extends Protocol {
|
|
|
28460
28460
|
return;
|
|
28461
28461
|
Z = true, requestAnimationFrame(() => {
|
|
28462
28462
|
Z = false;
|
|
28463
|
-
let
|
|
28464
|
-
|
|
28465
|
-
let
|
|
28466
|
-
|
|
28467
|
-
let
|
|
28468
|
-
if (N !== $ ||
|
|
28469
|
-
$ = N, J =
|
|
28463
|
+
let W = document.documentElement, L = W.style.height;
|
|
28464
|
+
W.style.height = "max-content";
|
|
28465
|
+
let D = Math.ceil(W.getBoundingClientRect().height);
|
|
28466
|
+
W.style.height = L;
|
|
28467
|
+
let N = Math.ceil(window.innerWidth);
|
|
28468
|
+
if (N !== $ || D !== J)
|
|
28469
|
+
$ = N, J = D, this.sendSizeChanged({ width: N, height: D });
|
|
28470
28470
|
});
|
|
28471
28471
|
};
|
|
28472
28472
|
X();
|
|
28473
|
-
let
|
|
28474
|
-
return
|
|
28473
|
+
let V = new ResizeObserver(X);
|
|
28474
|
+
return V.observe(document.documentElement), V.observe(document.body), () => V.disconnect();
|
|
28475
28475
|
}
|
|
28476
28476
|
async connect(Z = new j(window.parent, window.parent), $) {
|
|
28477
28477
|
if (this.transport)
|
|
28478
28478
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
28479
28479
|
await super.connect(Z);
|
|
28480
28480
|
try {
|
|
28481
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion:
|
|
28481
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: Y } }, R, $);
|
|
28482
28482
|
if (J === undefined)
|
|
28483
28483
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
28484
28484
|
if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
|
|
@@ -28488,16 +28488,16 @@ class OQ extends Protocol {
|
|
|
28488
28488
|
}
|
|
28489
28489
|
}
|
|
28490
28490
|
}
|
|
28491
|
-
function
|
|
28492
|
-
let
|
|
28493
|
-
if (
|
|
28494
|
-
|
|
28495
|
-
else if (L && !
|
|
28496
|
-
|
|
28497
|
-
return Z.registerTool($, { ...J, _meta:
|
|
28491
|
+
function fZ(Z, $, J, X) {
|
|
28492
|
+
let V = J._meta, W = V.ui, L = V[U], D = V;
|
|
28493
|
+
if (W?.resourceUri && !L)
|
|
28494
|
+
D = { ...V, [U]: W.resourceUri };
|
|
28495
|
+
else if (L && !W?.resourceUri)
|
|
28496
|
+
D = { ...V, ui: { ...W, resourceUri: L } };
|
|
28497
|
+
return Z.registerTool($, { ...J, _meta: D }, X);
|
|
28498
28498
|
}
|
|
28499
|
-
function
|
|
28500
|
-
return Z.registerResource($, J, { mimeType:
|
|
28499
|
+
function uZ(Z, $, J, X, V) {
|
|
28500
|
+
return Z.registerResource($, J, { mimeType: f, ...X }, V);
|
|
28501
28501
|
}
|
|
28502
28502
|
|
|
28503
28503
|
// src/types.ts
|
|
@@ -28727,7 +28727,7 @@ function createServer() {
|
|
|
28727
28727
|
});
|
|
28728
28728
|
{
|
|
28729
28729
|
const resourceUri = "ui://customer-segmentation/mcp-app.html";
|
|
28730
|
-
|
|
28730
|
+
fZ(server, "get-customer-data", {
|
|
28731
28731
|
title: "Get Customer Data",
|
|
28732
28732
|
description: "Returns customer data with segment information for visualization. Optionally filter by segment.",
|
|
28733
28733
|
inputSchema: GetCustomerDataInputSchema.shape,
|
|
@@ -28740,8 +28740,8 @@ function createServer() {
|
|
|
28740
28740
|
structuredContent: data
|
|
28741
28741
|
};
|
|
28742
28742
|
});
|
|
28743
|
-
|
|
28744
|
-
mimeType:
|
|
28743
|
+
uZ(server, resourceUri, resourceUri, {
|
|
28744
|
+
mimeType: f,
|
|
28745
28745
|
description: "Customer Segmentation Explorer UI"
|
|
28746
28746
|
}, async () => {
|
|
28747
28747
|
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");
|
|
@@ -28749,7 +28749,7 @@ function createServer() {
|
|
|
28749
28749
|
contents: [
|
|
28750
28750
|
{
|
|
28751
28751
|
uri: resourceUri,
|
|
28752
|
-
mimeType:
|
|
28752
|
+
mimeType: f,
|
|
28753
28753
|
text: html
|
|
28754
28754
|
}
|
|
28755
28755
|
]
|