@agentic-ui-experience/ui-mcp 0.0.1-beta.2 → 0.0.1-beta.3
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/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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);});
|
|
2
|
+
const _0x448f3b=_0x736e;(function(_0x548320,_0x26b48e){const _0x4dff72=_0x736e,_0x445ba0=_0x548320();while(!![]){try{const _0x1e99a5=parseInt(_0x4dff72(0xa0))/0x1*(-parseInt(_0x4dff72(0xad))/0x2)+-parseInt(_0x4dff72(0xc3))/0x3*(-parseInt(_0x4dff72(0xbe))/0x4)+parseInt(_0x4dff72(0x8b))/0x5+parseInt(_0x4dff72(0x99))/0x6*(parseInt(_0x4dff72(0xb7))/0x7)+parseInt(_0x4dff72(0xc4))/0x8+parseInt(_0x4dff72(0xc2))/0x9+-parseInt(_0x4dff72(0xac))/0xa;if(_0x1e99a5===_0x26b48e)break;else _0x445ba0['push'](_0x445ba0['shift']());}catch(_0x1534a1){_0x445ba0['push'](_0x445ba0['shift']());}}}(_0x4e82,0x5936e));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=_0x448f3b(0xb9);function stringValue(_0x5b2be7,_0xb5511d){const _0xb595f0=_0x448f3b;return typeof _0x5b2be7===_0xb595f0(0x8c)&&_0x5b2be7[_0xb595f0(0x90)]>0x0?_0x5b2be7:_0xb5511d;}function optionalStringValue(_0x401556){const _0x1d295f=_0x448f3b;return typeof _0x401556==='string'&&_0x401556[_0x1d295f(0x90)]>0x0?_0x401556:void 0x0;}function stringArrayValue(_0x359ec1){const _0x11fd29=_0x448f3b;if(Array['isArray'](_0x359ec1))return _0x359ec1;if(typeof _0x359ec1===_0x11fd29(0x8c)&&_0x359ec1[_0x11fd29(0x90)]>0x0)return[_0x359ec1];return[];}function parseTransport(_0x52f906){const _0x38b60c=_0x448f3b;if(_0x52f906==='stdio'||_0x52f906===_0x38b60c(0x9e))return _0x52f906;throw new Error('Unsupported\x20transport\x20\x22'+_0x52f906+_0x38b60c(0xc8));}function _0x4e82(){const _0x367a74=['Internal\x20MCP\x20server\x20error','setHeader','\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.','port','OPTIONS','catalog-instruction-mode','123137ezsUId','Origin','@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','statusCode','help','serverVersion','serverName','376CFfCed','catalogs','\x22.\x20Expected\x20\x22compact\x22\x20or\x20\x22full\x22.','catalog','6220197KlMazO','20337ULIvXG','4470600nYmYKs','connect','compact','boolean','\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.','stdout','stdio','object','SIGTERM','baseComponentNames','method','defaultCatalogId','host','catch','localhost','3082355MSYqgv','string','once','message','Invalid\x20--port\x20\x22','length','Access-Control-Expose-Headers','Unsupported\x20catalog\x20instruction\x20mode\x20\x22','[@agentic-ui-experience/ui-mcp]\x20request\x20failed','origin','endpoint','stringify','headers','\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.','222UZJvRt','href','transport','GET,POST,DELETE,OPTIONS','error','http','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID','11zyxOWy','content-type','version','end','name','Not\x20Found','default','values','close','3001','includes','headersSent','23531590bxInDb','79262McRtAL','isArray','@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://','corsOrigins'];_0x4e82=function(){return _0x367a74;};return _0x4e82();}function parseCatalogInstructionMode(_0x47cf15){const _0x29d021=_0x448f3b;if(_0x47cf15==='compact'||_0x47cf15==='full')return _0x47cf15;throw new Error(_0x29d021(0x92)+_0x47cf15+_0x29d021(0xc0));}function parsePort(_0x2b4e8d){const _0x35f978=_0x448f3b,_0x4339a2=Number(_0x2b4e8d);if(!Number['isInteger'](_0x4339a2)||_0x4339a2<0x1||_0x4339a2>0xffff)throw new Error(_0x35f978(0x8f)+_0x2b4e8d+_0x35f978(0xb3));return _0x4339a2;}function _0x736e(_0x4cc1c0,_0x3c5a73){_0x4cc1c0=_0x4cc1c0-0x87;const _0x4e828a=_0x4e82();let _0x736e54=_0x4e828a[_0x4cc1c0];return _0x736e54;}function normalizeEndpoint(_0xc022f2){if(!_0xc022f2['startsWith']('/'))return'/'+_0xc022f2;return _0xc022f2;}function isCatalogDescriptor(_0x415437){const _0x30f057=_0x448f3b;return!!_0x415437&&typeof _0x415437===_0x30f057(0xcb)&&!Array['isArray'](_0x415437)&&typeof _0x415437['id']==='string'&&Array[_0x30f057(0xae)](_0x415437[_0x30f057(0xcd)]);}function readCatalogExports(_0x202a50,_0x12e0de){const _0x40cecf=_0x448f3b,_0x288d57=_0x202a50[_0x40cecf(0xbf)]??_0x202a50[_0x40cecf(0xc1)]??_0x202a50[_0x40cecf(0xa6)],_0x59953f=[];if(Array['isArray'](_0x288d57))for(const _0x1141ce of _0x288d57){if(!isCatalogDescriptor(_0x1141ce))throw new Error('Catalog\x20module\x20\x22'+_0x12e0de+_0x40cecf(0x98));_0x59953f['push'](_0x1141ce);}else{if(_0x288d57!==void 0x0){if(!isCatalogDescriptor(_0x288d57))throw new Error('Catalog\x20module\x20\x22'+_0x12e0de+_0x40cecf(0x98));_0x59953f['push'](_0x288d57);}}if(_0x59953f['length']===0x0)throw new Error('Catalog\x20module\x20\x22'+_0x12e0de+'\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.');const _0x3203af=typeof _0x202a50['defaultCatalogId']==='string'&&_0x202a50[_0x40cecf(0x87)][_0x40cecf(0x90)]>0x0?_0x202a50[_0x40cecf(0x87)]:void 0x0;return{'catalogs':_0x59953f,'defaultCatalogId':_0x3203af};}async function loadCatalogs(_0x3be76f){const _0x440621=_0x448f3b,_0x8d659d=[];let _0x27a098;for(const _0x5886e7 of _0x3be76f){const _0x43610e=await import(pathToFileURL(resolve(_0x5886e7))[_0x440621(0x9a)]),_0x94ccc4=readCatalogExports(_0x43610e,_0x5886e7);_0x8d659d['push'](..._0x94ccc4[_0x440621(0xbf)]),_0x27a098??(_0x27a098=_0x94ccc4[_0x440621(0x87)]);}return{'catalogs':_0x8d659d,'defaultCatalogId':_0x27a098};}async function parseCliOptions(){const _0x45dd94=_0x448f3b,_0x51d7c8=parseArgs({'allowPositionals':![],'options':{'transport':{'type':_0x45dd94(0x8c)},'host':{'type':'string'},'port':{'type':'string'},'endpoint':{'type':_0x45dd94(0x8c)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':_0x45dd94(0x8c),'multiple':!![]},'default-catalog-id':{'type':_0x45dd94(0x8c)},'catalog-instruction-mode':{'type':_0x45dd94(0x8c)},'name':{'type':'string'},'version':{'type':_0x45dd94(0x8c)},'help':{'type':_0x45dd94(0xc7),'short':'h'}}});_0x51d7c8['values'][_0x45dd94(0xbb)]&&(process[_0x45dd94(0xc9)]['write'](helpText),process['exit'](0x0));const _0x56746a=await loadCatalogs(stringArrayValue(_0x51d7c8['values'][_0x45dd94(0xc1)])),_0x2f1021=optionalStringValue(_0x51d7c8[_0x45dd94(0xa7)]['default-catalog-id'])??_0x56746a['defaultCatalogId'];return{'transport':parseTransport(stringValue(_0x51d7c8[_0x45dd94(0xa7)][_0x45dd94(0x9b)],_0x45dd94(0xca))),'host':stringValue(_0x51d7c8[_0x45dd94(0xa7)][_0x45dd94(0x88)],'127.0.0.1'),'port':parsePort(stringValue(_0x51d7c8[_0x45dd94(0xa7)][_0x45dd94(0xb4)],_0x45dd94(0xa9))),'endpoint':normalizeEndpoint(stringValue(_0x51d7c8['values'][_0x45dd94(0x95)],'/mcp')),'corsOrigins':stringArrayValue(_0x51d7c8['values']['cors-origin']),'catalogs':_0x56746a[_0x45dd94(0xbf)],..._0x2f1021?{'defaultCatalogId':_0x2f1021}:{},'catalogInstructionMode':parseCatalogInstructionMode(stringValue(_0x51d7c8[_0x45dd94(0xa7)][_0x45dd94(0xb6)],_0x45dd94(0xc6))),...optionalStringValue(_0x51d7c8[_0x45dd94(0xa7)]['name'])?{'serverName':optionalStringValue(_0x51d7c8['values'][_0x45dd94(0xa4)])}:{},...optionalStringValue(_0x51d7c8[_0x45dd94(0xa7)][_0x45dd94(0xa2)])?{'serverVersion':optionalStringValue(_0x51d7c8['values'][_0x45dd94(0xa2)])}:{}};}function createServerOptions(_0x3b8440){const _0x27ec3d=_0x448f3b;return{'catalogs':_0x3b8440[_0x27ec3d(0xbf)],..._0x3b8440[_0x27ec3d(0x87)]?{'defaultCatalogId':_0x3b8440[_0x27ec3d(0x87)]}:{},..._0x3b8440['catalogInstructionMode']?{'catalogInstructionMode':_0x3b8440['catalogInstructionMode']}:{},'server':{..._0x3b8440[_0x27ec3d(0xbd)]?{'name':_0x3b8440[_0x27ec3d(0xbd)]}:{},..._0x3b8440['serverVersion']?{'version':_0x3b8440[_0x27ec3d(0xbc)]}:{}}};}function setCorsHeaders(_0x1e0bf0,_0x2a3758,_0x3130f0){const _0xf341a6=_0x448f3b;if(_0x3130f0['length']===0x0)return;const _0x413ba2=_0x1e0bf0[_0xf341a6(0x97)][_0xf341a6(0x94)],_0x190c62=_0x3130f0[_0xf341a6(0xaa)]('*'),_0x545482=_0x190c62?'*':typeof _0x413ba2===_0xf341a6(0x8c)&&_0x3130f0[_0xf341a6(0xaa)](_0x413ba2)?_0x413ba2:void 0x0;if(!_0x545482)return;_0x2a3758[_0xf341a6(0xb2)]('Access-Control-Allow-Origin',_0x545482),_0x2a3758['setHeader']('Vary',_0xf341a6(0xb8)),_0x2a3758['setHeader']('Access-Control-Allow-Methods',_0xf341a6(0x9c)),_0x2a3758['setHeader']('Access-Control-Allow-Headers',_0xf341a6(0x9f)),_0x2a3758[_0xf341a6(0xb2)](_0xf341a6(0x91),'Mcp-Session-Id');}function writeJsonRpcError(_0x12b71e,_0x142f0b,_0x259cc9){const _0x486c96=_0x448f3b;_0x12b71e[_0x486c96(0xba)]=_0x142f0b,_0x12b71e['setHeader'](_0x486c96(0xa1),'application/json'),_0x12b71e[_0x486c96(0xa3)](JSON[_0x486c96(0x96)]({'jsonrpc':'2.0','error':{'code':-0x7f5b,'message':_0x259cc9},'id':null}));}async function startStdio(_0x5b9c84){const _0x29282f=createUIMCPServer(createServerOptions(_0x5b9c84));await _0x29282f['connect'](new StdioServerTransport());}async function startHttp(_0x31b19d){const _0x2836bc=_0x448f3b,_0x4c809e=createServer(async(_0x445358,_0x2e53ca)=>{const _0x563c18=_0x736e,_0x56e8cc=new URL(_0x445358['url']??'/','http://'+(_0x445358['headers']['host']??_0x563c18(0x8a)));if(_0x56e8cc['pathname']!==_0x31b19d['endpoint']){_0x2e53ca['statusCode']=0x194,_0x2e53ca[_0x563c18(0xa3)](_0x563c18(0xa5));return;}setCorsHeaders(_0x445358,_0x2e53ca,_0x31b19d[_0x563c18(0xb0)]);if(_0x445358[_0x563c18(0xce)]===_0x563c18(0xb5)){_0x2e53ca[_0x563c18(0xba)]=0xcc,_0x2e53ca[_0x563c18(0xa3)]();return;}const _0x23c0a0=createUIMCPServer(createServerOptions(_0x31b19d)),_0x1b7c27=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});try{await _0x23c0a0[_0x563c18(0xc5)](_0x1b7c27),await _0x1b7c27['handleRequest'](_0x445358,_0x2e53ca),_0x2e53ca['on'](_0x563c18(0xa8),()=>{const _0x5a3840=_0x563c18;void _0x1b7c27[_0x5a3840(0xa8)](),void _0x23c0a0[_0x5a3840(0xa8)]();});}catch(_0x3560ef){console['error'](_0x563c18(0x93),_0x3560ef),!_0x2e53ca[_0x563c18(0xab)]&&writeJsonRpcError(_0x2e53ca,0x1f4,_0x3560ef instanceof Error?_0x3560ef['message']:_0x563c18(0xb1));}});await new Promise((_0x3ddd32,_0x38fd01)=>{const _0x4b86ea=_0x736e;_0x4c809e[_0x4b86ea(0x8d)](_0x4b86ea(0x9d),_0x38fd01),_0x4c809e['listen'](_0x31b19d[_0x4b86ea(0xb4)],_0x31b19d[_0x4b86ea(0x88)],_0x3ddd32);});const _0x546283=()=>{const _0x2cfaac=_0x736e;_0x4c809e[_0x2cfaac(0xa8)](()=>process['exit'](0x0));};process[_0x2836bc(0x8d)]('SIGINT',_0x546283),process['once'](_0x2836bc(0xcc),_0x546283),process['stderr']['write'](_0x2836bc(0xaf)+_0x31b19d['host']+':'+_0x31b19d[_0x2836bc(0xb4)]+_0x31b19d['endpoint']+'\x0a');}async function main(){const _0x2f0a43=_0x448f3b,_0x5939ca=await parseCliOptions();if(_0x5939ca[_0x2f0a43(0x9b)]===_0x2f0a43(0xca)){await startStdio(_0x5939ca);return;}await startHttp(_0x5939ca);}main()[_0x448f3b(0x89)](_0x206766=>{const _0x51393c=_0x448f3b;process['stderr']['write']((_0x206766 instanceof Error?_0x206766[_0x51393c(0x8e)]:String(_0x206766))+'\x0a'),process['exit'](0x1);});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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};
|
|
1
|
+
const _0x32dd7e=_0x1500;(function(_0x59384c,_0x5dab4b){const _0x35a13b=_0x1500,_0x5b9344=_0x59384c();while(!![]){try{const _0x3aaddf=parseInt(_0x35a13b(0x175))/0x1+parseInt(_0x35a13b(0x161))/0x2+-parseInt(_0x35a13b(0x16c))/0x3*(-parseInt(_0x35a13b(0x166))/0x4)+-parseInt(_0x35a13b(0x155))/0x5*(parseInt(_0x35a13b(0x151))/0x6)+-parseInt(_0x35a13b(0x185))/0x7*(-parseInt(_0x35a13b(0x186))/0x8)+parseInt(_0x35a13b(0x168))/0x9*(-parseInt(_0x35a13b(0x148))/0xa)+-parseInt(_0x35a13b(0x14b))/0xb*(parseInt(_0x35a13b(0x158))/0xc);if(_0x3aaddf===_0x5dab4b)break;else _0x5b9344['push'](_0x5b9344['shift']());}catch(_0x29406d){_0x5b9344['push'](_0x5b9344['shift']());}}}(_0x43ac,0x7dbe7));import{McpServer,ResourceTemplate}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0x13fec9,ResourceTemplate as _0x32ec85}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod/v4';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['array'](z[_0x32dd7e(0x176)]())},listCatalogsOutputSchema={'catalogs':z['array'](z['object']({'id':z['string'](),'resourceUri':z[_0x32dd7e(0x146)](),'isDefault':z['boolean'](),'baseCatalogId':z['string'](),'baseComponentNames':z[_0x32dd7e(0x157)](z[_0x32dd7e(0x146)]()),'customComponents':z['array'](z['string']())}))},getCatalogOutputSchema={'catalog':z['object']({'id':z['string'](),'resourceUri':z['string'](),'isDefault':z['boolean'](),'baseCatalogId':z['string'](),'instructionMode':z['enum'](['compact','full']),'descriptor':z[_0x32dd7e(0x176)](),'instructions':z[_0x32dd7e(0x146)](),'catalogPrompt':z['string'](),'basicCatalogSchema':z['unknown']()[_0x32dd7e(0x17b)]()})},componentSchema=z[_0x32dd7e(0x165)](z['string'](),z[_0x32dd7e(0x176)]()),createSurfaceMessageSchema=z[_0x32dd7e(0x14a)]({'version':z[_0x32dd7e(0x16e)]('v0.9'),'createSurface':z['object']({'surfaceId':z['string'](),'catalogId':z['string']()})[_0x32dd7e(0x15c)]()})['passthrough'](),updateComponentsMessageSchema=z['object']({'version':z['literal'](_0x32dd7e(0x18b)),'updateComponents':z[_0x32dd7e(0x14a)]({'surfaceId':z[_0x32dd7e(0x146)](),'components':z['array'](componentSchema)})['passthrough']()})['passthrough'](),updateDataModelMessageSchema=z[_0x32dd7e(0x14a)]({'version':z[_0x32dd7e(0x16e)](_0x32dd7e(0x18b)),'updateDataModel':z['object']({'surfaceId':z[_0x32dd7e(0x146)](),'path':z['string']()['optional'](),'value':z[_0x32dd7e(0x176)]()['optional']()})[_0x32dd7e(0x15c)]()})['passthrough'](),deleteSurfaceMessageSchema=z[_0x32dd7e(0x14a)]({'version':z['literal']('v0.9'),'deleteSurface':z[_0x32dd7e(0x14a)]({'surfaceId':z[_0x32dd7e(0x146)]()})[_0x32dd7e(0x15c)]()})[_0x32dd7e(0x15c)]();function createSendUIInputSchema(){const _0xf23b15=_0x32dd7e;return{'catalogId':z['string']()['optional']()['describe']('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']()['optional']()['describe']('Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.'),'messages':z[_0xf23b15(0x157)](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))[_0xf23b15(0x180)](['The\x20complete\x20A2UI\x20v0.9-compatible\x20UI\x20message\x20array.',_0xf23b15(0x15b)+LIST_UI_CATALOGS_TOOL_NAME+'\x20and\x20'+GET_UI_CATALOG_TOOL_NAME+'.',_0xf23b15(0x18d)+GET_UI_CATALOG_TOOL_NAME+_0xf23b15(0x184),_0xf23b15(0x159),_0xf23b15(0x178),'The\x20first\x20entry\x20must\x20be\x20`createSurface`\x20with\x20both\x20`surfaceId`\x20and\x20`catalogId`\x20inside\x20`createSurface`.','If\x20the\x20tool\x20call\x20includes\x20top-level\x20`catalogId`,\x20`messages[0].createSurface.catalogId`\x20must\x20repeat\x20the\x20same\x20value.',_0xf23b15(0x17c)]['join']('\x20'))};}function createGetCatalogInputSchema(){const _0x190f77=_0x32dd7e;return{'catalogId':z[_0x190f77(0x146)]()['optional']()[_0x190f77(0x180)](_0x190f77(0x167)),'componentNames':z['array'](z[_0x190f77(0x146)]())[_0x190f77(0x189)](0x1)['optional']()[_0x190f77(0x180)](_0x190f77(0x174)),'instructionMode':z['enum']([_0x190f77(0x182),_0x190f77(0x147)])['optional']()[_0x190f77(0x180)]('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 createGenericToolDescription(_0x4e1f32){const _0x54a9ad=_0x32dd7e,_0x2a37d0=listUICatalogs(_0x4e1f32)[_0x54a9ad(0x172)];return[_0x54a9ad(0x17f),UI_TOOL_WORKFLOW,_0x54a9ad(0x17e),_0x54a9ad(0x173)+_0x4e1f32['defaultCatalogId']+'.','Registered\x20catalogs:\x20'+_0x2a37d0[_0x54a9ad(0x152)](_0x358de5=>_0x358de5['id'])[_0x54a9ad(0x14c)](',\x20')+'.','Message\x20list\x20rules:',_0x54a9ad(0x188),'-\x20The\x20first\x20message\x20must\x20be\x20createSurface.',_0x54a9ad(0x16d),_0x54a9ad(0x17a),'-\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.',_0x54a9ad(0x16a),_0x54a9ad(0x16b)]['join']('\x0a\x0a');}function createUIMCPNormalize(_0x1ef7e9={}){const _0x4fb648=_0x32dd7e;return createUISendNormalizer({'mode':_0x1ef7e9[_0x4fb648(0x15a)],'surfaceId':_0x1ef7e9[_0x4fb648(0x183)],'defaultCatalogId':_0x1ef7e9[_0x4fb648(0x169)],'catalogs':_0x1ef7e9[_0x4fb648(0x172)]});}const defaultNormalize=createUIMCPNormalize();function _0x43ac(){const _0x221c58=['a2ui-basic-catalog','values','1317786LhWmrM','map','Accepted\x20','keys','10KPOyvR','catalogId','array','338028kHPfyK','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','mode','Use\x20this\x20only\x20as\x20workflow\x20step\x203,\x20after\x20inspecting\x20catalog\x20metadata\x20with\x20','passthrough','componentNames','text','List\x20A2UI\x20Catalogs','application/json','1130792JzxVix','name','href','basic','record','412NvjEeo','Optional\x20catalog\x20id.\x20Defaults\x20to\x20the\x20MCP\x20server\x20default\x20catalog\x20id,\x20then\x20the\x20A2UI\x20basic\x20catalog\x20id.','542421HGLuLr','defaultCatalogId','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','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`.','10215xzfpUz','-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.','literal','instructionMode','server','Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20get_ui_catalog\x20or\x20send_ui_to_client.','catalogs','Default\x20catalog\x20id:\x20','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.','896050bGZwkj','unknown','annotations','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.','normalize','-\x20createSurface.catalogId\x20must\x20be\x20present\x20and\x20must\x20match\x20the\x20top-level\x20catalogId\x20when\x20supplied;\x20otherwise\x20it\x20must\x20match\x20the\x20registered\x20default\x20catalog\x20id.','optional','Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.','toLowerCase','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.','Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.','describe','Registered\x20A2UI\x20catalog\x20instructions\x20and\x20custom\x20component\x20schema.','compact','surfaceId',';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.','63ibpwgD','521448mPRtxc','message','-\x20Every\x20message\x20must\x20include\x20\x22version\x22:\x20\x22v0.9\x22.','min','Returns\x20LLM-facing\x20A2UI\x20message\x20rules,\x20basic\x20catalog\x20schema,\x20custom\x20component\x20schemas,\x20style\x20guide,\x20and\x20examples\x20for\x20a\x20registered\x20catalog.','v0.9','Pass\x20only\x20the\x20componentNames\x20needed\x20for\x20the\x20current\x20UI\x20response.\x20Omit\x20componentNames\x20only\x20when\x20the\x20complete\x20catalog\x20is\x20needed.','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20','string','full','20FaRran','\x20A2UI\x20UI\x20message(s).','object','517ublcJn','join','@agentic-ui-experience/ui-mcp','A2UI\x20Catalog'];_0x43ac=function(){return _0x221c58;};return _0x43ac();}function toToolError(_0x40a984){return{'isError':!![],'content':[{'type':'text','text':_0x40a984}]};}function toToolResult(_0x5a23d5){const _0xbc1cd3=_0x32dd7e;return{'content':[{'type':'text','text':_0xbc1cd3(0x153)+_0x5a23d5['uiMessages']['length']+_0xbc1cd3(0x149)}],'structuredContent':_0x5a23d5};}function toCatalogToolResult(_0x4686fd){const _0x3774e9=_0x32dd7e;return{'content':[{'type':_0x3774e9(0x15e),'text':JSON['stringify'](_0x4686fd)}],'structuredContent':_0x4686fd};}async function createUIToolCallResult(_0x2420e7,_0x43c141=defaultNormalize){try{const _0x3fdb0c=await _0x43c141(_0x2420e7);return toToolResult(normalizeUISendToolArguments(_0x2420e7,()=>_0x3fdb0c));}catch(_0x52e480){const _0x3aabbd=_0x52e480 instanceof Error?_0x52e480['message']:String(_0x52e480);return toToolError(_0x3aabbd);}}function toMCPResourceResult(_0x12293d){return _0x12293d;}function createCatalogResourceResult(_0x3f6b5a,_0x1930ac,_0x62f94b){return toMCPResourceResult(createUICatalogResourcePayload(_0x3f6b5a,_0x1930ac,_0x62f94b));}function registerUICatalogResources(_0x365009,_0x33fda2){const _0x35b1b2=_0x32dd7e,_0x6b7c49=_0x365009['registerResource'](_0x35b1b2(0x14f),BASIC_CATALOG_RESOURCE_URI,{'title':'A2UI\x20Basic\x20Catalog','description':'Built-in\x20A2UI\x20basic\x20catalog\x20instructions\x20and\x20component\x20schema.','mimeType':'application/json'},_0x4193dd=>createCatalogResourceResult(_0x33fda2,catalogIdFromResourceVariable(_0x35b1b2(0x164)),_0x4193dd[_0x35b1b2(0x163)])),_0x52fa9b=[..._0x33fda2[_0x35b1b2(0x172)][_0x35b1b2(0x150)]()]['filter'](_0x20b2b0=>catalogResourceUri(_0x20b2b0['id'])!==BASIC_CATALOG_RESOURCE_URI)['map'](_0x463735=>_0x365009['registerResource']('a2ui-catalog-'+_0x463735['id'],catalogResourceUri(_0x463735['id']),{'title':'A2UI\x20Catalog\x20'+_0x463735['id'],'description':_0x35b1b2(0x181),'mimeType':_0x35b1b2(0x160)},_0x3b0684=>createCatalogResourceResult(_0x33fda2,_0x463735['id'],_0x3b0684['href']))),_0x11f624=_0x365009['registerResource']('a2ui-catalog',new ResourceTemplate(CATALOG_RESOURCE_URI_TEMPLATE,{'list':()=>({'resources':[..._0x33fda2['catalogs']['values']()]['map'](_0x2ea7dc=>({'uri':catalogResourceUri(_0x2ea7dc['id']),'name':_0x2ea7dc['id'],'title':_0x2ea7dc['id'],'mimeType':'application/json'}))}),'complete':{'catalogId':_0x454ef7=>{const _0x2898d7=_0x35b1b2,_0x26038c=_0x454ef7['toLowerCase']();return[..._0x33fda2[_0x2898d7(0x172)][_0x2898d7(0x154)]()][_0x2898d7(0x152)](_0x368466=>catalogResourceUri(_0x368466)===BASIC_CATALOG_RESOURCE_URI?'basic':encodeURIComponent(_0x368466))['filter'](_0x2085a=>_0x2085a[_0x2898d7(0x17d)]()['startsWith'](_0x26038c));}}}),{'title':_0x35b1b2(0x14e),'description':_0x35b1b2(0x181),'mimeType':_0x35b1b2(0x160)},(_0x27846a,_0x35afcf)=>createCatalogResourceResult(_0x33fda2,catalogIdFromResourceVariable(String(_0x35afcf[_0x35b1b2(0x156)])),_0x27846a[_0x35b1b2(0x163)]));return{'basic':_0x6b7c49,'catalogs':_0x52fa9b,'template':_0x11f624};}function _0x1500(_0xaa13d6,_0x1c406c){_0xaa13d6=_0xaa13d6-0x146;const _0x43ac42=_0x43ac();let _0x15002b=_0x43ac42[_0xaa13d6];return _0x15002b;}function registerUICatalogTools(_0x1816ec,_0x4f586c){const _0x4a8692=_0x32dd7e,_0x1ae6a8=_0x1816ec['registerTool'](LIST_UI_CATALOGS_TOOL_NAME,{'title':_0x4a8692(0x15f),'description':[_0x4a8692(0x171),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(_0x4f586c))),_0x133979=_0x1816ec['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,_0x4a8692(0x18a),_0x4a8692(0x18c),'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 _0x49dd48=>{const _0x59624a=_0x4a8692;try{return toCatalogToolResult(getUICatalog(_0x4f586c,{'catalogId':_0x49dd48[_0x59624a(0x156)],'componentNames':_0x49dd48[_0x59624a(0x15d)],'instructionMode':_0x49dd48[_0x59624a(0x16f)]}));}catch(_0x3f6d05){const _0xc1f529=_0x3f6d05 instanceof Error?_0x3f6d05[_0x59624a(0x187)]:String(_0x3f6d05);return toToolError(_0xc1f529);}});return{'list':_0x1ae6a8,'get':_0x133979};}function registerGenericUITool(_0x17b9ee,_0x7a0d21,_0x26b2e9={}){const _0x181bf3=_0x32dd7e,_0x2c5cda=_0x26b2e9[_0x181bf3(0x179)]??createUISendNormalizer({'registry':_0x7a0d21});return _0x17b9ee['registerTool'](UI_TOOL_NAME,{'title':_0x26b2e9['title'],'description':createGenericToolDescription(_0x7a0d21),'inputSchema':createSendUIInputSchema(),'outputSchema':sendUIOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0x26b2e9[_0x181bf3(0x177)]}},async _0x1d11e6=>createUIToolCallResult(_0x1d11e6,_0x2c5cda));}function createUIMCPServer(_0x50e42c={}){const _0x7243d1=_0x32dd7e,_0x2abdf4=createUICatalogRegistry(_0x50e42c['catalogs'],_0x50e42c[_0x7243d1(0x169)],_0x50e42c['catalogInstructionMode']),_0x4df67c=_0x50e42c[_0x7243d1(0x179)]??createUIMCPNormalize({'catalogs':_0x50e42c[_0x7243d1(0x172)],'defaultCatalogId':_0x50e42c[_0x7243d1(0x169)]}),_0x455eb0=new McpServer({'name':_0x50e42c['server']?.[_0x7243d1(0x162)]??_0x7243d1(0x14d),'version':_0x50e42c[_0x7243d1(0x170)]?.['version']??'0.0.0'});return registerUICatalogResources(_0x455eb0,_0x2abdf4),registerUICatalogTools(_0x455eb0,_0x2abdf4),registerGenericUITool(_0x455eb0,_0x2abdf4,{..._0x50e42c,'normalize':_0x4df67c}),_0x455eb0;}export{_0x13fec9 as McpServer,_0x32ec85 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.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
25
|
-
"zod": "^
|
|
26
|
-
"@agentic-ui-experience/ui-core": "0.0.1-beta.
|
|
25
|
+
"zod": "^3.25.76",
|
|
26
|
+
"@agentic-ui-experience/ui-core": "0.0.1-beta.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^24.10.1"
|