@modelcontextprotocol/server-debug 1.2.1 → 1.3.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/mcp-app.html +2 -2
- package/dist/server.js +67 -64
- package/package.json +1 -1
package/dist/mcp-app.html
CHANGED
|
@@ -64,7 +64,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
64
64
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);p({method:u("ui/open-link"),params:p({url:l().describe("URL to open in the host's browser")})});var hl=p({isError:x().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),ml=p({isError:x().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),fl=p({isError:x().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();p({method:u("ui/notifications/sandbox-proxy-ready"),params:p({})});var Nt=p({connectDomains:k(l()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
65
65
|
|
|
66
66
|
- Maps to CSP \`connect-src\` directive
|
|
67
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:k(l()).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:k(l()).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:k(l()).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'`)")}),At=p({camera:p({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});p({method:u("ui/notifications/size-changed"),params:p({width:w().optional().describe("New width in pixels."),height:w().optional().describe("New height in pixels.")})});var gl=p({method:u("ui/notifications/tool-input"),params:p({arguments:E(l(),P().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),_l=p({method:u("ui/notifications/tool-input-partial"),params:p({arguments:E(l(),P().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),vl=p({method:u("ui/notifications/tool-cancelled"),params:p({reason:l().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),bl=p({fonts:l().optional()}),yl=p({variables:pl.optional().describe("CSS variables for theming the app."),css:bl.optional().describe("CSS blocks that apps can inject.")}),kl=p({method:u("ui/resource-teardown"),params:p({})});E(l(),P());var un=p({text:p({}).optional().describe("Host supports text content blocks."),image:p({}).optional().describe("Host supports image content blocks."),audio:p({}).optional().describe("Host supports audio content blocks."),resource:p({}).optional().describe("Host supports resource content blocks."),resourceLink:p({}).optional().describe("Host supports resource link content blocks."),structuredContent:p({}).optional().describe("Host supports structured content.")}),wl=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),openLinks:p({}).optional().describe("Host supports opening external URLs."),downloadFile:p({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p({listChanged:x().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p({listChanged:x().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p({}).optional().describe("Host accepts log messages."),sandbox:p({permissions:At.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Nt.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:un.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:un.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Sl=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),tools:p({listChanged:x().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:k(Te).optional().describe("Display modes the app supports.")});p({method:u("ui/notifications/initialized"),params:p({}).optional()});p({csp:Nt.optional().describe("Content Security Policy configuration for UI resources."),permissions:At.optional().describe("Sandbox permissions requested by the UI resource."),domain:l().optional().describe(`Dedicated origin for view sandbox.
|
|
67
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:k(l()).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:k(l()).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:k(l()).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'`)")}),At=p({camera:p({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")});p({method:u("ui/notifications/size-changed"),params:p({width:w().optional().describe("New width in pixels."),height:w().optional().describe("New height in pixels.")})});var gl=p({method:u("ui/notifications/tool-input"),params:p({arguments:E(l(),P().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),_l=p({method:u("ui/notifications/tool-input-partial"),params:p({arguments:E(l(),P().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),vl=p({method:u("ui/notifications/tool-cancelled"),params:p({reason:l().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),bl=p({fonts:l().optional()}),yl=p({variables:pl.optional().describe("CSS variables for theming the app."),css:bl.optional().describe("CSS blocks that apps can inject.")}),kl=p({method:u("ui/resource-teardown"),params:p({})});E(l(),P());var un=p({text:p({}).optional().describe("Host supports text content blocks."),image:p({}).optional().describe("Host supports image content blocks."),audio:p({}).optional().describe("Host supports audio content blocks."),resource:p({}).optional().describe("Host supports resource content blocks."),resourceLink:p({}).optional().describe("Host supports resource link content blocks."),structuredContent:p({}).optional().describe("Host supports structured content.")});p({method:u("ui/notifications/request-teardown"),params:p({}).optional()});var wl=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),openLinks:p({}).optional().describe("Host supports opening external URLs."),downloadFile:p({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p({listChanged:x().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p({listChanged:x().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p({}).optional().describe("Host accepts log messages."),sandbox:p({permissions:At.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Nt.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:un.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:un.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Sl=p({experimental:p({}).optional().describe("Experimental features (structure TBD)."),tools:p({listChanged:x().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:k(Te).optional().describe("Display modes the app supports.")});p({method:u("ui/notifications/initialized"),params:p({}).optional()});p({csp:Nt.optional().describe("Content Security Policy configuration for UI resources."),permissions:At.optional().describe("Sandbox permissions requested by the UI resource."),domain:l().optional().describe(`Dedicated origin for view sandbox.
|
|
68
68
|
|
|
69
69
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
70
70
|
|
|
@@ -81,7 +81,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
81
81
|
- omitted: host decides border`)});p({method:u("ui/request-display-mode"),params:p({mode:Te.describe("The display mode being requested.")})});var zl=p({mode:Te.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Tl=S([u("model"),u("app")]).describe("Tool visibility scope - who can access the tool.");p({resourceUri:l().optional(),visibility:k(Tl).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`)});p({mimeTypes:k(l()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});p({method:u("ui/download-file"),params:p({contents:k(S([fo,go])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});p({method:u("ui/message"),params:p({role:u("user").describe('Message role, currently only "user" is supported.'),content:k(Ze).describe("Message content blocks (text, image, etc.).")})});p({method:u("ui/notifications/sandbox-resource-ready"),params:p({html:l().describe("HTML content to load into the inner iframe."),sandbox:l().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Nt.optional().describe("CSP configuration from resource metadata."),permissions:At.optional().describe("Sandbox permissions from resource metadata.")})});var Il=p({method:u("ui/notifications/tool-result"),params:Ye.describe("Standard MCP tool execution result.")}),yo=p({toolInfo:p({id:$e.optional().describe("JSON-RPC id of the tools/call request."),tool:Ot.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:ll.optional().describe("Current color theme preference."),styles:yl.optional().describe("Style configuration for theming the app."),displayMode:Te.optional().describe("How the UI is currently displayed."),availableDisplayModes:k(Te).optional().describe("Display modes the host supports."),containerDimensions:S([p({height:w().describe("Fixed container height in pixels.")}),p({maxHeight:S([w(),st()]).optional().describe("Maximum container height in pixels.")})]).and(S([p({width:w().describe("Fixed container width in pixels.")}),p({maxWidth:S([w(),st()]).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:l().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l().optional().describe("User's timezone in IANA format."),userAgent:l().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({touch:x().optional().describe("Whether the device supports touch input."),hover:x().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),$l=p({method:u("ui/notifications/host-context-changed"),params:yo.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:k(Ze).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E(l(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});p({method:u("ui/initialize"),params:p({appInfo:Ge.describe("App identification (name and version)."),appCapabilities:Sl.describe("Features and capabilities this app provides."),protocolVersion:l().describe("Protocol version this app supports.")})});var El=p({protocolVersion:l().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ge.describe("Host application identification and version."),hostCapabilities:wl.describe("Features and capabilities provided by the host."),hostContext:yo.describe("Rich context about the host environment.")}).passthrough();class Rl extends il{constructor(n,o={},r={autoResize:!0}){super(r);J(this,"_appInfo");J(this,"_capabilities");J(this,"options");J(this,"_hostCapabilities");J(this,"_hostInfo");J(this,"_hostContext");J(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=o,this.options=r,this.setRequestHandler(Qe,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(gl,o=>n(o.params))}set ontoolinputpartial(n){this.setNotificationHandler(_l,o=>n(o.params))}set ontoolresult(n){this.setNotificationHandler(Il,o=>n(o.params))}set ontoolcancelled(n){this.setNotificationHandler(vl,o=>n(o.params))}set onhostcontextchanged(n){this.setNotificationHandler($l,o=>{this._hostContext={...this._hostContext,...o.params},n(o.params)})}set onteardown(n){this.setRequestHandler(kl,(o,r)=>n(o.params,r))}set oncalltool(n){this.setRequestHandler(vo,(o,r)=>n(o.params,r))}set onlisttools(n){this.setRequestHandler(_o,(o,r)=>n(o.params,r))}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,o){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},Ye,o)}async readServerResource(n,o){return await this.request({method:"resources/read",params:n},mo,o)}async listServerResources(n,o){return await this.request({method:"resources/list",params:n},ho,o)}sendMessage(n,o){return this.request({method:"ui/message",params:n},fl,o)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,o){return this.request({method:"ui/update-model-context",params:n},bt,o)}openLink(n,o){return this.request({method:"ui/open-link",params:n},hl,o)}downloadFile(n,o){return this.request({method:"ui/download-file",params:n},ml,o)}requestDisplayMode(n,o){return this.request({method:"ui/request-display-mode",params:n},zl,o)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,o=0,r=0,s=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.width,d=a.style.height;a.style.width="fit-content",a.style.height="max-content";let h=a.getBoundingClientRect();a.style.width=c,a.style.height=d;let f=window.innerWidth-a.clientWidth,g=Math.ceil(h.width+f),_=Math.ceil(h.height);(g!==o||_!==r)&&(o=g,r=_,this.sendSizeChanged({width:g,height:_}))}))};s();let i=new ResizeObserver(s);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(n=new ul(window.parent,window.parent),o){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:al}},El,o);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}const j={eventLog:[],callbackCounts:new Map,lastPayloads:new Map,autoResizeCleanup:null,logFilter:"all"},Pl=["ontoolinput","ontoolinputpartial","ontoolresult","ontoolcancelled","onhostcontextchanged","onteardown","oncalltool","onlisttools","onerror"],qe=document.querySelector(".main"),Le=document.getElementById("event-log"),ln=document.getElementById("log-filter"),xl=document.getElementById("clear-log-btn"),dn=document.getElementById("host-context-info"),pn=document.getElementById("host-capabilities-info"),hn=document.getElementById("host-container-info"),mn=document.getElementById("host-styles-sample"),Cl=document.getElementById("callback-table-body"),Zl=document.getElementById("message-text"),Ol=document.getElementById("send-message-text-btn"),Nl=document.getElementById("send-message-image-btn"),fn=document.getElementById("log-data"),Al=document.getElementById("log-debug-btn"),Ml=document.getElementById("log-info-btn"),ql=document.getElementById("log-warning-btn"),Ll=document.getElementById("log-error-btn"),gn=document.getElementById("context-text"),jl=document.getElementById("update-context-text-btn"),Dl=document.getElementById("update-context-structured-btn"),Ul=document.getElementById("update-context-image-btn"),Hl=document.getElementById("display-inline-btn"),Bl=document.getElementById("display-fullscreen-btn"),Fl=document.getElementById("display-pip-btn"),Jl=document.getElementById("link-url"),Vl=document.getElementById("open-link-btn"),nt=document.getElementById("auto-resize-toggle"),Wl=document.getElementById("resize-200x100-btn"),Kl=document.getElementById("resize-400x300-btn"),Gl=document.getElementById("resize-800x600-btn"),Ql=document.getElementById("current-size"),Yl=document.getElementById("tool-content-type"),Xl=document.getElementById("tool-multiple-blocks"),ed=document.getElementById("tool-structured-content"),td=document.getElementById("tool-include-meta"),nd=document.getElementById("tool-simulate-error"),od=document.getElementById("tool-delay-ms"),rd=document.getElementById("call-debug-tool-btn"),sd=document.getElementById("call-debug-refresh-btn");function id(e){const t=new Date(e),n=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),r=t.getSeconds().toString().padStart(2,"0"),s=t.getMilliseconds().toString().padStart(3,"0");return`${n}:${o}:${r}.${s}`}function ko(e){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"...":t}function Mt(){const e=j.logFilter==="all"?j.eventLog:j.eventLog.filter(n=>n.type===j.logFilter),t=n=>JSON.stringify(n,null,2).replace(/</g,"<").replace(/>/g,">");Le.innerHTML=e.map((n,o)=>`
|
|
84
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:l().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l().optional().describe("User's timezone in IANA format."),userAgent:l().optional().describe("Host application identifier."),platform:S([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({touch:x().optional().describe("Whether the device supports touch input."),hover:x().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),$l=p({method:u("ui/notifications/host-context-changed"),params:yo.describe("Partial context update containing only changed fields.")});p({method:u("ui/update-model-context"),params:p({content:k(Ze).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E(l(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});p({method:u("ui/initialize"),params:p({appInfo:Ge.describe("App identification (name and version)."),appCapabilities:Sl.describe("Features and capabilities this app provides."),protocolVersion:l().describe("Protocol version this app supports.")})});var El=p({protocolVersion:l().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ge.describe("Host application identification and version."),hostCapabilities:wl.describe("Features and capabilities provided by the host."),hostContext:yo.describe("Rich context about the host environment.")}).passthrough();class Rl extends il{constructor(n,o={},r={autoResize:!0}){super(r);J(this,"_appInfo");J(this,"_capabilities");J(this,"options");J(this,"_hostCapabilities");J(this,"_hostInfo");J(this,"_hostContext");J(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=o,this.options=r,this.setRequestHandler(Qe,s=>(console.log("Received ping:",s.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(n){this.setNotificationHandler(gl,o=>n(o.params))}set ontoolinputpartial(n){this.setNotificationHandler(_l,o=>n(o.params))}set ontoolresult(n){this.setNotificationHandler(Il,o=>n(o.params))}set ontoolcancelled(n){this.setNotificationHandler(vl,o=>n(o.params))}set onhostcontextchanged(n){this.setNotificationHandler($l,o=>{this._hostContext={...this._hostContext,...o.params},n(o.params)})}set onteardown(n){this.setRequestHandler(kl,(o,r)=>n(o.params,r))}set oncalltool(n){this.setRequestHandler(vo,(o,r)=>n(o.params,r))}set onlisttools(n){this.setRequestHandler(_o,(o,r)=>n(o.params,r))}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,o){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},Ye,o)}async readServerResource(n,o){return await this.request({method:"resources/read",params:n},mo,o)}async listServerResources(n,o){return await this.request({method:"resources/list",params:n},ho,o)}sendMessage(n,o){return this.request({method:"ui/message",params:n},fl,o)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,o){return this.request({method:"ui/update-model-context",params:n},bt,o)}openLink(n,o){return this.request({method:"ui/open-link",params:n},hl,o)}downloadFile(n,o){return this.request({method:"ui/download-file",params:n},ml,o)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,o){return this.request({method:"ui/request-display-mode",params:n},zl,o)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,o=0,r=0,s=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let a=document.documentElement,c=a.style.width,d=a.style.height;a.style.width="fit-content",a.style.height="max-content";let h=a.getBoundingClientRect();a.style.width=c,a.style.height=d;let f=window.innerWidth-a.clientWidth,g=Math.ceil(h.width+f),_=Math.ceil(h.height);(g!==o||_!==r)&&(o=g,r=_,this.sendSizeChanged({width:g,height:_}))}))};s();let i=new ResizeObserver(s);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(n=new ul(window.parent,window.parent),o){var r;if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let s=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:al}},El,o);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);this._hostCapabilities=s.hostCapabilities,this._hostInfo=s.hostInfo,this._hostContext=s.hostContext,await this.notification({method:"ui/notifications/initialized"}),(r=this.options)!=null&&r.autoResize&&this.setupSizeChangedNotifications()}catch(s){throw this.close(),s}}}const j={eventLog:[],callbackCounts:new Map,lastPayloads:new Map,autoResizeCleanup:null,logFilter:"all"},Pl=["ontoolinput","ontoolinputpartial","ontoolresult","ontoolcancelled","onhostcontextchanged","onteardown","oncalltool","onlisttools","onerror"],qe=document.querySelector(".main"),Le=document.getElementById("event-log"),ln=document.getElementById("log-filter"),xl=document.getElementById("clear-log-btn"),dn=document.getElementById("host-context-info"),pn=document.getElementById("host-capabilities-info"),hn=document.getElementById("host-container-info"),mn=document.getElementById("host-styles-sample"),Cl=document.getElementById("callback-table-body"),Zl=document.getElementById("message-text"),Ol=document.getElementById("send-message-text-btn"),Nl=document.getElementById("send-message-image-btn"),fn=document.getElementById("log-data"),Al=document.getElementById("log-debug-btn"),Ml=document.getElementById("log-info-btn"),ql=document.getElementById("log-warning-btn"),Ll=document.getElementById("log-error-btn"),gn=document.getElementById("context-text"),jl=document.getElementById("update-context-text-btn"),Dl=document.getElementById("update-context-structured-btn"),Ul=document.getElementById("update-context-image-btn"),Hl=document.getElementById("display-inline-btn"),Bl=document.getElementById("display-fullscreen-btn"),Fl=document.getElementById("display-pip-btn"),Jl=document.getElementById("link-url"),Vl=document.getElementById("open-link-btn"),nt=document.getElementById("auto-resize-toggle"),Wl=document.getElementById("resize-200x100-btn"),Kl=document.getElementById("resize-400x300-btn"),Gl=document.getElementById("resize-800x600-btn"),Ql=document.getElementById("current-size"),Yl=document.getElementById("tool-content-type"),Xl=document.getElementById("tool-multiple-blocks"),ed=document.getElementById("tool-structured-content"),td=document.getElementById("tool-include-meta"),nd=document.getElementById("tool-simulate-error"),od=document.getElementById("tool-delay-ms"),rd=document.getElementById("call-debug-tool-btn"),sd=document.getElementById("call-debug-refresh-btn");function id(e){const t=new Date(e),n=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),r=t.getSeconds().toString().padStart(2,"0"),s=t.getMilliseconds().toString().padStart(3,"0");return`${n}:${o}:${r}.${s}`}function ko(e){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"...":t}function Mt(){const e=j.logFilter==="all"?j.eventLog:j.eventLog.filter(n=>n.type===j.logFilter),t=n=>JSON.stringify(n,null,2).replace(/</g,"<").replace(/>/g,">");Le.innerHTML=e.map((n,o)=>`
|
|
85
85
|
<div class="log-entry" data-index="${o}">
|
|
86
86
|
<div class="log-entry-header">
|
|
87
87
|
<span class="log-toggle">▶</span>
|
package/dist/server.js
CHANGED
|
@@ -147,22 +147,22 @@ var require_code = __commonJS((exports) => {
|
|
|
147
147
|
i2++;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function mergeExprItems(a2,
|
|
151
|
-
if (
|
|
150
|
+
function mergeExprItems(a2, b) {
|
|
151
|
+
if (b === '""')
|
|
152
152
|
return a2;
|
|
153
153
|
if (a2 === '""')
|
|
154
|
-
return
|
|
154
|
+
return b;
|
|
155
155
|
if (typeof a2 == "string") {
|
|
156
|
-
if (
|
|
156
|
+
if (b instanceof Name || a2[a2.length - 1] !== '"')
|
|
157
157
|
return;
|
|
158
|
-
if (typeof
|
|
159
|
-
return `${a2.slice(0, -1)}${
|
|
160
|
-
if (
|
|
161
|
-
return a2.slice(0, -1) +
|
|
158
|
+
if (typeof b != "string")
|
|
159
|
+
return `${a2.slice(0, -1)}${b}"`;
|
|
160
|
+
if (b[0] === '"')
|
|
161
|
+
return a2.slice(0, -1) + b.slice(1);
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
if (typeof
|
|
165
|
-
return `"${a2}${
|
|
164
|
+
if (typeof b == "string" && b[0] === '"' && !(a2 instanceof Name))
|
|
165
|
+
return `"${a2}${b.slice(1)}`;
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
function strConcat(c1, c2) {
|
|
@@ -1997,43 +1997,43 @@ var require_subschema = __commonJS((exports) => {
|
|
|
1997
1997
|
|
|
1998
1998
|
// ../../node_modules/fast-deep-equal/index.js
|
|
1999
1999
|
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
2000
|
-
module.exports = function equal(a2,
|
|
2001
|
-
if (a2 ===
|
|
2000
|
+
module.exports = function equal(a2, b) {
|
|
2001
|
+
if (a2 === b)
|
|
2002
2002
|
return true;
|
|
2003
|
-
if (a2 &&
|
|
2004
|
-
if (a2.constructor !==
|
|
2003
|
+
if (a2 && b && typeof a2 == "object" && typeof b == "object") {
|
|
2004
|
+
if (a2.constructor !== b.constructor)
|
|
2005
2005
|
return false;
|
|
2006
2006
|
var length, i2, keys;
|
|
2007
2007
|
if (Array.isArray(a2)) {
|
|
2008
2008
|
length = a2.length;
|
|
2009
|
-
if (length !=
|
|
2009
|
+
if (length != b.length)
|
|
2010
2010
|
return false;
|
|
2011
2011
|
for (i2 = length;i2-- !== 0; )
|
|
2012
|
-
if (!equal(a2[i2],
|
|
2012
|
+
if (!equal(a2[i2], b[i2]))
|
|
2013
2013
|
return false;
|
|
2014
2014
|
return true;
|
|
2015
2015
|
}
|
|
2016
2016
|
if (a2.constructor === RegExp)
|
|
2017
|
-
return a2.source ===
|
|
2017
|
+
return a2.source === b.source && a2.flags === b.flags;
|
|
2018
2018
|
if (a2.valueOf !== Object.prototype.valueOf)
|
|
2019
|
-
return a2.valueOf() ===
|
|
2019
|
+
return a2.valueOf() === b.valueOf();
|
|
2020
2020
|
if (a2.toString !== Object.prototype.toString)
|
|
2021
|
-
return a2.toString() ===
|
|
2021
|
+
return a2.toString() === b.toString();
|
|
2022
2022
|
keys = Object.keys(a2);
|
|
2023
2023
|
length = keys.length;
|
|
2024
|
-
if (length !== Object.keys(
|
|
2024
|
+
if (length !== Object.keys(b).length)
|
|
2025
2025
|
return false;
|
|
2026
2026
|
for (i2 = length;i2-- !== 0; )
|
|
2027
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
2027
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i2]))
|
|
2028
2028
|
return false;
|
|
2029
2029
|
for (i2 = length;i2-- !== 0; ) {
|
|
2030
2030
|
var key = keys[i2];
|
|
2031
|
-
if (!equal(a2[key],
|
|
2031
|
+
if (!equal(a2[key], b[key]))
|
|
2032
2032
|
return false;
|
|
2033
2033
|
}
|
|
2034
2034
|
return true;
|
|
2035
2035
|
}
|
|
2036
|
-
return a2 !== a2 &&
|
|
2036
|
+
return a2 !== a2 && b !== b;
|
|
2037
2037
|
};
|
|
2038
2038
|
});
|
|
2039
2039
|
|
|
@@ -24035,7 +24035,6 @@ function date4(params) {
|
|
|
24035
24035
|
|
|
24036
24036
|
// ../../node_modules/zod/v4/classic/external.js
|
|
24037
24037
|
config(en_default2());
|
|
24038
|
-
|
|
24039
24038
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
24040
24039
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
24041
24040
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
@@ -26983,6 +26982,7 @@ function mergeCapabilities(base, additional) {
|
|
|
26983
26982
|
}
|
|
26984
26983
|
return result;
|
|
26985
26984
|
}
|
|
26985
|
+
|
|
26986
26986
|
// ../../node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
|
|
26987
26987
|
var F = "2026-01-26";
|
|
26988
26988
|
var z2 = "ui/notifications/tool-input-partial";
|
|
@@ -27025,8 +27025,8 @@ class j {
|
|
|
27025
27025
|
sessionId;
|
|
27026
27026
|
setProtocolVersion;
|
|
27027
27027
|
}
|
|
27028
|
-
var
|
|
27029
|
-
var
|
|
27028
|
+
var g = exports_external.union([exports_external.literal("light"), exports_external.literal("dark")]).describe("Color theme preference for the host environment.");
|
|
27029
|
+
var G = exports_external.union([exports_external.literal("inline"), exports_external.literal("fullscreen"), exports_external.literal("pip")]).describe("Display mode for UI presentation.");
|
|
27030
27030
|
var i = 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.");
|
|
27031
27031
|
var o = exports_external.record(i.describe(`Style variables for theming MCP apps.
|
|
27032
27032
|
|
|
@@ -27061,15 +27061,16 @@ var t = exports_external.object({ method: exports_external.literal("ui/notificat
|
|
|
27061
27061
|
var A = 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.") }) });
|
|
27062
27062
|
var P = 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).") }) });
|
|
27063
27063
|
var H = 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").') }) });
|
|
27064
|
-
var
|
|
27065
|
-
var
|
|
27064
|
+
var S = exports_external.object({ fonts: exports_external.string().optional() });
|
|
27065
|
+
var y = exports_external.object({ variables: o.optional().describe("CSS variables for theming the app."), css: S.optional().describe("CSS blocks that apps can inject.") });
|
|
27066
27066
|
var _ = exports_external.object({ method: exports_external.literal("ui/resource-teardown"), params: exports_external.object({}) });
|
|
27067
27067
|
var e = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
27068
27068
|
var q = 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.") });
|
|
27069
|
-
var
|
|
27070
|
-
var
|
|
27071
|
-
var
|
|
27072
|
-
var ZQ = exports_external.object({
|
|
27069
|
+
var QQ = exports_external.object({ method: exports_external.literal("ui/notifications/request-teardown"), params: exports_external.object({}).optional() });
|
|
27070
|
+
var C = 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: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."), message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.") });
|
|
27071
|
+
var f = 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.") });
|
|
27072
|
+
var ZQ = exports_external.object({ method: exports_external.literal("ui/notifications/initialized"), params: exports_external.object({}).optional() });
|
|
27073
|
+
var $Q = 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.
|
|
27073
27074
|
|
|
27074
27075
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
27075
27076
|
|
|
@@ -27084,27 +27085,27 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
27084
27085
|
- \`true\`: request visible border + background
|
|
27085
27086
|
- \`false\`: request no visible border + background
|
|
27086
27087
|
- omitted: host decides border`) });
|
|
27087
|
-
var
|
|
27088
|
-
var T = exports_external.object({ mode:
|
|
27089
|
-
var
|
|
27090
|
-
var
|
|
27088
|
+
var JQ = exports_external.object({ method: exports_external.literal("ui/request-display-mode"), params: exports_external.object({ mode: G.describe("The display mode being requested.") }) });
|
|
27089
|
+
var T = exports_external.object({ mode: G.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
|
|
27090
|
+
var u = exports_external.union([exports_external.literal("model"), exports_external.literal("app")]).describe("Tool visibility scope - who can access the tool.");
|
|
27091
|
+
var XQ = exports_external.object({ resourceUri: exports_external.string().optional(), visibility: exports_external.array(u).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
27091
27092
|
- "model": Tool visible to and callable by the agent
|
|
27092
27093
|
- "app": Tool callable by the app from this server only`) });
|
|
27093
|
-
var
|
|
27094
|
-
var
|
|
27095
|
-
var
|
|
27096
|
-
var
|
|
27097
|
-
var
|
|
27098
|
-
var k = 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:
|
|
27094
|
+
var RQ = 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.') });
|
|
27095
|
+
var VQ = 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.") }) });
|
|
27096
|
+
var DQ = 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.).") }) });
|
|
27097
|
+
var GQ = 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.") }) });
|
|
27098
|
+
var E = exports_external.object({ method: exports_external.literal("ui/notifications/tool-result"), params: CallToolResultSchema.describe("Standard MCP tool execution result.") });
|
|
27099
|
+
var k = 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: g.optional().describe("Current color theme preference."), styles: y.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
|
|
27099
27100
|
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();
|
|
27100
|
-
var
|
|
27101
|
+
var R = exports_external.object({ method: exports_external.literal("ui/notifications/host-context-changed"), params: k.describe("Partial context update containing only changed fields.") });
|
|
27101
27102
|
var LQ = 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.") }) });
|
|
27102
|
-
var
|
|
27103
|
-
var
|
|
27103
|
+
var WQ = exports_external.object({ method: exports_external.literal("ui/initialize"), params: exports_external.object({ appInfo: ImplementationSchema.describe("App identification (name and version)."), appCapabilities: f.describe("Features and capabilities this app provides."), protocolVersion: exports_external.string().describe("Protocol version this app supports.") }) });
|
|
27104
|
+
var U = 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: C.describe("Features and capabilities provided by the host."), hostContext: k.describe("Rich context about the host environment.") }).passthrough();
|
|
27104
27105
|
var v = "ui/resourceUri";
|
|
27105
27106
|
var d = "text/html;profile=mcp-app";
|
|
27106
27107
|
|
|
27107
|
-
class
|
|
27108
|
+
class OQ extends Protocol {
|
|
27108
27109
|
_appInfo;
|
|
27109
27110
|
_capabilities;
|
|
27110
27111
|
options;
|
|
@@ -27136,13 +27137,13 @@ class qQ extends Protocol {
|
|
|
27136
27137
|
this.setNotificationHandler(P, ($) => Z($.params));
|
|
27137
27138
|
}
|
|
27138
27139
|
set ontoolresult(Z) {
|
|
27139
|
-
this.setNotificationHandler(
|
|
27140
|
+
this.setNotificationHandler(E, ($) => Z($.params));
|
|
27140
27141
|
}
|
|
27141
27142
|
set ontoolcancelled(Z) {
|
|
27142
27143
|
this.setNotificationHandler(H, ($) => Z($.params));
|
|
27143
27144
|
}
|
|
27144
27145
|
set onhostcontextchanged(Z) {
|
|
27145
|
-
this.setNotificationHandler(
|
|
27146
|
+
this.setNotificationHandler(R, ($) => {
|
|
27146
27147
|
this._hostContext = { ...this._hostContext, ...$.params }, Z($.params);
|
|
27147
27148
|
});
|
|
27148
27149
|
}
|
|
@@ -27204,6 +27205,9 @@ class qQ extends Protocol {
|
|
|
27204
27205
|
downloadFile(Z, $) {
|
|
27205
27206
|
return this.request({ method: "ui/download-file", params: Z }, I, $);
|
|
27206
27207
|
}
|
|
27208
|
+
requestTeardown(Z = {}) {
|
|
27209
|
+
return this.notification({ method: "ui/notifications/request-teardown", params: Z });
|
|
27210
|
+
}
|
|
27207
27211
|
requestDisplayMode(Z, $) {
|
|
27208
27212
|
return this.request({ method: "ui/request-display-mode", params: Z }, T, $);
|
|
27209
27213
|
}
|
|
@@ -27216,11 +27220,11 @@ class qQ extends Protocol {
|
|
|
27216
27220
|
return;
|
|
27217
27221
|
Z = true, requestAnimationFrame(() => {
|
|
27218
27222
|
Z = false;
|
|
27219
|
-
let V = document.documentElement,
|
|
27223
|
+
let V = document.documentElement, L = V.style.width, W = V.style.height;
|
|
27220
27224
|
V.style.width = "fit-content", V.style.height = "max-content";
|
|
27221
|
-
let
|
|
27222
|
-
V.style.width =
|
|
27223
|
-
let h = window.innerWidth - V.clientWidth, N = Math.ceil(
|
|
27225
|
+
let x = V.getBoundingClientRect();
|
|
27226
|
+
V.style.width = L, V.style.height = W;
|
|
27227
|
+
let h = window.innerWidth - V.clientWidth, N = Math.ceil(x.width + h), Y = Math.ceil(x.height);
|
|
27224
27228
|
if (N !== $ || Y !== J)
|
|
27225
27229
|
$ = N, J = Y, this.sendSizeChanged({ width: N, height: Y });
|
|
27226
27230
|
});
|
|
@@ -27234,7 +27238,7 @@ class qQ extends Protocol {
|
|
|
27234
27238
|
throw Error("App is already connected. Call close() before connecting again.");
|
|
27235
27239
|
await super.connect(Z);
|
|
27236
27240
|
try {
|
|
27237
|
-
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } },
|
|
27241
|
+
let J = await this.request({ method: "ui/initialize", params: { appCapabilities: this._capabilities, appInfo: this._appInfo, protocolVersion: F } }, U, $);
|
|
27238
27242
|
if (J === undefined)
|
|
27239
27243
|
throw Error(`Server sent invalid initialize result: ${J}`);
|
|
27240
27244
|
if (this._hostCapabilities = J.hostCapabilities, this._hostInfo = J.hostInfo, this._hostContext = J.hostContext, await this.notification({ method: "ui/notifications/initialized" }), this.options?.autoResize)
|
|
@@ -27244,15 +27248,15 @@ class qQ extends Protocol {
|
|
|
27244
27248
|
}
|
|
27245
27249
|
}
|
|
27246
27250
|
}
|
|
27247
|
-
function
|
|
27248
|
-
let D = J._meta, V = D.ui,
|
|
27249
|
-
if (V?.resourceUri && !
|
|
27251
|
+
function hZ(Z, $, J, X) {
|
|
27252
|
+
let D = J._meta, V = D.ui, L = D[v], W = D;
|
|
27253
|
+
if (V?.resourceUri && !L)
|
|
27250
27254
|
W = { ...D, [v]: V.resourceUri };
|
|
27251
|
-
else if (
|
|
27252
|
-
W = { ...D, ui: { ...V, resourceUri:
|
|
27255
|
+
else if (L && !V?.resourceUri)
|
|
27256
|
+
W = { ...D, ui: { ...V, resourceUri: L } };
|
|
27253
27257
|
return Z.registerTool($, { ...J, _meta: W }, X);
|
|
27254
27258
|
}
|
|
27255
|
-
function
|
|
27259
|
+
function mZ(Z, $, J, X, D) {
|
|
27256
27260
|
return Z.registerResource($, J, { mimeType: d, ...X }, D);
|
|
27257
27261
|
}
|
|
27258
27262
|
|
|
@@ -27772,7 +27776,6 @@ class ExperimentalMcpServerTasks {
|
|
|
27772
27776
|
return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler);
|
|
27773
27777
|
}
|
|
27774
27778
|
}
|
|
27775
|
-
|
|
27776
27779
|
// ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
27777
27780
|
class McpServer {
|
|
27778
27781
|
constructor(serverInfo, options) {
|
|
@@ -28591,7 +28594,7 @@ function createServer() {
|
|
|
28591
28594
|
version: "1.0.0"
|
|
28592
28595
|
});
|
|
28593
28596
|
const resourceUri = "ui://debug-tool/mcp-app.html";
|
|
28594
|
-
|
|
28597
|
+
hZ(server, "debug-tool", {
|
|
28595
28598
|
title: "Debug Tool",
|
|
28596
28599
|
description: "Comprehensive debug tool for testing MCP Apps SDK. Configure content types, error simulation, delays, and more.",
|
|
28597
28600
|
inputSchema: DebugInputSchema,
|
|
@@ -28624,7 +28627,7 @@ function createServer() {
|
|
|
28624
28627
|
}
|
|
28625
28628
|
return result;
|
|
28626
28629
|
});
|
|
28627
|
-
|
|
28630
|
+
hZ(server, "debug-refresh", {
|
|
28628
28631
|
title: "Refresh Debug Info",
|
|
28629
28632
|
description: "App-only tool for polling server state. Not visible to the model.",
|
|
28630
28633
|
inputSchema: exports_external.object({}),
|
|
@@ -28642,7 +28645,7 @@ function createServer() {
|
|
|
28642
28645
|
structuredContent: { timestamp, counter: callCounter }
|
|
28643
28646
|
};
|
|
28644
28647
|
});
|
|
28645
|
-
|
|
28648
|
+
hZ(server, "debug-log", {
|
|
28646
28649
|
title: "Log to File",
|
|
28647
28650
|
description: "App-only tool for logging events to the server log file. Not visible to the model.",
|
|
28648
28651
|
inputSchema: exports_external.object({
|
|
@@ -28664,7 +28667,7 @@ function createServer() {
|
|
|
28664
28667
|
structuredContent: { logged: true, logFile: logFilePath }
|
|
28665
28668
|
};
|
|
28666
28669
|
});
|
|
28667
|
-
|
|
28670
|
+
mZ(server, resourceUri, resourceUri, { mimeType: d }, async () => {
|
|
28668
28671
|
const html = await fs.readFile(path.join(DIST_DIR, "mcp-app.html"), "utf-8");
|
|
28669
28672
|
return {
|
|
28670
28673
|
contents: [
|