@agentic-ui-experience/ui-mcp 0.0.1-beta.1 → 0.0.1-beta.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/README.md +13 -7
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +11 -51
- package/dist/index.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -6,6 +6,12 @@ This package does not render or ingest UI. It exposes catalog discovery tools
|
|
|
6
6
|
and a `send_ui_to_client` MCP tool that returns validated A2UI messages in
|
|
7
7
|
`structuredContent`, so the host can forward them to `@agentic-ui-experience/ui-runtime`.
|
|
8
8
|
|
|
9
|
+
`@agentic-ui-experience/ui-mcp` is an MCP adapter over
|
|
10
|
+
`@agentic-ui-experience/ui-core/tool-mode`. Catalog registry, catalog resource
|
|
11
|
+
payloads, catalog filtering, and `send_ui_to_client` normalization live in
|
|
12
|
+
`ui-core`; this package only maps those provider-neutral operations onto MCP
|
|
13
|
+
resources and tools.
|
|
14
|
+
|
|
9
15
|
The A2UI basic catalog is built in. Scenario-specific catalogs are registered
|
|
10
16
|
when the MCP server is created, then discovered through tools or resources.
|
|
11
17
|
|
|
@@ -14,7 +20,7 @@ import { createUIMCPServer } from "@agentic-ui-experience/ui-mcp";
|
|
|
14
20
|
|
|
15
21
|
const server = createUIMCPServer({
|
|
16
22
|
catalogs: [weatherPromptDescriptor],
|
|
17
|
-
defaultCatalogId: "com.agentic-ui-experience.
|
|
23
|
+
defaultCatalogId: "com.agentic-ui-experience.examples.weather.v1",
|
|
18
24
|
catalogInstructionMode: "compact"
|
|
19
25
|
});
|
|
20
26
|
|
|
@@ -87,7 +93,7 @@ Custom catalogs can be loaded from ESM modules:
|
|
|
87
93
|
ax-ui-mcp \
|
|
88
94
|
--transport http \
|
|
89
95
|
--catalog ./weather-catalog.js \
|
|
90
|
-
--default-catalog-id com.agentic-ui-experience.
|
|
96
|
+
--default-catalog-id com.agentic-ui-experience.examples.weather.v1 \
|
|
91
97
|
--catalog-instruction-mode compact
|
|
92
98
|
```
|
|
93
99
|
|
|
@@ -96,7 +102,7 @@ With the package scripts, append extra CLI flags after `--`:
|
|
|
96
102
|
```bash
|
|
97
103
|
pnpm --filter @agentic-ui-experience/ui-mcp start:http -- \
|
|
98
104
|
--catalog ./weather-catalog.js \
|
|
99
|
-
--default-catalog-id com.agentic-ui-experience.
|
|
105
|
+
--default-catalog-id com.agentic-ui-experience.examples.weather.v1
|
|
100
106
|
```
|
|
101
107
|
|
|
102
108
|
The catalog module may export a descriptor directly, a `catalog`, a `catalogs`
|
|
@@ -121,7 +127,7 @@ list_ui_catalogs();
|
|
|
121
127
|
// Step 2: fetch the catalog instructions and schemas for the components needed
|
|
122
128
|
// by this UI. Use instructionMode: "full" when exact fields are needed.
|
|
123
129
|
get_ui_catalog({
|
|
124
|
-
catalogId: "com.agentic-ui-experience.
|
|
130
|
+
catalogId: "com.agentic-ui-experience.examples.weather.v1",
|
|
125
131
|
componentNames: ["Card", "Text", "WeatherIcon"],
|
|
126
132
|
instructionMode: "full"
|
|
127
133
|
});
|
|
@@ -130,11 +136,11 @@ get_ui_catalog({
|
|
|
130
136
|
send_ui_to_client({
|
|
131
137
|
// Top-level catalogId is an expected-value guard for the MCP server.
|
|
132
138
|
// The createSurface message must still repeat the same catalogId.
|
|
133
|
-
catalogId: "com.agentic-ui-experience.
|
|
139
|
+
catalogId: "com.agentic-ui-experience.examples.weather.v1",
|
|
134
140
|
surfaceId: "main",
|
|
135
141
|
messages: [
|
|
136
|
-
{ version: "v0.9", createSurface: { surfaceId: "main", catalogId: "com.agentic-ui-experience.
|
|
137
|
-
{ version: "v0.9", updateComponents: { surfaceId: "main", components: [] } }
|
|
142
|
+
{ version: "v0.9", createSurface: { surfaceId: "main", catalogId: "com.agentic-ui-experience.examples.weather.v1" } },
|
|
143
|
+
{ version: "v0.9", updateComponents: { surfaceId: "main", components: [{ id: "root", component: "Text", text: "Current weather" }] } }
|
|
138
144
|
]
|
|
139
145
|
});
|
|
140
146
|
```
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const _0x5c41eb=_0x4cfc;(function(_0x7b26db,_0x40af55){const _0x51424d=_0x4cfc,_0x35b03=_0x7b26db();while(!![]){try{const _0x138791=-parseInt(_0x51424d(0x109))/0x1+parseInt(_0x51424d(0x106))/0x2*(parseInt(_0x51424d(0xeb))/0x3)+-parseInt(_0x51424d(0xd9))/0x4+-parseInt(_0x51424d(0x10e))/0x5*(parseInt(_0x51424d(0x10b))/0x6)+-parseInt(_0x51424d(0xdb))/0x7+-parseInt(_0x51424d(0xe2))/0x8*(-parseInt(_0x51424d(0xe8))/0x9)+-parseInt(_0x51424d(0x113))/0xa*(-parseInt(_0x51424d(0xd7))/0xb);if(_0x138791===_0x40af55)break;else _0x35b03['push'](_0x35b03['shift']());}catch(_0x1b59eb){_0x35b03['push'](_0x35b03['shift']());}}}(_0x259d,0xc6c5d));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';function _0x259d(){const _0x572065=['SIGTERM','url','25734xNdQRw','Unsupported\x20transport\x20\x22','stdio','catalogs','message','application/json','\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.','http://','port','error','values','endpoint','compact','origin','help','name','full','Unsupported\x20catalog\x20instruction\x20mode\x20\x22','catalog','cors-origin','serverName','headersSent','SIGINT','@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://','isArray','stderr','headers','80roGBLE','3001','catalog-instruction-mode','345870uiNdbA','Catalog\x20module\x20\x22','2426802buegrC','/mcp','version','15iNgqux','isInteger','2.0','[@agentic-ui-experience/ui-mcp]\x20request\x20failed','GET,POST,DELETE,OPTIONS','510JqGkkN','Not\x20Found','push','connect','exit','catch','statusCode','Invalid\x20--port\x20\x22','serverVersion','475574yBaJdk','once','5977596tDcDNL','write','880047rltVbw','host','Access-Control-Allow-Origin','defaultCatalogId','corsOrigins','setHeader','length','30920EdQEyr','end','content-type','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID','string','close','3366eZxItw'];_0x259d=function(){return _0x572065;};return _0x259d();}import{createUIMCPServer}from'./index.js';const helpText='@agentic-ui-experience/ui-mcp\x0a\x0aUsage:\x0a\x20\x20ax-ui-mcp\x20[options]\x0a\x0aOptions:\x0a\x20\x20--transport\x20<stdio|http>\x20\x20\x20\x20\x20\x20MCP\x20transport\x20to\x20start.\x20Default:\x20stdio\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20host.\x20Default:\x20127.0.0.1\x0a\x20\x20--port\x20<port>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20port.\x20Default:\x203001\x0a\x20\x20--endpoint\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20MCP\x20endpoint.\x20Default:\x20/mcp\x0a\x20\x20--cors-origin\x20<origin>\x20\x20\x20\x20\x20\x20\x20\x20Allow\x20a\x20browser\x20origin.\x20Repeatable.\x20Use\x20\x22*\x22\x20for\x20development.\x0a\x20\x20--catalog\x20<module>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ESM\x20module\x20exporting\x20a\x20CatalogPromptDescriptor\x20or\x20array.\x20Repeatable.\x0a\x20\x20--default-catalog-id\x20<id>\x20\x20\x20\x20\x20Default\x20catalog\x20id.\x0a\x20\x20--catalog-instruction-mode\x20<compact|full>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default\x20get_ui_catalog\x20instruction\x20detail.\x20Default:\x20compact\x0a\x20\x20--name\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20name.\x20Default:\x20@agentic-ui-experience/ui-mcp\x0a\x20\x20--version\x20<version>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20version.\x20Default:\x200.0.0\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a\x20\x20export\x20const\x20catalogs\x20=\x20[descriptor]\x0a\x20\x20export\x20const\x20defaultCatalogId\x20=\x20\x22...\x22\x0a';function stringValue(_0x57033a,_0x9bff82){const _0x5cf781=_0x4cfc;return typeof _0x57033a===_0x5cf781(0xe6)&&_0x57033a[_0x5cf781(0xe1)]>0x0?_0x57033a:_0x9bff82;}function optionalStringValue(_0x4e8482){const _0x5bd9d6=_0x4cfc;return typeof _0x4e8482===_0x5bd9d6(0xe6)&&_0x4e8482[_0x5bd9d6(0xe1)]>0x0?_0x4e8482:void 0x0;}function stringArrayValue(_0x49996a){if(Array['isArray'](_0x49996a))return _0x49996a;if(typeof _0x49996a==='string'&&_0x49996a['length']>0x0)return[_0x49996a];return[];}function parseTransport(_0x2e46ab){const _0x16b84c=_0x4cfc;if(_0x2e46ab===_0x16b84c(0xed)||_0x2e46ab==='http')return _0x2e46ab;throw new Error(_0x16b84c(0xec)+_0x2e46ab+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function parseCatalogInstructionMode(_0x4200d1){const _0x259909=_0x4cfc;if(_0x4200d1===_0x259909(0xf7)||_0x4200d1===_0x259909(0xfb))return _0x4200d1;throw new Error(_0x259909(0xfc)+_0x4200d1+'\x22.\x20Expected\x20\x22compact\x22\x20or\x20\x22full\x22.');}function parsePort(_0xc2fc53){const _0x4b1dda=_0x4cfc,_0x2a925d=Number(_0xc2fc53);if(!Number[_0x4b1dda(0x10f)](_0x2a925d)||_0x2a925d<0x1||_0x2a925d>0xffff)throw new Error(_0x4b1dda(0xd5)+_0xc2fc53+'\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.');return _0x2a925d;}function _0x4cfc(_0x588656,_0x11b581){_0x588656=_0x588656-0xd0;const _0x259d9a=_0x259d();let _0x4cfca2=_0x259d9a[_0x588656];return _0x4cfca2;}function normalizeEndpoint(_0x43f33f){if(!_0x43f33f['startsWith']('/'))return'/'+_0x43f33f;return _0x43f33f;}function isCatalogDescriptor(_0x5d99ae){const _0x4ae05f=_0x4cfc;return!!_0x5d99ae&&typeof _0x5d99ae==='object'&&!Array[_0x4ae05f(0x103)](_0x5d99ae)&&typeof _0x5d99ae['id']===_0x4ae05f(0xe6)&&Array['isArray'](_0x5d99ae['baseComponentNames']);}function readCatalogExports(_0x40ebe7,_0x353d78){const _0x2946a2=_0x4cfc,_0x6ac8e0=_0x40ebe7['catalogs']??_0x40ebe7[_0x2946a2(0xfd)]??_0x40ebe7['default'],_0x5eead9=[];if(Array[_0x2946a2(0x103)](_0x6ac8e0))for(const _0x1a9694 of _0x6ac8e0){if(!isCatalogDescriptor(_0x1a9694))throw new Error(_0x2946a2(0x10a)+_0x353d78+_0x2946a2(0xf1));_0x5eead9[_0x2946a2(0xd0)](_0x1a9694);}else{if(_0x6ac8e0!==void 0x0){if(!isCatalogDescriptor(_0x6ac8e0))throw new Error('Catalog\x20module\x20\x22'+_0x353d78+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');_0x5eead9['push'](_0x6ac8e0);}}if(_0x5eead9[_0x2946a2(0xe1)]===0x0)throw new Error('Catalog\x20module\x20\x22'+_0x353d78+'\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.');const _0x3ff69b=typeof _0x40ebe7[_0x2946a2(0xde)]===_0x2946a2(0xe6)&&_0x40ebe7['defaultCatalogId'][_0x2946a2(0xe1)]>0x0?_0x40ebe7['defaultCatalogId']:void 0x0;return{'catalogs':_0x5eead9,'defaultCatalogId':_0x3ff69b};}async function loadCatalogs(_0x211373){const _0xb62c7e=_0x4cfc,_0x16174e=[];let _0x24a25d;for(const _0x204218 of _0x211373){const _0x2d19ed=await import(pathToFileURL(resolve(_0x204218))['href']),_0xd20c0a=readCatalogExports(_0x2d19ed,_0x204218);_0x16174e['push'](..._0xd20c0a[_0xb62c7e(0xee)]),_0x24a25d??(_0x24a25d=_0xd20c0a[_0xb62c7e(0xde)]);}return{'catalogs':_0x16174e,'defaultCatalogId':_0x24a25d};}async function parseCliOptions(){const _0x38a8f3=_0x4cfc,_0x69245=parseArgs({'allowPositionals':![],'options':{'transport':{'type':'string'},'host':{'type':'string'},'port':{'type':_0x38a8f3(0xe6)},'endpoint':{'type':_0x38a8f3(0xe6)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':'string','multiple':!![]},'default-catalog-id':{'type':'string'},'catalog-instruction-mode':{'type':_0x38a8f3(0xe6)},'name':{'type':_0x38a8f3(0xe6)},'version':{'type':_0x38a8f3(0xe6)},'help':{'type':'boolean','short':'h'}}});_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0xf9)]&&(process['stdout'][_0x38a8f3(0xda)](helpText),process['exit'](0x0));const _0xd7f208=await loadCatalogs(stringArrayValue(_0x69245['values']['catalog'])),_0x364640=optionalStringValue(_0x69245['values']['default-catalog-id'])??_0xd7f208['defaultCatalogId'];return{'transport':parseTransport(stringValue(_0x69245[_0x38a8f3(0xf5)]['transport'],_0x38a8f3(0xed))),'host':stringValue(_0x69245['values'][_0x38a8f3(0xdc)],'127.0.0.1'),'port':parsePort(stringValue(_0x69245['values'][_0x38a8f3(0xf3)],_0x38a8f3(0x107))),'endpoint':normalizeEndpoint(stringValue(_0x69245[_0x38a8f3(0xf5)]['endpoint'],_0x38a8f3(0x10c))),'corsOrigins':stringArrayValue(_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0xfe)]),'catalogs':_0xd7f208['catalogs'],..._0x364640?{'defaultCatalogId':_0x364640}:{},'catalogInstructionMode':parseCatalogInstructionMode(stringValue(_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0x108)],'compact')),...optionalStringValue(_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0xfa)])?{'serverName':optionalStringValue(_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0xfa)])}:{},...optionalStringValue(_0x69245['values'][_0x38a8f3(0x10d)])?{'serverVersion':optionalStringValue(_0x69245[_0x38a8f3(0xf5)][_0x38a8f3(0x10d)])}:{}};}function createServerOptions(_0x201957){const _0x5d1504=_0x4cfc;return{'catalogs':_0x201957['catalogs'],..._0x201957['defaultCatalogId']?{'defaultCatalogId':_0x201957[_0x5d1504(0xde)]}:{},..._0x201957['catalogInstructionMode']?{'catalogInstructionMode':_0x201957['catalogInstructionMode']}:{},'server':{..._0x201957[_0x5d1504(0xff)]?{'name':_0x201957['serverName']}:{},..._0x201957[_0x5d1504(0xd6)]?{'version':_0x201957['serverVersion']}:{}}};}function setCorsHeaders(_0x44de0e,_0x311e4b,_0x573cf9){const _0xc0adbe=_0x4cfc;if(_0x573cf9['length']===0x0)return;const _0x37766e=_0x44de0e[_0xc0adbe(0x105)][_0xc0adbe(0xf8)],_0x4ddc7c=_0x573cf9['includes']('*'),_0x3988a6=_0x4ddc7c?'*':typeof _0x37766e==='string'&&_0x573cf9['includes'](_0x37766e)?_0x37766e:void 0x0;if(!_0x3988a6)return;_0x311e4b[_0xc0adbe(0xe0)](_0xc0adbe(0xdd),_0x3988a6),_0x311e4b[_0xc0adbe(0xe0)]('Vary','Origin'),_0x311e4b['setHeader']('Access-Control-Allow-Methods',_0xc0adbe(0x112)),_0x311e4b['setHeader']('Access-Control-Allow-Headers',_0xc0adbe(0xe5)),_0x311e4b['setHeader']('Access-Control-Expose-Headers','Mcp-Session-Id');}function writeJsonRpcError(_0x33aa2a,_0x4c4c7c,_0x172e65){const _0x15c8eb=_0x4cfc;_0x33aa2a['statusCode']=_0x4c4c7c,_0x33aa2a['setHeader'](_0x15c8eb(0xe4),_0x15c8eb(0xf0)),_0x33aa2a['end'](JSON['stringify']({'jsonrpc':_0x15c8eb(0x110),'error':{'code':-0x7f5b,'message':_0x172e65},'id':null}));}async function startStdio(_0x4e0733){const _0xa0c496=_0x4cfc,_0x4cbb3b=createUIMCPServer(createServerOptions(_0x4e0733));await _0x4cbb3b[_0xa0c496(0xd1)](new StdioServerTransport());}async function startHttp(_0x55ff26){const _0x67f350=_0x4cfc,_0x42ce92=createServer(async(_0x150897,_0x4e36c2)=>{const _0x16dd34=_0x4cfc,_0x2e28ac=new URL(_0x150897[_0x16dd34(0xea)]??'/',_0x16dd34(0xf2)+(_0x150897['headers'][_0x16dd34(0xdc)]??'localhost'));if(_0x2e28ac['pathname']!==_0x55ff26[_0x16dd34(0xf6)]){_0x4e36c2[_0x16dd34(0xd4)]=0x194,_0x4e36c2[_0x16dd34(0xe3)](_0x16dd34(0x114));return;}setCorsHeaders(_0x150897,_0x4e36c2,_0x55ff26[_0x16dd34(0xdf)]);if(_0x150897['method']==='OPTIONS'){_0x4e36c2['statusCode']=0xcc,_0x4e36c2[_0x16dd34(0xe3)]();return;}const _0x3c34a2=createUIMCPServer(createServerOptions(_0x55ff26)),_0xe70b4a=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});try{await _0x3c34a2[_0x16dd34(0xd1)](_0xe70b4a),await _0xe70b4a['handleRequest'](_0x150897,_0x4e36c2),_0x4e36c2['on'](_0x16dd34(0xe7),()=>{const _0x371ae2=_0x16dd34;void _0xe70b4a['close'](),void _0x3c34a2[_0x371ae2(0xe7)]();});}catch(_0x24e23d){console['error'](_0x16dd34(0x111),_0x24e23d),!_0x4e36c2[_0x16dd34(0x100)]&&writeJsonRpcError(_0x4e36c2,0x1f4,_0x24e23d instanceof Error?_0x24e23d[_0x16dd34(0xef)]:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x46168b,_0x4ebe4c)=>{const _0x32bd34=_0x4cfc;_0x42ce92[_0x32bd34(0xd8)](_0x32bd34(0xf4),_0x4ebe4c),_0x42ce92['listen'](_0x55ff26['port'],_0x55ff26[_0x32bd34(0xdc)],_0x46168b);});const _0x3b497b=()=>{const _0x172a04=_0x4cfc;_0x42ce92['close'](()=>process[_0x172a04(0xd2)](0x0));};process[_0x67f350(0xd8)](_0x67f350(0x101),_0x3b497b),process[_0x67f350(0xd8)](_0x67f350(0xe9),_0x3b497b),process[_0x67f350(0x104)][_0x67f350(0xda)](_0x67f350(0x102)+_0x55ff26['host']+':'+_0x55ff26['port']+_0x55ff26['endpoint']+'\x0a');}async function main(){const _0x59f7d8=_0x4cfc,_0x3a544e=await parseCliOptions();if(_0x3a544e['transport']===_0x59f7d8(0xed)){await startStdio(_0x3a544e);return;}await startHttp(_0x3a544e);}main()[_0x5c41eb(0xd3)](_0x552754=>{const _0x25b708=_0x5c41eb;process[_0x25b708(0x104)]['write']((_0x552754 instanceof Error?_0x552754[_0x25b708(0xef)]:String(_0x552754))+'\x0a'),process[_0x25b708(0xd2)](0x1);});
|
|
2
|
+
const _0x31d86c=_0x320f;(function(_0x30e064,_0x478da1){const _0x3d4659=_0x320f,_0x5414b8=_0x30e064();while(!![]){try{const _0x19b178=-parseInt(_0x3d4659(0x148))/0x1+parseInt(_0x3d4659(0x147))/0x2+parseInt(_0x3d4659(0x137))/0x3*(-parseInt(_0x3d4659(0x16a))/0x4)+-parseInt(_0x3d4659(0x150))/0x5*(-parseInt(_0x3d4659(0x13f))/0x6)+parseInt(_0x3d4659(0x16f))/0x7*(parseInt(_0x3d4659(0x163))/0x8)+parseInt(_0x3d4659(0x161))/0x9+-parseInt(_0x3d4659(0x139))/0xa;if(_0x19b178===_0x478da1)break;else _0x5414b8['push'](_0x5414b8['shift']());}catch(_0x5a58ab){_0x5414b8['push'](_0x5414b8['shift']());}}}(_0x370b,0x4c96b));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createUIMCPServer}from'./index.js';const helpText=_0x31d86c(0x171);function stringValue(_0x4b1b28,_0x63a6c3){const _0x52d2ac=_0x31d86c;return typeof _0x4b1b28==='string'&&_0x4b1b28[_0x52d2ac(0x170)]>0x0?_0x4b1b28:_0x63a6c3;}function optionalStringValue(_0x539a86){return typeof _0x539a86==='string'&&_0x539a86['length']>0x0?_0x539a86:void 0x0;}function stringArrayValue(_0x30c485){const _0x44301a=_0x31d86c;if(Array[_0x44301a(0x167)](_0x30c485))return _0x30c485;if(typeof _0x30c485==='string'&&_0x30c485['length']>0x0)return[_0x30c485];return[];}function _0x370b(){const _0x2a8940=['stringify','7yRlHAo','length','@agentic-ui-experience/ui-mcp\x0a\x0aUsage:\x0a\x20\x20ax-ui-mcp\x20[options]\x0a\x0aOptions:\x0a\x20\x20--transport\x20<stdio|http>\x20\x20\x20\x20\x20\x20MCP\x20transport\x20to\x20start.\x20Default:\x20stdio\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20host.\x20Default:\x20127.0.0.1\x0a\x20\x20--port\x20<port>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20bind\x20port.\x20Default:\x203001\x0a\x20\x20--endpoint\x20<path>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20HTTP\x20MCP\x20endpoint.\x20Default:\x20/mcp\x0a\x20\x20--cors-origin\x20<origin>\x20\x20\x20\x20\x20\x20\x20\x20Allow\x20a\x20browser\x20origin.\x20Repeatable.\x20Use\x20\x22*\x22\x20for\x20development.\x0a\x20\x20--catalog\x20<module>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ESM\x20module\x20exporting\x20a\x20CatalogPromptDescriptor\x20or\x20array.\x20Repeatable.\x0a\x20\x20--default-catalog-id\x20<id>\x20\x20\x20\x20\x20Default\x20catalog\x20id.\x0a\x20\x20--catalog-instruction-mode\x20<compact|full>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Default\x20get_ui_catalog\x20instruction\x20detail.\x20Default:\x20compact\x0a\x20\x20--name\x20<name>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20name.\x20Default:\x20@agentic-ui-experience/ui-mcp\x0a\x20\x20--version\x20<version>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20MCP\x20server\x20version.\x20Default:\x200.0.0\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a\x20\x20export\x20const\x20catalogs\x20=\x20[descriptor]\x0a\x20\x20export\x20const\x20defaultCatalogId\x20=\x20\x22...\x22\x0a','serverVersion','push','once','stderr','3GfKUNO','serverName','10559010mOUjBR','headers','includes','stdio','Access-Control-Expose-Headers','error','89508GHXthM','2.0','setHeader','url','content-type','@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://','startsWith','SIGINT','1229852hOjORW','174013hhITQX','headersSent','Catalog\x20module\x20\x22','baseComponentNames','catalogInstructionMode','message','pathname','Origin','175tlZnkQ','http://','values','full','write','GET,POST,DELETE,OPTIONS','host','Unsupported\x20catalog\x20instruction\x20mode\x20\x22','statusCode','end','transport','default-catalog-id','catch','help','string','\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.','default','4499667IAutnk','version','3942168krPtLz','port','endpoint','exit','isArray','\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.','/mcp','2344676Nswlkw','handleRequest','defaultCatalogId','catalogs'];_0x370b=function(){return _0x2a8940;};return _0x370b();}function parseTransport(_0x2f52f5){const _0x31f8ef=_0x31d86c;if(_0x2f52f5===_0x31f8ef(0x13c)||_0x2f52f5==='http')return _0x2f52f5;throw new Error('Unsupported\x20transport\x20\x22'+_0x2f52f5+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function _0x320f(_0x4055fa,_0x330141){_0x4055fa=_0x4055fa-0x134;const _0x370b41=_0x370b();let _0x320f98=_0x370b41[_0x4055fa];return _0x320f98;}function parseCatalogInstructionMode(_0x50f335){const _0x1eba0f=_0x31d86c;if(_0x50f335==='compact'||_0x50f335===_0x1eba0f(0x153))return _0x50f335;throw new Error(_0x1eba0f(0x157)+_0x50f335+'\x22.\x20Expected\x20\x22compact\x22\x20or\x20\x22full\x22.');}function parsePort(_0x5e7857){const _0x296c39=_0x31d86c,_0x29a6b0=Number(_0x5e7857);if(!Number['isInteger'](_0x29a6b0)||_0x29a6b0<0x1||_0x29a6b0>0xffff)throw new Error('Invalid\x20--port\x20\x22'+_0x5e7857+_0x296c39(0x168));return _0x29a6b0;}function normalizeEndpoint(_0x35fe11){const _0x3755b8=_0x31d86c;if(!_0x35fe11[_0x3755b8(0x145)]('/'))return'/'+_0x35fe11;return _0x35fe11;}function isCatalogDescriptor(_0x12b55b){const _0x23f50a=_0x31d86c;return!!_0x12b55b&&typeof _0x12b55b==='object'&&!Array['isArray'](_0x12b55b)&&typeof _0x12b55b['id']==='string'&&Array['isArray'](_0x12b55b[_0x23f50a(0x14b)]);}function readCatalogExports(_0x25e634,_0x5833c2){const _0x156eee=_0x31d86c,_0x12e5d7=_0x25e634[_0x156eee(0x16d)]??_0x25e634['catalog']??_0x25e634[_0x156eee(0x160)],_0x1c9eb0=[];if(Array['isArray'](_0x12e5d7))for(const _0x41975b of _0x12e5d7){if(!isCatalogDescriptor(_0x41975b))throw new Error(_0x156eee(0x14a)+_0x5833c2+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');_0x1c9eb0['push'](_0x41975b);}else{if(_0x12e5d7!==void 0x0){if(!isCatalogDescriptor(_0x12e5d7))throw new Error('Catalog\x20module\x20\x22'+_0x5833c2+_0x156eee(0x15f));_0x1c9eb0[_0x156eee(0x134)](_0x12e5d7);}}if(_0x1c9eb0['length']===0x0)throw new Error(_0x156eee(0x14a)+_0x5833c2+'\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.');const _0x35c276=typeof _0x25e634['defaultCatalogId']==='string'&&_0x25e634[_0x156eee(0x16c)]['length']>0x0?_0x25e634[_0x156eee(0x16c)]:void 0x0;return{'catalogs':_0x1c9eb0,'defaultCatalogId':_0x35c276};}async function loadCatalogs(_0x46508c){const _0x11079c=_0x31d86c,_0x1870e6=[];let _0x372187;for(const _0x204cd1 of _0x46508c){const _0x4400e4=await import(pathToFileURL(resolve(_0x204cd1))['href']),_0x520a65=readCatalogExports(_0x4400e4,_0x204cd1);_0x1870e6[_0x11079c(0x134)](..._0x520a65[_0x11079c(0x16d)]),_0x372187??(_0x372187=_0x520a65[_0x11079c(0x16c)]);}return{'catalogs':_0x1870e6,'defaultCatalogId':_0x372187};}async function parseCliOptions(){const _0xe7b992=_0x31d86c,_0x777c43=parseArgs({'allowPositionals':![],'options':{'transport':{'type':_0xe7b992(0x15e)},'host':{'type':_0xe7b992(0x15e)},'port':{'type':_0xe7b992(0x15e)},'endpoint':{'type':_0xe7b992(0x15e)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':'string','multiple':!![]},'default-catalog-id':{'type':'string'},'catalog-instruction-mode':{'type':_0xe7b992(0x15e)},'name':{'type':_0xe7b992(0x15e)},'version':{'type':'string'},'help':{'type':'boolean','short':'h'}}});_0x777c43['values'][_0xe7b992(0x15d)]&&(process['stdout']['write'](helpText),process[_0xe7b992(0x166)](0x0));const _0x432da2=await loadCatalogs(stringArrayValue(_0x777c43[_0xe7b992(0x152)]['catalog'])),_0x2cefc2=optionalStringValue(_0x777c43['values'][_0xe7b992(0x15b)])??_0x432da2[_0xe7b992(0x16c)];return{'transport':parseTransport(stringValue(_0x777c43['values'][_0xe7b992(0x15a)],_0xe7b992(0x13c))),'host':stringValue(_0x777c43['values'][_0xe7b992(0x156)],'127.0.0.1'),'port':parsePort(stringValue(_0x777c43[_0xe7b992(0x152)]['port'],'3001')),'endpoint':normalizeEndpoint(stringValue(_0x777c43['values'][_0xe7b992(0x165)],_0xe7b992(0x169))),'corsOrigins':stringArrayValue(_0x777c43[_0xe7b992(0x152)]['cors-origin']),'catalogs':_0x432da2['catalogs'],..._0x2cefc2?{'defaultCatalogId':_0x2cefc2}:{},'catalogInstructionMode':parseCatalogInstructionMode(stringValue(_0x777c43[_0xe7b992(0x152)]['catalog-instruction-mode'],'compact')),...optionalStringValue(_0x777c43[_0xe7b992(0x152)]['name'])?{'serverName':optionalStringValue(_0x777c43[_0xe7b992(0x152)]['name'])}:{},...optionalStringValue(_0x777c43['values']['version'])?{'serverVersion':optionalStringValue(_0x777c43['values'][_0xe7b992(0x162)])}:{}};}function createServerOptions(_0x44dd95){const _0x5656db=_0x31d86c;return{'catalogs':_0x44dd95['catalogs'],..._0x44dd95['defaultCatalogId']?{'defaultCatalogId':_0x44dd95['defaultCatalogId']}:{},..._0x44dd95[_0x5656db(0x14c)]?{'catalogInstructionMode':_0x44dd95[_0x5656db(0x14c)]}:{},'server':{..._0x44dd95[_0x5656db(0x138)]?{'name':_0x44dd95[_0x5656db(0x138)]}:{},..._0x44dd95[_0x5656db(0x172)]?{'version':_0x44dd95[_0x5656db(0x172)]}:{}}};}function setCorsHeaders(_0x4c5bb7,_0x2975fe,_0x1d05a8){const _0x3cd35d=_0x31d86c;if(_0x1d05a8[_0x3cd35d(0x170)]===0x0)return;const _0x26de21=_0x4c5bb7[_0x3cd35d(0x13a)]['origin'],_0x367bd5=_0x1d05a8[_0x3cd35d(0x13b)]('*'),_0x10b1c0=_0x367bd5?'*':typeof _0x26de21==='string'&&_0x1d05a8['includes'](_0x26de21)?_0x26de21:void 0x0;if(!_0x10b1c0)return;_0x2975fe['setHeader']('Access-Control-Allow-Origin',_0x10b1c0),_0x2975fe[_0x3cd35d(0x141)]('Vary',_0x3cd35d(0x14f)),_0x2975fe[_0x3cd35d(0x141)]('Access-Control-Allow-Methods',_0x3cd35d(0x155)),_0x2975fe[_0x3cd35d(0x141)]('Access-Control-Allow-Headers','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID'),_0x2975fe[_0x3cd35d(0x141)](_0x3cd35d(0x13d),'Mcp-Session-Id');}function writeJsonRpcError(_0x497641,_0x33622d,_0x29168f){const _0x57da98=_0x31d86c;_0x497641[_0x57da98(0x158)]=_0x33622d,_0x497641['setHeader'](_0x57da98(0x143),'application/json'),_0x497641['end'](JSON[_0x57da98(0x16e)]({'jsonrpc':_0x57da98(0x140),'error':{'code':-0x7f5b,'message':_0x29168f},'id':null}));}async function startStdio(_0x39d58d){const _0x1897d0=createUIMCPServer(createServerOptions(_0x39d58d));await _0x1897d0['connect'](new StdioServerTransport());}async function startHttp(_0x157e7b){const _0x5bc298=_0x31d86c,_0x3619d6=createServer(async(_0x2132f2,_0xbaf134)=>{const _0x4217b9=_0x320f,_0x39b669=new URL(_0x2132f2[_0x4217b9(0x142)]??'/',_0x4217b9(0x151)+(_0x2132f2['headers'][_0x4217b9(0x156)]??'localhost'));if(_0x39b669[_0x4217b9(0x14e)]!==_0x157e7b[_0x4217b9(0x165)]){_0xbaf134[_0x4217b9(0x158)]=0x194,_0xbaf134['end']('Not\x20Found');return;}setCorsHeaders(_0x2132f2,_0xbaf134,_0x157e7b['corsOrigins']);if(_0x2132f2['method']==='OPTIONS'){_0xbaf134['statusCode']=0xcc,_0xbaf134[_0x4217b9(0x159)]();return;}const _0x59428d=createUIMCPServer(createServerOptions(_0x157e7b)),_0x2ea11c=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});try{await _0x59428d['connect'](_0x2ea11c),await _0x2ea11c[_0x4217b9(0x16b)](_0x2132f2,_0xbaf134),_0xbaf134['on']('close',()=>{void _0x2ea11c['close'](),void _0x59428d['close']();});}catch(_0x3c3463){console[_0x4217b9(0x13e)]('[@agentic-ui-experience/ui-mcp]\x20request\x20failed',_0x3c3463),!_0xbaf134[_0x4217b9(0x149)]&&writeJsonRpcError(_0xbaf134,0x1f4,_0x3c3463 instanceof Error?_0x3c3463['message']:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x10ffa5,_0x4d8f7e)=>{const _0x20c50c=_0x320f;_0x3619d6['once']('error',_0x4d8f7e),_0x3619d6['listen'](_0x157e7b[_0x20c50c(0x164)],_0x157e7b['host'],_0x10ffa5);});const _0x26c7e3=()=>{const _0x143f36=_0x320f;_0x3619d6['close'](()=>process[_0x143f36(0x166)](0x0));};process[_0x5bc298(0x135)](_0x5bc298(0x146),_0x26c7e3),process['once']('SIGTERM',_0x26c7e3),process[_0x5bc298(0x136)][_0x5bc298(0x154)](_0x5bc298(0x144)+_0x157e7b['host']+':'+_0x157e7b['port']+_0x157e7b[_0x5bc298(0x165)]+'\x0a');}async function main(){const _0x5aec4e=_0x31d86c,_0x201cf2=await parseCliOptions();if(_0x201cf2['transport']===_0x5aec4e(0x13c)){await startStdio(_0x201cf2);return;}await startHttp(_0x201cf2);}main()[_0x31d86c(0x15c)](_0xc36129=>{const _0x235124=_0x31d86c;process['stderr'][_0x235124(0x154)]((_0xc36129 instanceof Error?_0xc36129[_0x235124(0x14d)]:String(_0xc36129))+'\x0a'),process[_0x235124(0x166)](0x1);});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,18 @@
|
|
|
1
1
|
import { McpServer, ResourceTemplate, type RegisteredResource, type RegisteredResourceTemplate, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { CallToolResult, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
messages: unknown;
|
|
14
|
-
catalogId?: string | undefined;
|
|
15
|
-
surfaceId?: string | undefined;
|
|
16
|
-
}
|
|
17
|
-
export type UIMCPCatalogInstructionMode = "compact" | "full";
|
|
18
|
-
export interface UIMCPCatalogSummary {
|
|
19
|
-
id: string;
|
|
20
|
-
resourceUri: string;
|
|
21
|
-
isDefault: boolean;
|
|
22
|
-
baseCatalogId: string;
|
|
23
|
-
baseComponentNames: readonly string[];
|
|
24
|
-
customComponents: readonly string[];
|
|
25
|
-
}
|
|
26
|
-
export interface UIMCPCatalogDescription {
|
|
27
|
-
id: string;
|
|
28
|
-
resourceUri: string;
|
|
29
|
-
isDefault: boolean;
|
|
30
|
-
baseCatalogId: string;
|
|
31
|
-
instructionMode: UIMCPCatalogInstructionMode;
|
|
32
|
-
descriptor: CatalogPromptDescriptor;
|
|
33
|
-
instructions: string;
|
|
34
|
-
catalogPrompt: string;
|
|
35
|
-
basicCatalogSchema?: unknown;
|
|
36
|
-
}
|
|
37
|
-
export interface UIMCPListCatalogsResult extends Record<string, unknown> {
|
|
38
|
-
catalogs: UIMCPCatalogSummary[];
|
|
39
|
-
}
|
|
40
|
-
export interface UIMCPGetCatalogArguments {
|
|
41
|
-
catalogId?: string | undefined;
|
|
42
|
-
componentNames?: string[] | undefined;
|
|
43
|
-
instructionMode?: UIMCPCatalogInstructionMode | undefined;
|
|
44
|
-
}
|
|
45
|
-
export interface UIMCPGetCatalogResult extends Record<string, unknown> {
|
|
46
|
-
catalog: UIMCPCatalogDescription;
|
|
47
|
-
}
|
|
3
|
+
import type { CatalogPromptDescriptor } from "@agentic-ui-experience/ui-core";
|
|
4
|
+
import { type UIGetCatalogArguments, type UIGetCatalogResult, type UIListCatalogsResult, type UISendToolArguments, type UISendToolResult, type UIToolCatalogInstructionMode, type UIToolCatalogRegistry } from "@agentic-ui-experience/ui-core/tool-mode";
|
|
5
|
+
export type UIMCPToolResult = UISendToolResult & Record<string, unknown>;
|
|
6
|
+
export type UIMCPToolArguments = UISendToolArguments;
|
|
7
|
+
export type UIMCPCatalogInstructionMode = UIToolCatalogInstructionMode;
|
|
8
|
+
export type UIMCPCatalogSummary = UIListCatalogsResult["catalogs"][number];
|
|
9
|
+
export type UIMCPCatalogDescription = UIGetCatalogResult["catalog"];
|
|
10
|
+
export type UIMCPListCatalogsResult = UIListCatalogsResult & Record<string, unknown>;
|
|
11
|
+
export type UIMCPGetCatalogArguments = UIGetCatalogArguments;
|
|
12
|
+
export type UIMCPGetCatalogResult = UIGetCatalogResult & Record<string, unknown>;
|
|
48
13
|
export type UIMCPNormalize = (args: UIMCPToolArguments) => UIMCPToolResult | Promise<UIMCPToolResult>;
|
|
49
14
|
export type UIMCPSyncNormalize = (args: UIMCPToolArguments) => UIMCPToolResult;
|
|
15
|
+
export type UIMCPCatalogRegistry = UIToolCatalogRegistry;
|
|
50
16
|
export interface UIMCPNormalizeMessagesOptions {
|
|
51
17
|
mode?: "strict" | "repair";
|
|
52
18
|
surfaceId?: string;
|
|
@@ -65,12 +31,6 @@ export interface CreateUIMCPServerOptions {
|
|
|
65
31
|
version?: string;
|
|
66
32
|
};
|
|
67
33
|
}
|
|
68
|
-
export interface UIMCPCatalogRegistry {
|
|
69
|
-
defaultCatalogId: string;
|
|
70
|
-
catalogInstructionMode: UIMCPCatalogInstructionMode;
|
|
71
|
-
catalogs: Map<string, CatalogPromptDescriptor>;
|
|
72
|
-
}
|
|
73
|
-
export declare function createCatalogRegistry(catalogs?: readonly CatalogPromptDescriptor[], defaultCatalogId?: string, catalogInstructionMode?: UIMCPCatalogInstructionMode): UIMCPCatalogRegistry;
|
|
74
34
|
export declare function createUIMCPNormalize(options?: UIMCPNormalizeMessagesOptions): UIMCPSyncNormalize;
|
|
75
35
|
/**
|
|
76
36
|
* Execute a UI MCP call. This is intentionally pure: it parses and returns the
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4504e0=_0x10d9;(function(_0x156f00,_0x3e1e2d){const _0x438e6d=_0x10d9,_0x2bf530=_0x156f00();while(!![]){try{const _0x4db080=parseInt(_0x438e6d(0x64))/0x1*(parseInt(_0x438e6d(0x75))/0x2)+-parseInt(_0x438e6d(0x9f))/0x3+parseInt(_0x438e6d(0x91))/0x4+-parseInt(_0x438e6d(0xaf))/0x5+parseInt(_0x438e6d(0x90))/0x6+-parseInt(_0x438e6d(0xa1))/0x7*(parseInt(_0x438e6d(0x68))/0x8)+parseInt(_0x438e6d(0xa9))/0x9;if(_0x4db080===_0x3e1e2d)break;else _0x2bf530['push'](_0x2bf530['shift']());}catch(_0x21e769){_0x2bf530['push'](_0x2bf530['shift']());}}}(_0x54b4,0x4a6df));import{McpServer,ResourceTemplate}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0x145b82,ResourceTemplate as _0x27b866}from'@modelcontextprotocol/sdk/server/mcp.js';function _0x10d9(_0x1f1489,_0x4ee8bb){_0x1f1489=_0x1f1489-0x64;const _0x54b441=_0x54b4();let _0x10d9f8=_0x54b441[_0x1f1489];return _0x10d9f8;}import{z}from'zod/v4';import{A2UI_BASIC_COMPONENTS,normalizeUIResponse,A2UI_BASIC_CATALOG_ID,parseSpecA2UIMessages,A2UI_PROTOCOL_VERSION,describeCatalogForPrompt,pickBasicCatalogSchemaComponents,buildUIInstructions}from'@agentic-ui-experience/ui-core';import{UI_TOOL_NAME}from'@agentic-ui-experience/ui-core/tool-mode';const LIST_UI_CATALOGS_TOOL_NAME='list_ui_catalogs',GET_UI_CATALOG_TOOL_NAME='get_ui_catalog',BASIC_CATALOG_RESOURCE_URI=_0x4504e0(0x88),CATALOG_RESOURCE_URI_TEMPLATE=_0x4504e0(0x7f),basicCatalogDescriptor={'id':A2UI_BASIC_CATALOG_ID,'baseComponentNames':A2UI_BASIC_COMPONENTS},A2UI_MCP_TOOL_WORKFLOW=['A2UI\x20MCP\x20tool\x20workflow:',_0x4504e0(0x74)+LIST_UI_CATALOGS_TOOL_NAME+_0x4504e0(0x6c),'2.\x20Call\x20'+GET_UI_CATALOG_TOOL_NAME+'\x20with\x20the\x20selected\x20catalogId\x20and\x20only\x20the\x20componentNames\x20needed\x20for\x20the\x20UI.\x20Use\x20instructionMode\x20\x22full\x22\x20when\x20exact\x20component\x20fields\x20are\x20needed.',_0x4504e0(0xb2)+UI_TOOL_NAME+'\x20last\x20with\x20A2UI\x20messages\x20built\x20from\x20the\x20catalog\x20returned\x20by\x20'+GET_UI_CATALOG_TOOL_NAME+_0x4504e0(0x9a)]['join']('\x0a'),sendUIOutputSchema={'uiJson':z['string'](),'uiMessages':z['array'](z['unknown']())},listCatalogsOutputSchema={'catalogs':z[_0x4504e0(0x73)](z[_0x4504e0(0x82)]({'id':z['string'](),'resourceUri':z[_0x4504e0(0xba)](),'isDefault':z[_0x4504e0(0x94)](),'baseCatalogId':z[_0x4504e0(0xba)](),'baseComponentNames':z['array'](z['string']()),'customComponents':z['array'](z[_0x4504e0(0xba)]())}))},getCatalogOutputSchema={'catalog':z['object']({'id':z[_0x4504e0(0xba)](),'resourceUri':z['string'](),'isDefault':z['boolean'](),'baseCatalogId':z[_0x4504e0(0xba)](),'instructionMode':z['enum']([_0x4504e0(0x95),_0x4504e0(0xb4)]),'descriptor':z['unknown'](),'instructions':z[_0x4504e0(0xba)](),'catalogPrompt':z['string'](),'basicCatalogSchema':z[_0x4504e0(0x84)]()[_0x4504e0(0x6d)]()})},basicComponentNames=new Set(A2UI_BASIC_COMPONENTS),componentSchema=z[_0x4504e0(0x69)](z[_0x4504e0(0xba)](),z['unknown']()),createSurfaceMessageSchema=z[_0x4504e0(0x82)]({'version':z[_0x4504e0(0xa8)]('v0.9'),'createSurface':z[_0x4504e0(0x82)]({'surfaceId':z['string'](),'catalogId':z['string']()})}),updateComponentsMessageSchema=z['object']({'version':z['literal']('v0.9'),'updateComponents':z['object']({'surfaceId':z['string'](),'components':z['array'](componentSchema)})}),updateDataModelMessageSchema=z['object']({'version':z['literal']('v0.9'),'updateDataModel':z['object']({'surfaceId':z[_0x4504e0(0xba)](),'path':z[_0x4504e0(0xba)](),'value':z[_0x4504e0(0x84)]()[_0x4504e0(0x6d)]()})}),deleteSurfaceMessageSchema=z[_0x4504e0(0x82)]({'version':z['literal'](_0x4504e0(0x76)),'deleteSurface':z['object']({'surfaceId':z['string']()})});function createSendUIInputSchema(){const _0x4278e9=_0x4504e0;return{'catalogId':z[_0x4278e9(0xba)]()[_0x4278e9(0x6d)]()[_0x4278e9(0xa4)]('Optional\x20expected\x20catalog\x20id\x20for\x20this\x20UI\x20call.\x20This\x20is\x20a\x20validator\x20only:\x20still\x20include\x20the\x20same\x20value\x20in\x20`messages[0].createSurface.catalogId`.\x20Defaults\x20to\x20the\x20MCP\x20server\x20default\x20catalog\x20id,\x20then\x20the\x20A2UI\x20basic\x20catalog\x20id.'),'surfaceId':z['string']()[_0x4278e9(0x6d)]()['describe'](_0x4278e9(0x72)),'messages':z[_0x4278e9(0x73)](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))[_0x4278e9(0xa4)]([_0x4278e9(0xa5),_0x4278e9(0x6e)+LIST_UI_CATALOGS_TOOL_NAME+_0x4278e9(0xbb)+GET_UI_CATALOG_TOOL_NAME+'.','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20'+GET_UI_CATALOG_TOOL_NAME+';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.',_0x4278e9(0xa7),'Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.',_0x4278e9(0x81),_0x4278e9(0x71),_0x4278e9(0xb8)]['join']('\x20'))};}function createGetCatalogInputSchema(){const _0xe2fa33=_0x4504e0;return{'catalogId':z['string']()['optional']()['describe'](_0xe2fa33(0x65)),'componentNames':z['array'](z[_0xe2fa33(0xba)]())['min'](0x1)['optional']()[_0xe2fa33(0xa4)](_0xe2fa33(0x77)),'instructionMode':z[_0xe2fa33(0x86)]([_0xe2fa33(0x95),_0xe2fa33(0xb4)])[_0xe2fa33(0x6d)]()[_0xe2fa33(0xa4)]('Optional\x20instruction\x20detail\x20level\x20for\x20the\x20returned\x20catalog\x20instructions.\x20Defaults\x20to\x20the\x20MCP\x20server\x20catalogInstructionMode.\x20Use\x20compact\x20for\x20a\x20concise\x20field\x20cheat\x20sheet;\x20use\x20full\x20when\x20the\x20model\x20needs\x20the\x20authoritative\x20JSON\x20schema\x20in\x20the\x20instructions.')};}function createCatalogRegistry(_0x392c2d=[],_0x284c2d,_0x1896ef=_0x4504e0(0x95)){const _0x3fd66b=_0x4504e0,_0x4b9546=new Map();_0x4b9546[_0x3fd66b(0x70)](A2UI_BASIC_CATALOG_ID,basicCatalogDescriptor);for(const _0x5f16a4 of _0x392c2d){_0x4b9546['set'](_0x5f16a4['id'],_0x5f16a4);}const _0xce48fc=_0x284c2d??A2UI_BASIC_CATALOG_ID;if(!_0x4b9546['has'](_0xce48fc))throw new Error(_0x3fd66b(0xaa)+_0xce48fc+_0x3fd66b(0xb1));return{'defaultCatalogId':_0xce48fc,'catalogInstructionMode':_0x1896ef,'catalogs':_0x4b9546};}function getCatalogOrThrow(_0x2cf1b8,_0x1a2b6b){const _0x238146=_0x4504e0,_0x48d8c4=_0x2cf1b8['catalogs']['get'](_0x1a2b6b);if(!_0x48d8c4)throw new Error(_0x238146(0x8f)+_0x1a2b6b+_0x238146(0xb5));return _0x48d8c4;}function resolveExpectedCatalogId(_0x419af8,_0x923d86){return _0x923d86??_0x419af8['defaultCatalogId'];}function catalogResourceUri(_0x577778){const _0x6b105d=_0x4504e0;if(_0x577778===A2UI_BASIC_CATALOG_ID)return BASIC_CATALOG_RESOURCE_URI;return _0x6b105d(0x7e)+encodeURIComponent(_0x577778);}function catalogIdFromResourceVariable(_0x2f4068){const _0x51afd7=_0x4504e0;return _0x2f4068===_0x51afd7(0xc2)?A2UI_BASIC_CATALOG_ID:decodeURIComponent(_0x2f4068);}function createCatalogInstructions(_0x3f95af,_0x4809d3,_0x54a990='compact'){const _0x392ce4=_0x3f95af['id']!==A2UI_BASIC_CATALOG_ID||_0x4809d3!==void 0x0;return buildUIInstructions({'mode':_0x54a990,'envelope':![],..._0x392ce4?{'customCatalog':_0x3f95af}:{},..._0x4809d3===void 0x0?{}:{'basicComponentNames':_0x4809d3}});}function uniqueComponentNames(_0x5c68b6){return[...new Set(_0x5c68b6)];}function filterCatalogForComponents(_0x2f41af,_0x33db46){const _0x32ad8c=_0x4504e0,_0x170651=uniqueComponentNames(_0x33db46),_0x1d5c0e=new Set(_0x2f41af[_0x32ad8c(0xb9)]),_0xbdf4ce=_0x2f41af['customComponents']??[],_0x50a70d=new Map(_0xbdf4ce['map'](_0xe0108a=>[_0xe0108a[_0x32ad8c(0x87)],_0xe0108a])),_0x36d899=[],_0x1e3d80=[];for(const _0x2b4b29 of _0x170651){if(_0x1d5c0e['has'](_0x2b4b29)){_0x36d899[_0x32ad8c(0x6f)](_0x2b4b29);continue;}const _0x5ef5ab=_0x50a70d[_0x32ad8c(0x99)](_0x2b4b29);if(_0x5ef5ab){_0x1e3d80['push'](_0x5ef5ab);continue;}throw new Error(_0x32ad8c(0x92)+_0x2b4b29+'\x22\x20for\x20catalog\x20\x22'+_0x2f41af['id']+'\x22.\x20Use\x20list_ui_catalogs\x20to\x20inspect\x20available\x20components.');}const _0x4f4e26={..._0x2f41af,'baseComponentNames':_0x36d899,'customComponents':_0x1e3d80};return{'descriptor':_0x4f4e26,'basicComponentNames':_0x36d899,'basicCatalogSchema':pickBasicCatalogSchemaComponents(_0x36d899)};}function createCatalogDescription(_0x3390d5,_0x4344f4,_0x1ca573,_0x5cd0c8){const _0x48189c=_0x4504e0,_0x30bcb6=_0x1ca573===void 0x0?void 0x0:filterCatalogForComponents(_0x4344f4,_0x1ca573),_0x467f68=_0x30bcb6?.[_0x48189c(0xc1)]??_0x4344f4,_0x4213e6=_0x30bcb6?.['basicComponentNames'],_0x38b08b=_0x5cd0c8??_0x3390d5[_0x48189c(0x6b)];return{'id':_0x467f68['id'],'resourceUri':catalogResourceUri(_0x467f68['id']),'isDefault':_0x467f68['id']===_0x3390d5['defaultCatalogId'],'baseCatalogId':A2UI_BASIC_CATALOG_ID,'instructionMode':_0x38b08b,'descriptor':_0x467f68,'instructions':createCatalogInstructions(_0x467f68,_0x4213e6,_0x38b08b),'catalogPrompt':describeCatalogForPrompt(_0x467f68,{'format':_0x48189c(0x80)}),..._0x30bcb6===void 0x0?{}:{'basicCatalogSchema':_0x30bcb6['basicCatalogSchema']}};}function createCatalogSummary(_0x4c794a,_0xd9e922){const _0x12355d=_0x4504e0;return{'id':_0xd9e922['id'],'resourceUri':catalogResourceUri(_0xd9e922['id']),'isDefault':_0xd9e922['id']===_0x4c794a[_0x12355d(0x67)],'baseCatalogId':A2UI_BASIC_CATALOG_ID,'baseComponentNames':_0xd9e922[_0x12355d(0xb9)],'customComponents':(_0xd9e922['customComponents']??[])[_0x12355d(0x9e)](_0x2fbd37=>_0x2fbd37[_0x12355d(0x87)])};}function listCatalogs(_0x1dd843){const _0x34c8fd=_0x4504e0;return{'catalogs':[..._0x1dd843[_0x34c8fd(0x83)]['values']()]['map'](_0x30de69=>createCatalogSummary(_0x1dd843,_0x30de69))};}function getCatalogDescription(_0x4641aa,_0x3c36e2,_0x178388,_0x3c104f){const _0x4164a1=resolveExpectedCatalogId(_0x4641aa,_0x3c36e2);return{'catalog':createCatalogDescription(_0x4641aa,getCatalogOrThrow(_0x4641aa,_0x4164a1),_0x178388,_0x3c104f)};}function createGenericToolDescription(_0x24fe4d){const _0x444055=_0x4504e0,_0x415739=listCatalogs(_0x24fe4d)['catalogs'];return['Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.',A2UI_MCP_TOOL_WORKFLOW,_0x444055(0x9b),_0x444055(0xa2)+_0x24fe4d[_0x444055(0x67)]+'.','Registered\x20catalogs:\x20'+_0x415739['map'](_0x32a9c9=>_0x32a9c9['id'])['join'](',\x20')+'.','Message\x20list\x20rules:',_0x444055(0xbd)+A2UI_PROTOCOL_VERSION+'\x22.','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.','-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.','-\x20createSurface.catalogId\x20must\x20be\x20present\x20and\x20must\x20match\x20the\x20top-level\x20catalogId\x20when\x20supplied;\x20otherwise\x20it\x20must\x20match\x20the\x20MCP\x20server\x20default\x20catalog\x20id.','-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.','-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.',_0x444055(0x9c),_0x444055(0xac)]['join']('\x0a\x0a');}function createCatalogAwareComponentValidator(_0x19ec2f){const _0x7850d5=_0x4504e0,_0x40bf6f=new Set((_0x19ec2f[_0x7850d5(0xae)]??[])[_0x7850d5(0x9e)](_0x15cf5a=>_0x15cf5a['name']));return(_0x459f08,_0xf57cdb)=>{const _0x270d78=_0x7850d5;if(!basicComponentNames[_0x270d78(0x66)](_0x459f08)){if(_0x40bf6f[_0x270d78(0x66)](_0x459f08))return[];return['Unknown\x20A2UI\x20component\x20\x22'+_0x459f08+_0x270d78(0x98)+_0x19ec2f['id']+_0x270d78(0x8a)];}try{return parseSpecA2UIMessages([{'version':A2UI_PROTOCOL_VERSION,'createSurface':{'surfaceId':_0x270d78(0x93),'catalogId':A2UI_BASIC_CATALOG_ID}},{'version':A2UI_PROTOCOL_VERSION,'updateComponents':{'surfaceId':'basic-validation','components':[_0xf57cdb]}}]),[];}catch(_0x249efd){return[_0x249efd instanceof Error?_0x249efd['message']:String(_0x249efd)];}};}function createUIMCPNormalize(_0x390dc0={}){const _0x35bfb8=_0x4504e0,_0x46c62e=_0x390dc0[_0x35bfb8(0xa3)]??'strict',_0x57230f=createCatalogRegistry(_0x390dc0['catalogs'],_0x390dc0[_0x35bfb8(0x67)]);return _0x5ce415=>{const _0x58c38b=_0x35bfb8,_0x4d85e3=resolveExpectedCatalogId(_0x57230f,_0x5ce415[_0x58c38b(0x85)]),_0x3fd2fa=getCatalogOrThrow(_0x57230f,_0x4d85e3),_0xcc286d=normalizeUIResponse(_0x5ce415[_0x58c38b(0x8e)],{'mode':_0x46c62e,'validateComponent':createCatalogAwareComponentValidator(_0x3fd2fa)})['uiMessages'],_0x53a417=_0xcc286d[0x0],_0x5595a5=_0x5ce415['surfaceId']??_0x390dc0[_0x58c38b(0x7c)];if(!_0x53a417||!(_0x58c38b(0x9d)in _0x53a417))throw new Error(_0x58c38b(0xab));if(_0x5595a5!==void 0x0&&_0x53a417[_0x58c38b(0x9d)]['surfaceId']!==_0x5595a5)throw new Error(_0x58c38b(0x78)+_0x5595a5+'\x27.');if(_0x53a417['createSurface'][_0x58c38b(0x85)]!==_0x4d85e3)throw new Error('messages\x20createSurface.catalogId\x20must\x20be\x20\x27'+_0x4d85e3+'\x27.');return{'uiJson':JSON['stringify'](_0xcc286d),'uiMessages':_0xcc286d};};}const defaultNormalize=createUIMCPNormalize();function toToolError(_0x22b045){const _0x5b8253=_0x4504e0;return{'isError':!![],'content':[{'type':_0x5b8253(0x89),'text':_0x22b045}]};}function toToolResult(_0x22758c){const _0x14764b=_0x4504e0;return{'content':[{'type':'text','text':'Accepted\x20'+_0x22758c[_0x14764b(0xa6)]['length']+_0x14764b(0xbc)}],'structuredContent':_0x22758c};}function toCatalogToolResult(_0x3e2ef6){return{'content':[{'type':'text','text':JSON['stringify'](_0x3e2ef6)}],'structuredContent':_0x3e2ef6};}async function createUIToolCallResult(_0x1055a8,_0x28ea1a=defaultNormalize){try{return toToolResult(await _0x28ea1a(_0x1055a8));}catch(_0x1e4256){const _0x1b4a90=_0x1e4256 instanceof Error?_0x1e4256['message']:String(_0x1e4256);return toToolError(_0x1b4a90);}}function createCatalogResourceResult(_0x35ff1f,_0x51032e,_0x24c95b){const _0x3edbd3=_0x4504e0,_0x28e6af=getCatalogDescription(_0x35ff1f,_0x51032e);return{'contents':[{'uri':_0x24c95b,'mimeType':'application/json','text':JSON[_0x3edbd3(0xa0)](_0x28e6af['catalog'])}]};}function registerUICatalogResources(_0x2bc1f1,_0x5a656d){const _0x1df86a=_0x4504e0,_0x215336=_0x2bc1f1['registerResource']('a2ui-basic-catalog',BASIC_CATALOG_RESOURCE_URI,{'title':_0x1df86a(0xc0),'description':'Built-in\x20A2UI\x20basic\x20catalog\x20instructions\x20and\x20component\x20schema.','mimeType':_0x1df86a(0xad)},_0x4ebbec=>createCatalogResourceResult(_0x5a656d,A2UI_BASIC_CATALOG_ID,_0x4ebbec['href'])),_0x4373e8=[..._0x5a656d[_0x1df86a(0x83)]['values']()][_0x1df86a(0x8b)](_0xcccf7f=>_0xcccf7f['id']!==A2UI_BASIC_CATALOG_ID)[_0x1df86a(0x9e)](_0x155da1=>_0x2bc1f1[_0x1df86a(0x96)]('a2ui-catalog-'+_0x155da1['id'],catalogResourceUri(_0x155da1['id']),{'title':_0x1df86a(0xb3)+_0x155da1['id'],'description':'Registered\x20A2UI\x20catalog\x20instructions\x20and\x20custom\x20component\x20schema.','mimeType':_0x1df86a(0xad)},_0x488935=>createCatalogResourceResult(_0x5a656d,_0x155da1['id'],_0x488935['href']))),_0x297c08=_0x2bc1f1[_0x1df86a(0x96)]('a2ui-catalog',new ResourceTemplate(CATALOG_RESOURCE_URI_TEMPLATE,{'list':()=>({'resources':[..._0x5a656d[_0x1df86a(0x83)][_0x1df86a(0x7a)]()][_0x1df86a(0x9e)](_0x4900e9=>({'uri':catalogResourceUri(_0x4900e9['id']),'name':_0x4900e9['id'],'title':_0x4900e9['id'],'mimeType':'application/json'}))}),'complete':{'catalogId':_0x49d8ee=>{const _0x10d9dc=_0x1df86a,_0x195023=_0x49d8ee[_0x10d9dc(0x79)]();return[..._0x5a656d['catalogs']['keys']()]['map'](_0x1383ae=>_0x1383ae===A2UI_BASIC_CATALOG_ID?'basic':encodeURIComponent(_0x1383ae))['filter'](_0x50cf6a=>_0x50cf6a['toLowerCase']()[_0x10d9dc(0x7b)](_0x195023));}}}),{'title':_0x1df86a(0x97),'description':_0x1df86a(0xbe),'mimeType':_0x1df86a(0xad)},(_0x413cb5,_0x351492)=>createCatalogResourceResult(_0x5a656d,catalogIdFromResourceVariable(String(_0x351492[_0x1df86a(0x85)])),_0x413cb5[_0x1df86a(0x7d)]));return{'basic':_0x215336,'catalogs':_0x4373e8,'template':_0x297c08};}function registerUICatalogTools(_0x340cf1,_0x145007){const _0x5cd0e1=_0x4504e0,_0x384497=_0x340cf1['registerTool'](LIST_UI_CATALOGS_TOOL_NAME,{'title':'List\x20A2UI\x20Catalogs','description':['Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20get_ui_catalog\x20or\x20send_ui_to_client.',A2UI_MCP_TOOL_WORKFLOW,'Returns\x20registered\x20catalog\x20ids,\x20the\x20default\x20catalog,\x20base\x20component\x20names,\x20and\x20custom\x20component\x20names.\x20Use\x20the\x20returned\x20component\x20names\x20to\x20choose\x20the\x20componentNames\x20for\x20get_ui_catalog.'][_0x5cd0e1(0x8d)]('\x0a\x0a'),'outputSchema':listCatalogsOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async()=>toCatalogToolResult(listCatalogs(_0x145007))),_0x3a97eb=_0x340cf1['registerTool'](GET_UI_CATALOG_TOOL_NAME,{'title':'Get\x20A2UI\x20Catalog','description':['Step\x202\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20after\x20list_ui_catalogs\x20and\x20before\x20send_ui_to_client.',A2UI_MCP_TOOL_WORKFLOW,'Returns\x20LLM-facing\x20A2UI\x20message\x20rules,\x20basic\x20catalog\x20schema,\x20custom\x20component\x20schemas,\x20style\x20guide,\x20and\x20examples\x20for\x20a\x20registered\x20catalog.','Pass\x20only\x20the\x20componentNames\x20needed\x20for\x20the\x20current\x20UI\x20response.\x20Omit\x20componentNames\x20only\x20when\x20the\x20complete\x20catalog\x20is\x20needed.','Use\x20instructionMode\x20\x22full\x22\x20for\x20forms,\x20unfamiliar\x20components,\x20validation\x20failures,\x20or\x20when\x20exact\x20required\x20fields\x20are\x20needed.']['join']('\x0a\x0a'),'inputSchema':createGetCatalogInputSchema(),'outputSchema':getCatalogOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async _0x44e254=>{const _0x2e6785=_0x5cd0e1;try{return toCatalogToolResult(getCatalogDescription(_0x145007,_0x44e254[_0x2e6785(0x85)],_0x44e254[_0x2e6785(0xb0)],_0x44e254[_0x2e6785(0xb6)]));}catch(_0x216b96){const _0x5d263b=_0x216b96 instanceof Error?_0x216b96['message']:String(_0x216b96);return toToolError(_0x5d263b);}});return{'list':_0x384497,'get':_0x3a97eb};}function registerGenericUITool(_0x2746f6,_0x4f50cc,_0x50629d={}){const _0x77813b=_0x4504e0;return _0x2746f6['registerTool'](UI_TOOL_NAME,{'title':_0x50629d['title'],'description':createGenericToolDescription(_0x4f50cc),'inputSchema':createSendUIInputSchema(),'outputSchema':sendUIOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0x50629d[_0x77813b(0xb7)]}},async _0x55116b=>createUIToolCallResult(_0x55116b,_0x50629d['normalize']));}function _0x54b4(){const _0x59b47a=['describe','The\x20complete\x20A2UI\x20v0.9-compatible\x20UI\x20message\x20array.','uiMessages','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','literal','5716944ZUGxEJ','Default\x20A2UI\x20catalog\x20\x22','messages\x20must\x20begin\x20with\x20a\x20createSurface\x20A2UI\x20message.','Top-level\x20`catalogId`\x20is\x20only\x20an\x20expected-value\x20guard;\x20it\x20does\x20not\x20populate\x20the\x20A2UI\x20message.\x20The\x20first\x20message\x20must\x20repeat\x20the\x20catalog\x20id\x20at\x20`messages[0].createSurface.catalogId`.','application/json','customComponents','2891510LUgriM','componentNames','\x22\x20is\x20not\x20registered.','3.\x20Call\x20','A2UI\x20Catalog\x20','full','\x22\x20is\x20not\x20registered\x20on\x20this\x20MCP\x20server.','instructionMode','annotations','Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.','baseComponentNames','string','\x20and\x20','\x20A2UI\x20UI\x20message(s).','-\x20Every\x20message\x20must\x20include\x20\x22version\x22:\x20\x22','Registered\x20A2UI\x20catalog\x20instructions\x20and\x20custom\x20component\x20schema.','server','A2UI\x20Basic\x20Catalog','descriptor','basic','389orRUIN','Optional\x20catalog\x20id.\x20Defaults\x20to\x20the\x20MCP\x20server\x20default\x20catalog\x20id,\x20then\x20the\x20A2UI\x20basic\x20catalog\x20id.','has','defaultCatalogId','6184LzXPHe','record','@agentic-ui-experience/ui-mcp','catalogInstructionMode','\x20first\x20to\x20discover\x20the\x20default\x20catalog\x20id\x20and\x20available\x20component\x20names.','optional','Use\x20this\x20only\x20as\x20workflow\x20step\x203,\x20after\x20inspecting\x20catalog\x20metadata\x20with\x20','push','set','If\x20the\x20tool\x20call\x20includes\x20top-level\x20`catalogId`,\x20`messages[0].createSurface.catalogId`\x20must\x20repeat\x20the\x20same\x20value.','Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.','array','1.\x20Call\x20','930KhYOKX','v0.9','Optional\x20component\x20names\x20to\x20fetch.\x20Use\x20list_ui_catalogs\x20first,\x20then\x20pass\x20only\x20the\x20basic\x20or\x20custom\x20components\x20needed\x20for\x20this\x20UI\x20response.\x20Omit\x20to\x20fetch\x20the\x20complete\x20catalog.','messages\x20createSurface.surfaceId\x20must\x20be\x20\x27','toLowerCase','values','startsWith','surfaceId','href','a2ui://catalog/','a2ui://catalog/{catalogId}','minified','The\x20first\x20entry\x20must\x20be\x20`createSurface`\x20with\x20both\x20`surfaceId`\x20and\x20`catalogId`\x20inside\x20`createSurface`.','object','catalogs','unknown','catalogId','enum','name','a2ui://catalog/basic','text','\x22.\x20Register\x20it\x20in\x20the\x20MCP\x20server\x20catalog\x20descriptor.','filter','normalize','join','messages','A2UI\x20catalog\x20\x22','1748742UcEHKb','1531948XyOiEJ','Unknown\x20A2UI\x20component\x20\x22','basic-validation','boolean','compact','registerResource','A2UI\x20Catalog','\x22\x20for\x20catalog\x20\x22','get','.\x20Do\x20not\x20guess\x20component\x20schemas.','Do\x20not\x20call\x20this\x20tool\x20before\x20using\x20the\x20catalog\x20discovery\x20tools\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','createSurface','map','1321236pZJqnN','stringify','1512dUnqXx','Default\x20catalog\x20id:\x20','mode'];_0x54b4=function(){return _0x59b47a;};return _0x54b4();}function createUIMCPServer(_0x593c9a={}){const _0x1c8319=_0x4504e0,_0x31b43f=createCatalogRegistry(_0x593c9a[_0x1c8319(0x83)],_0x593c9a['defaultCatalogId'],_0x593c9a['catalogInstructionMode']),_0x2ac376=_0x593c9a[_0x1c8319(0x8c)]??createUIMCPNormalize({'catalogs':_0x593c9a[_0x1c8319(0x83)],'defaultCatalogId':_0x593c9a[_0x1c8319(0x67)]}),_0x40c0e0=new McpServer({'name':_0x593c9a[_0x1c8319(0xbf)]?.[_0x1c8319(0x87)]??_0x1c8319(0x6a),'version':_0x593c9a[_0x1c8319(0xbf)]?.['version']??'0.0.0'});return registerUICatalogResources(_0x40c0e0,_0x31b43f),registerUICatalogTools(_0x40c0e0,_0x31b43f),registerGenericUITool(_0x40c0e0,_0x31b43f,{..._0x593c9a,'normalize':_0x2ac376}),_0x40c0e0;}export{BASIC_CATALOG_RESOURCE_URI,CATALOG_RESOURCE_URI_TEMPLATE,GET_UI_CATALOG_TOOL_NAME,LIST_UI_CATALOGS_TOOL_NAME,_0x145b82 as McpServer,_0x27b866 as ResourceTemplate,createCatalogRegistry,createUIMCPNormalize,createUIMCPServer,createUIToolCallResult,registerGenericUITool,registerUICatalogResources,registerUICatalogTools};
|
|
1
|
+
const _0x64b4a7=_0x359f;(function(_0x515baf,_0x17d11a){const _0x4b5eff=_0x359f,_0x30fe34=_0x515baf();while(!![]){try{const _0x43fc51=-parseInt(_0x4b5eff(0xb4))/0x1*(-parseInt(_0x4b5eff(0xc3))/0x2)+-parseInt(_0x4b5eff(0x8e))/0x3+parseInt(_0x4b5eff(0x99))/0x4+parseInt(_0x4b5eff(0x89))/0x5*(-parseInt(_0x4b5eff(0xad))/0x6)+-parseInt(_0x4b5eff(0x8c))/0x7*(-parseInt(_0x4b5eff(0xbb))/0x8)+-parseInt(_0x4b5eff(0xc0))/0x9+parseInt(_0x4b5eff(0xac))/0xa;if(_0x43fc51===_0x17d11a)break;else _0x30fe34['push'](_0x30fe34['shift']());}catch(_0x52ef64){_0x30fe34['push'](_0x30fe34['shift']());}}}(_0x2619,0x4c92a));function _0x2619(){const _0x65927b=['filter','-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.','componentNames','a2ui-catalog-','The\x20complete\x20A2UI\x20v0.9-compatible\x20UI\x20message\x20array.','If\x20the\x20tool\x20call\x20includes\x20top-level\x20`catalogId`,\x20`messages[0].createSurface.catalogId`\x20must\x20repeat\x20the\x20same\x20value.','literal','normalize','mode','Top-level\x20`catalogId`\x20is\x20only\x20an\x20expected-value\x20guard;\x20it\x20does\x20not\x20populate\x20the\x20A2UI\x20message.\x20The\x20first\x20message\x20must\x20repeat\x20the\x20catalog\x20id\x20at\x20`messages[0].createSurface.catalogId`.','boolean','object','a2ui-catalog','passthrough','optional','full','Optional\x20expected\x20catalog\x20id\x20for\x20this\x20UI\x20call.\x20This\x20is\x20a\x20validator\x20only:\x20still\x20include\x20the\x20same\x20value\x20in\x20`messages[0].createSurface.catalogId`.\x20Defaults\x20to\x20the\x20MCP\x20server\x20default\x20catalog\x20id,\x20then\x20the\x20A2UI\x20basic\x20catalog\x20id.','Do\x20not\x20call\x20this\x20tool\x20before\x20using\x20the\x20catalog\x20discovery\x20tools\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','10185120rANjah','24qWLGqh','\x20A2UI\x20UI\x20message(s).','unknown','registerResource','Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20get_ui_catalog\x20or\x20send_ui_to_client.','join','registerTool','2161wtASva','array','-\x20createSurface.catalogId\x20must\x20be\x20present\x20and\x20must\x20match\x20the\x20top-level\x20catalogId\x20when\x20supplied;\x20otherwise\x20it\x20must\x20match\x20the\x20registered\x20default\x20catalog\x20id.','List\x20A2UI\x20Catalogs','Optional\x20component\x20names\x20to\x20fetch.\x20Use\x20list_ui_catalogs\x20first,\x20then\x20pass\x20only\x20the\x20basic\x20or\x20custom\x20components\x20needed\x20for\x20this\x20UI\x20response.\x20Omit\x20to\x20fetch\x20the\x20complete\x20catalog.','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','A2UI\x20Catalog\x20','16aZxwyS','catalogId','describe','Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.','-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.','4474341ErTNYk','map','catalogs','128WAHteq','Registered\x20A2UI\x20catalog\x20instructions\x20and\x20custom\x20component\x20schema.','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','Registered\x20catalogs:\x20','Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.','626840McNmPy','string','application/json','1294965AUuIXU','Optional\x20catalog\x20id.\x20Defaults\x20to\x20the\x20MCP\x20server\x20default\x20catalog\x20id,\x20then\x20the\x20A2UI\x20basic\x20catalog\x20id.','1827687gVNOtQ','surfaceId','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.','Optional\x20instruction\x20detail\x20level\x20for\x20the\x20returned\x20catalog\x20instructions.\x20Defaults\x20to\x20the\x20MCP\x20server\x20catalogInstructionMode.\x20Use\x20compact\x20for\x20a\x20concise\x20field\x20cheat\x20sheet;\x20use\x20full\x20when\x20the\x20model\x20needs\x20the\x20authoritative\x20JSON\x20schema\x20in\x20the\x20instructions.','server','title','annotations','text','defaultCatalogId','v0.9','message','1578744OKhvOQ'];_0x2619=function(){return _0x65927b;};return _0x2619();}import{McpServer,ResourceTemplate}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0x11c2fe,ResourceTemplate as _0x2b8fca}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod/v4';function _0x359f(_0x33df1e,_0x593da8){_0x33df1e=_0x33df1e-0x87;const _0x2619ae=_0x2619();let _0x359fe4=_0x2619ae[_0x33df1e];return _0x359fe4;}import{createUISendNormalizer,createUICatalogRegistry,BASIC_CATALOG_RESOURCE_URI,catalogIdFromResourceVariable,catalogResourceUri,CATALOG_RESOURCE_URI_TEMPLATE,LIST_UI_CATALOGS_TOOL_NAME,UI_TOOL_WORKFLOW,listUICatalogs,GET_UI_CATALOG_TOOL_NAME,getUICatalog,UI_TOOL_NAME,createUICatalogResourcePayload,normalizeUISendToolArguments}from'@agentic-ui-experience/ui-core/tool-mode';const sendUIOutputSchema={'uiJson':z['string'](),'uiMessages':z[_0x64b4a7(0xb5)](z['unknown']())},listCatalogsOutputSchema={'catalogs':z[_0x64b4a7(0xb5)](z[_0x64b4a7(0xa5)]({'id':z['string'](),'resourceUri':z[_0x64b4a7(0x8a)](),'isDefault':z['boolean'](),'baseCatalogId':z['string'](),'baseComponentNames':z[_0x64b4a7(0xb5)](z[_0x64b4a7(0x8a)]()),'customComponents':z['array'](z['string']())}))},getCatalogOutputSchema={'catalog':z['object']({'id':z[_0x64b4a7(0x8a)](),'resourceUri':z['string'](),'isDefault':z[_0x64b4a7(0xa4)](),'baseCatalogId':z[_0x64b4a7(0x8a)](),'instructionMode':z['enum'](['compact',_0x64b4a7(0xa9)]),'descriptor':z[_0x64b4a7(0xaf)](),'instructions':z[_0x64b4a7(0x8a)](),'catalogPrompt':z[_0x64b4a7(0x8a)](),'basicCatalogSchema':z['unknown']()['optional']()})},componentSchema=z['record'](z[_0x64b4a7(0x8a)](),z['unknown']()),createSurfaceMessageSchema=z['object']({'version':z['literal']('v0.9'),'createSurface':z['object']({'surfaceId':z[_0x64b4a7(0x8a)](),'catalogId':z['string']()})[_0x64b4a7(0xa7)]()})['passthrough'](),updateComponentsMessageSchema=z[_0x64b4a7(0xa5)]({'version':z['literal']('v0.9'),'updateComponents':z['object']({'surfaceId':z[_0x64b4a7(0x8a)](),'components':z[_0x64b4a7(0xb5)](componentSchema)})[_0x64b4a7(0xa7)]()})[_0x64b4a7(0xa7)](),updateDataModelMessageSchema=z[_0x64b4a7(0xa5)]({'version':z[_0x64b4a7(0xa0)]('v0.9'),'updateDataModel':z['object']({'surfaceId':z['string'](),'path':z['string']()['optional'](),'value':z['unknown']()[_0x64b4a7(0xa8)]()})['passthrough']()})[_0x64b4a7(0xa7)](),deleteSurfaceMessageSchema=z[_0x64b4a7(0xa5)]({'version':z['literal'](_0x64b4a7(0x97)),'deleteSurface':z['object']({'surfaceId':z['string']()})[_0x64b4a7(0xa7)]()})[_0x64b4a7(0xa7)]();function createSendUIInputSchema(){const _0x53593d=_0x64b4a7;return{'catalogId':z['string']()[_0x53593d(0xa8)]()['describe'](_0x53593d(0xaa)),'surfaceId':z['string']()['optional']()['describe'](_0x53593d(0xbe)),'messages':z['array'](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))['describe']([_0x53593d(0x9e),'Use\x20this\x20only\x20as\x20workflow\x20step\x203,\x20after\x20inspecting\x20catalog\x20metadata\x20with\x20'+LIST_UI_CATALOGS_TOOL_NAME+'\x20and\x20'+GET_UI_CATALOG_TOOL_NAME+'.','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20'+GET_UI_CATALOG_TOOL_NAME+';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.',_0x53593d(0xc5),_0x53593d(0x90),'The\x20first\x20entry\x20must\x20be\x20`createSurface`\x20with\x20both\x20`surfaceId`\x20and\x20`catalogId`\x20inside\x20`createSurface`.',_0x53593d(0x9f),'Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.']['join']('\x20'))};}function createGetCatalogInputSchema(){const _0x4d5b02=_0x64b4a7;return{'catalogId':z['string']()[_0x4d5b02(0xa8)]()[_0x4d5b02(0xbd)](_0x4d5b02(0x8d)),'componentNames':z['array'](z[_0x4d5b02(0x8a)]())['min'](0x1)['optional']()['describe'](_0x4d5b02(0xb8)),'instructionMode':z['enum'](['compact',_0x4d5b02(0xa9)])[_0x4d5b02(0xa8)]()[_0x4d5b02(0xbd)](_0x4d5b02(0x91))};}function createGenericToolDescription(_0x4276ca){const _0x129128=_0x64b4a7,_0x28d5ae=listUICatalogs(_0x4276ca)[_0x129128(0xc2)];return[_0x129128(0x88),UI_TOOL_WORKFLOW,_0x129128(0xab),'Default\x20catalog\x20id:\x20'+_0x4276ca[_0x129128(0x96)]+'.',_0x129128(0x87)+_0x28d5ae[_0x129128(0xc1)](_0x76363d=>_0x76363d['id'])[_0x129128(0xb2)](',\x20')+'.','Message\x20list\x20rules:','-\x20Every\x20message\x20must\x20include\x20\x22version\x22:\x20\x22v0.9\x22.','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.',_0x129128(0x9b),_0x129128(0xb6),'-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.',_0x129128(0xbf),_0x129128(0xb9),_0x129128(0xa3)][_0x129128(0xb2)]('\x0a\x0a');}function createUIMCPNormalize(_0x4ea9ff={}){const _0x1f07e4=_0x64b4a7;return createUISendNormalizer({'mode':_0x4ea9ff[_0x1f07e4(0xa2)],'surfaceId':_0x4ea9ff[_0x1f07e4(0x8f)],'defaultCatalogId':_0x4ea9ff['defaultCatalogId'],'catalogs':_0x4ea9ff[_0x1f07e4(0xc2)]});}const defaultNormalize=createUIMCPNormalize();function toToolError(_0x51799f){return{'isError':!![],'content':[{'type':'text','text':_0x51799f}]};}function toToolResult(_0x2db8c0){const _0x1ee981=_0x64b4a7;return{'content':[{'type':_0x1ee981(0x95),'text':'Accepted\x20'+_0x2db8c0['uiMessages']['length']+_0x1ee981(0xae)}],'structuredContent':_0x2db8c0};}function toCatalogToolResult(_0x470a00){const _0x566a78=_0x64b4a7;return{'content':[{'type':_0x566a78(0x95),'text':JSON['stringify'](_0x470a00)}],'structuredContent':_0x470a00};}async function createUIToolCallResult(_0x24ff89,_0x55f838=defaultNormalize){const _0x287d1e=_0x64b4a7;try{const _0x3b8e7f=await _0x55f838(_0x24ff89);return toToolResult(normalizeUISendToolArguments(_0x24ff89,()=>_0x3b8e7f));}catch(_0x419ca2){const _0x5a9227=_0x419ca2 instanceof Error?_0x419ca2[_0x287d1e(0x98)]:String(_0x419ca2);return toToolError(_0x5a9227);}}function toMCPResourceResult(_0x1ee591){return _0x1ee591;}function createCatalogResourceResult(_0x13ea36,_0x1c3c1b,_0x3b6630){return toMCPResourceResult(createUICatalogResourcePayload(_0x13ea36,_0x1c3c1b,_0x3b6630));}function registerUICatalogResources(_0x57f506,_0x516e4d){const _0x6218d1=_0x64b4a7,_0x40efb9=_0x57f506['registerResource']('a2ui-basic-catalog',BASIC_CATALOG_RESOURCE_URI,{'title':'A2UI\x20Basic\x20Catalog','description':'Built-in\x20A2UI\x20basic\x20catalog\x20instructions\x20and\x20component\x20schema.','mimeType':'application/json'},_0x10f803=>createCatalogResourceResult(_0x516e4d,catalogIdFromResourceVariable('basic'),_0x10f803['href'])),_0x45ad8c=[..._0x516e4d[_0x6218d1(0xc2)]['values']()]['filter'](_0x4ecfbd=>catalogResourceUri(_0x4ecfbd['id'])!==BASIC_CATALOG_RESOURCE_URI)['map'](_0x275c57=>_0x57f506['registerResource'](_0x6218d1(0x9d)+_0x275c57['id'],catalogResourceUri(_0x275c57['id']),{'title':_0x6218d1(0xba)+_0x275c57['id'],'description':_0x6218d1(0xc4),'mimeType':'application/json'},_0x20ac5f=>createCatalogResourceResult(_0x516e4d,_0x275c57['id'],_0x20ac5f['href']))),_0x3b625d=_0x57f506[_0x6218d1(0xb0)](_0x6218d1(0xa6),new ResourceTemplate(CATALOG_RESOURCE_URI_TEMPLATE,{'list':()=>({'resources':[..._0x516e4d[_0x6218d1(0xc2)]['values']()][_0x6218d1(0xc1)](_0x3188ef=>({'uri':catalogResourceUri(_0x3188ef['id']),'name':_0x3188ef['id'],'title':_0x3188ef['id'],'mimeType':_0x6218d1(0x8b)}))}),'complete':{'catalogId':_0x146669=>{const _0x2d3402=_0x6218d1,_0x40a801=_0x146669['toLowerCase']();return[..._0x516e4d['catalogs']['keys']()][_0x2d3402(0xc1)](_0x1a06d0=>catalogResourceUri(_0x1a06d0)===BASIC_CATALOG_RESOURCE_URI?'basic':encodeURIComponent(_0x1a06d0))[_0x2d3402(0x9a)](_0x4c53b5=>_0x4c53b5['toLowerCase']()['startsWith'](_0x40a801));}}}),{'title':'A2UI\x20Catalog','description':_0x6218d1(0xc4),'mimeType':_0x6218d1(0x8b)},(_0x233666,_0x4411ca)=>createCatalogResourceResult(_0x516e4d,catalogIdFromResourceVariable(String(_0x4411ca['catalogId'])),_0x233666['href']));return{'basic':_0x40efb9,'catalogs':_0x45ad8c,'template':_0x3b625d};}function registerUICatalogTools(_0x8d6a27,_0x460038){const _0x123403=_0x64b4a7,_0x45e4ed=_0x8d6a27[_0x123403(0xb3)](LIST_UI_CATALOGS_TOOL_NAME,{'title':_0x123403(0xb7),'description':[_0x123403(0xb1),UI_TOOL_WORKFLOW,'Returns\x20registered\x20catalog\x20ids,\x20the\x20default\x20catalog,\x20base\x20component\x20names,\x20and\x20custom\x20component\x20names.\x20Use\x20the\x20returned\x20component\x20names\x20to\x20choose\x20the\x20componentNames\x20for\x20get_ui_catalog.']['join']('\x0a\x0a'),'outputSchema':listCatalogsOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async()=>toCatalogToolResult(listUICatalogs(_0x460038))),_0xd48ff=_0x8d6a27['registerTool'](GET_UI_CATALOG_TOOL_NAME,{'title':'Get\x20A2UI\x20Catalog','description':['Step\x202\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20after\x20list_ui_catalogs\x20and\x20before\x20send_ui_to_client.',UI_TOOL_WORKFLOW,'Returns\x20LLM-facing\x20A2UI\x20message\x20rules,\x20basic\x20catalog\x20schema,\x20custom\x20component\x20schemas,\x20style\x20guide,\x20and\x20examples\x20for\x20a\x20registered\x20catalog.','Pass\x20only\x20the\x20componentNames\x20needed\x20for\x20the\x20current\x20UI\x20response.\x20Omit\x20componentNames\x20only\x20when\x20the\x20complete\x20catalog\x20is\x20needed.','Use\x20instructionMode\x20\x22full\x22\x20for\x20forms,\x20unfamiliar\x20components,\x20validation\x20failures,\x20or\x20when\x20exact\x20required\x20fields\x20are\x20needed.']['join']('\x0a\x0a'),'inputSchema':createGetCatalogInputSchema(),'outputSchema':getCatalogOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async _0x276064=>{const _0x5e3cd1=_0x123403;try{return toCatalogToolResult(getUICatalog(_0x460038,{'catalogId':_0x276064[_0x5e3cd1(0xbc)],'componentNames':_0x276064[_0x5e3cd1(0x9c)],'instructionMode':_0x276064['instructionMode']}));}catch(_0x31a2f3){const _0x519a1e=_0x31a2f3 instanceof Error?_0x31a2f3[_0x5e3cd1(0x98)]:String(_0x31a2f3);return toToolError(_0x519a1e);}});return{'list':_0x45e4ed,'get':_0xd48ff};}function registerGenericUITool(_0x432023,_0x3c3061,_0x2432d6={}){const _0x5a7ac3=_0x64b4a7,_0xa50bd0=_0x2432d6['normalize']??createUISendNormalizer({'registry':_0x3c3061});return _0x432023['registerTool'](UI_TOOL_NAME,{'title':_0x2432d6[_0x5a7ac3(0x93)],'description':createGenericToolDescription(_0x3c3061),'inputSchema':createSendUIInputSchema(),'outputSchema':sendUIOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0x2432d6[_0x5a7ac3(0x94)]}},async _0x41f789=>createUIToolCallResult(_0x41f789,_0xa50bd0));}function createUIMCPServer(_0x8747da={}){const _0x1bceea=_0x64b4a7,_0x2efdae=createUICatalogRegistry(_0x8747da[_0x1bceea(0xc2)],_0x8747da['defaultCatalogId'],_0x8747da['catalogInstructionMode']),_0x43fd1e=_0x8747da[_0x1bceea(0xa1)]??createUIMCPNormalize({'catalogs':_0x8747da['catalogs'],'defaultCatalogId':_0x8747da[_0x1bceea(0x96)]}),_0x4a16b0=new McpServer({'name':_0x8747da['server']?.['name']??'@agentic-ui-experience/ui-mcp','version':_0x8747da[_0x1bceea(0x92)]?.['version']??'0.0.0'});return registerUICatalogResources(_0x4a16b0,_0x2efdae),registerUICatalogTools(_0x4a16b0,_0x2efdae),registerGenericUITool(_0x4a16b0,_0x2efdae,{..._0x8747da,'normalize':_0x43fd1e}),_0x4a16b0;}export{_0x11c2fe as McpServer,_0x2b8fca as ResourceTemplate,createUIMCPNormalize,createUIMCPServer,createUIToolCallResult,registerGenericUITool,registerUICatalogResources,registerUICatalogTools};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-ui-experience/ui-mcp",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
25
25
|
"zod": "^4.0.0",
|
|
26
|
-
"@agentic-ui-experience/ui-core": "0.0.1-beta.
|
|
26
|
+
"@agentic-ui-experience/ui-core": "0.0.1-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^24.10.1"
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"start:http:cors": "node dist/cli.js --transport http --host 127.0.0.1 --port 3001 --endpoint /mcp --cors-origin \"*\"",
|
|
38
38
|
"start:help": "node dist/cli.js --help",
|
|
39
39
|
"inspector": "pnpm run build && pnpm dlx @modelcontextprotocol/inspector --transport stdio node dist/cli.js --transport stdio",
|
|
40
|
-
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
40
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
41
|
+
"test": "pnpm run build && node --test \"tests/**/*.test.mjs\""
|
|
41
42
|
}
|
|
42
43
|
}
|