@agentic-ui-experience/ui-mcp 0.0.1-beta.5 → 0.0.1-beta.7

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 CHANGED
@@ -1,11 +1,12 @@
1
1
  # @agentic-ui-experience/ui-mcp
2
2
 
3
- Generic MCP server adapter for A2UI.
3
+ MCP server adapter for this project's A2UI integration.
4
4
 
5
- This package does not render or ingest UI. It exposes Catalog discovery tools
6
- and a `send_ui_to_client` MCP tool that returns validated A2UI messages as a
7
- canonical MCP `EmbeddedResource`. The Host extracts that resource and forwards
8
- its messages to `@agentic-ui-experience/ui-runtime`.
5
+ This package does not render or ingest UI. It exposes a `send_ui_to_client`
6
+ MCP tool and optional Catalog discovery, depending on the configured Schema
7
+ delivery mode. The send tool returns validated A2UI messages as a canonical MCP
8
+ `EmbeddedResource`. The Host extracts that resource and forwards its messages
9
+ to `@agentic-ui-experience/ui-runtime`.
9
10
 
10
11
  MCP is one integration path for producing the project's UI Message Contract. The Host app still owns the Transport that forwards the result to the frontend and the Runtime still owns Surface state; this package does not choose or operate that Transport. See the [project glossary](../../docs/glossary.md).
11
12
 
@@ -37,14 +38,73 @@ to have a different identity.
37
38
  import { createUIMCPServer } from "@agentic-ui-experience/ui-mcp";
38
39
 
39
40
  const server = createUIMCPServer({
40
- catalog: weatherPromptDescriptor,
41
- catalogInstructionMode: "compact"
41
+ catalog: weatherPromptDescriptor
42
42
  });
43
43
 
44
44
  await server.connect(transport);
45
45
  ```
46
46
 
47
- ## A2UI over MCP contract
47
+ ## Schema delivery
48
+
49
+ Choose how the Agent obtains the generation Schema when creating or starting the
50
+ server, not in individual tool-call arguments:
51
+
52
+ | `schemaDelivery` | Tools registered | Where the model gets component definitions |
53
+ | --- | --- | --- |
54
+ | `"discovery"` (default) | `get_ui_catalog`, `send_ui_to_client` | Structured JSON Schema in selected `get_ui_catalog` results, loaded on demand. |
55
+ | `"inline"` | `send_ui_to_client` only | The complete Catalog-bound `inputSchema` returned by `tools/list`. |
56
+
57
+ ```ts
58
+ const server = createUIMCPServer({
59
+ catalog: weatherPromptDescriptor,
60
+ schemaDelivery: "inline"
61
+ });
62
+ ```
63
+
64
+ ```bash
65
+ ax-ui-mcp --transport stdio --catalog ./weather-catalog.js --schema-delivery inline
66
+ ```
67
+
68
+ In inline mode, the Agent Host supplies the send tool definition to the model.
69
+ The Schema is in **`tools/list` → `send_ui_to_client.inputSchema`**, not copied
70
+ into the description and not passed as a `schema` argument. The model generates
71
+ **`tools/call.arguments: { messages, surfaceId? }`** from those definitions.
72
+ Neither `get_ui_catalog` nor a resource read is a prerequisite. The
73
+ `a2ui://catalog` resource remains available in both modes with complete
74
+ Host-facing metadata.
75
+
76
+ The inline Schema contains the configured Basic and Custom components, all Basic
77
+ catalog functions, and the fixed Catalog ID. The description retains generation
78
+ rules, style guidance, and examples. Use inline when the Agent Host can supply
79
+ the complete JSON Schema, including local `$ref` definitions, to the model; use
80
+ discovery when definitions should be loaded on demand.
81
+
82
+ `schemaDelivery` changes when the Schema is delivered, not its constraints.
83
+ Basic definitions always use structured JSON Schema; there is no separate
84
+ instruction-format option. Invalid delivery values are errors. This is a project
85
+ choice, not a requirement shared by every official sample; see the
86
+ [pinned upstream comparison](../ui-core/README.md#upstream-sample-context).
87
+
88
+ Inline uses Core's [`createUISendToolSpec()`](../ui-core/README.md#standalone-send-definition-inline-schema-delivery),
89
+ not a second execution path. Both modes share capability checks, normalization,
90
+ strict carrier validation, and the EmbeddedResource output described below.
91
+
92
+ **Custom Schema scope:** ordinary props schemas with `type: "object"` and
93
+ compatible nested objects, arrays, unions, and local references are supported,
94
+ as are boolean `true`/`false` schemas. Source `$schema` must be omitted or be
95
+ `http://json-schema.org/draft-07/schema#`. Protocol-common fields
96
+ `id/component/accessibility/weight` must not be declared in props. Complex root
97
+ constraints or root references, IDs/anchors/external references, references back
98
+ to the augmented props root, incompatible dialect keywords (such as Draft 7
99
+ tuple items or dependencies), validation siblings of `$ref`, and duplicate
100
+ component names produce a targeted error recommending discovery. The full
101
+ [Core boundary](../ui-core/README.md#standalone-send-definition-inline-schema-delivery)
102
+ is intentionally conservative; discovery and normalizer support are unchanged.
103
+
104
+ ## Project A2UI-over-MCP contract
105
+
106
+ `send_ui_to_client` transports A2UI messages, while `get_ui_catalog` is this
107
+ project's discovery contract; it is not an official A2UI-over-MCP tool.
48
108
 
49
109
  A successful `send_ui_to_client` call always returns fallback text followed by
50
110
  one canonical A2UI embedded resource:
@@ -82,6 +142,11 @@ the parsed carrier against its configured Catalog and the call's optional
82
142
  resource URI. Whitespace and object-key order may differ; malformed, divergent,
83
143
  or protocol-invalid representations become tool errors.
84
144
 
145
+ A successful `get_ui_catalog` call exposes its complete logical result through
146
+ both MCP result channels. The text content item's `text` is the JSON serialization
147
+ of that result, and `structuredContent` contains the same full logical object.
148
+ Neither representation is a reduced schema-only projection.
149
+
85
150
  ### Catalog capability negotiation
86
151
 
87
152
  Before accepting UI, the server requires the client to advertise the exact
@@ -222,8 +287,7 @@ A custom catalog can be loaded from an ESM module:
222
287
  ```bash
223
288
  ax-ui-mcp \
224
289
  --transport http \
225
- --catalog ./weather-catalog.js \
226
- --catalog-instruction-mode compact
290
+ --catalog ./weather-catalog.js
227
291
  ```
228
292
 
229
293
  The CLI generates `v0.9.1` instructions and accepts only
@@ -246,21 +310,22 @@ export const catalog = {
246
310
  };
247
311
  ```
248
312
 
249
- The normal agent flow is:
313
+ ## Agent workflow
314
+
315
+ The default discovery flow is:
250
316
 
251
317
  ```ts
252
- // Step 1a: discover what the catalog has. With no componentNames the server
253
- // returns the directory — every component name with one line on what it is for
254
- // — and no schemas, so discovery costs a listing rather than the catalog.
318
+ // Step 1a: discover the catalog. With no componentNames, catalog.kind is
319
+ // "directory", componentPurposes is complete, and component definitions
320
+ // are absent.
255
321
  get_ui_catalog();
256
322
 
257
- // Step 1b: fetch instructions and schemas for the components this UI needs.
258
- // Use instructionMode: "full" when exact fields are needed.
259
- // Name a function in functionNames only when the UI actually calls it.
323
+ // Step 1b: request a "selection". Structured JSON Schema is placed under
324
+ // catalog.definitions, including its shared $defs reference context.
325
+ // Request function definitions only for functions the UI calls.
260
326
  get_ui_catalog({
261
327
  componentNames: ["Card", "Text", "WeatherIcon"],
262
- functionNames: ["formatDate"],
263
- instructionMode: "full"
328
+ functionNames: ["formatDate"]
264
329
  });
265
330
 
266
331
  // Step 2: submit messages built from the catalog returned by get_ui_catalog.
@@ -282,53 +347,55 @@ the configured catalog. Once the Host forwards these messages to its Runtime, a
282
347
  `surfaceId` must be unique among active surfaces: a duplicate active
283
348
  `createSurface` is an error, while an ID may be reused after `deleteSurface`.
284
349
 
285
- `componentNames` is what narrows the response: supply it and the server returns
286
- only those basic and custom component schemas.
287
-
288
- Function schemas are opt-in and are *not* covered by `componentNames`. Components
289
- never reference functions through `$ref`, so no component selection can narrow
290
- them — they have to be named. The instructions always list every function with
291
- its arguments, so an agent can see what exists and then request only the schemas
292
- it needs via `functionNames`. Omit `functionNames` when the UI calls no
293
- functions. This works in both instruction modes, and with or without
294
- `componentNames`: an explicitly requested function schema is returned even in
295
- `"compact"` (which otherwise emits no schemas at all) and even on a directory
296
- call.
297
-
298
- The returned `descriptor` carries component schemas only. The catalog's
299
- `styleGuide` and `examples` are prose that `instructions` already renders, so
300
- repeating them in `descriptor` would have doubled every response; the
301
- `a2ui://catalog` resource still carries the descriptor whole.
302
-
303
- `get_ui_catalog` returns `componentPurposes` on every call — a
304
- `componentName -> what it is for` map covering base and custom components
305
- together, regardless of what the call requested. Component names alone do not say
306
- when to reach for `Tabs` over `List`, or `Card` over `Column`, and field rules
307
- only help once the component is already chosen. Keeping the whole directory in
308
- view also means an agent that under-selected can see what it missed and widen
309
- with a second call, instead of quietly building something worse out of the
310
- components it already has. For custom components the prose is the descriptor's
311
- `description`.
312
-
313
- `get_ui_catalog` returns compact instructions by default. Pass
314
- `instructionMode: "full"` when the agent needs the authoritative JSON schema in
315
- the instructions; this is more precise but costs more tokens. Server owners can
316
- change the default with `createUIMCPServer({ catalogInstructionMode: "full" })`
317
- or the CLI flag `--catalog-instruction-mode full`.
350
+ `componentNames` selects the result variant. When omitted, `catalog.kind` is
351
+ `"directory"` and the result contains the complete `componentPurposes` map. It
352
+ contains no component definitions; if `functionNames` is explicitly supplied,
353
+ `catalog.definitions` contains the requested functions and their shared reference
354
+ context. Component purposes and lightweight function discovery are retained.
355
+
356
+ When `componentNames` is present, `catalog.kind` is `"selection"`. It omits
357
+ `componentPurposes` and does not expose a model-facing descriptor.
358
+ `catalog.definitions` contains `componentNames`, `functionNames`, `$defs`,
359
+ optional `basicComponents`, and `customComponents` / `functions` maps.
360
+ `basicComponents` always uses `{ format: "json-schema", schema: object }`.
361
+
362
+ Generated Basic and function `$ref` values resolve from **the entire
363
+ `catalog.definitions` object**, not from the internal Basic Schema:
364
+
365
+ - Basic component bodies occur only in `basicComponents.schema.components`.
366
+ - Function bodies occur only in `functions`; the shared `anyFunction` selector
367
+ points to the requested `#/functions/<name>` entries.
368
+ - `$defs.common` carries the Common types document, and `$defs.catalog.$defs`
369
+ carries Catalog shared definitions. The internal Basic Schema has no duplicate
370
+ `$defs` or `functions` and is not independently self-contained.
371
+ - Custom props schemas remain unchanged, with local references resolved from each
372
+ Custom schema's own document root. Inline's Custom projection limits do not
373
+ apply to these raw discovery schemas.
374
+
375
+ Function definitions remain opt-in through `functionNames` and are independent
376
+ of component selection. Omitting `functionNames` returns no function definitions.
377
+ Function-only queries, Custom-only selections with functions, and empty function
378
+ selections use the same shared context.
379
+
380
+ `instructions` refers to `catalog.definitions` and does not contain JSON Schema
381
+ dumps. MCP text and `structuredContent` carry the same logical bundle; delivery
382
+ selection does not change validation constraints.
318
383
 
319
384
  `send_ui_to_client` accepts structured messages. Do not pass `ui_json`, do not
320
385
  serialize the message list into a JSON string, and do not pass static catalog
321
386
  schema such as `customComponents` in the tool call.
322
387
 
323
- `send_ui_to_client` is the final submission tool, not the schema discovery
324
- tool. Agents should call `get_ui_catalog` before using it, then build component
325
- objects from the returned catalog schema.
388
+ In discovery mode, `send_ui_to_client` is the final submission tool, not the
389
+ schema source: call `get_ui_catalog` first and build components from
390
+ `catalog.definitions`. In inline mode, build the same arguments directly from
391
+ the send tool's `inputSchema`; no get tool is registered.
326
392
 
327
393
  The catalog is also exposed as an MCP resource with media type
328
394
  `application/json`. This remains JSON catalog metadata, not an A2UI message, so
329
- the A2UI message media types do not apply. Resources are read by hosts and
330
- clients rather than picked from by a model, so this payload carries every
331
- component and function:
395
+ the A2UI message media types do not apply. Resources are read by Hosts and
396
+ clients rather than selected from by a model, so this payload remains complete
397
+ Host-facing metadata: it carries every component, every function, and the full
398
+ descriptor, including `styleGuide` and `examples`:
332
399
 
333
400
  ```text
334
401
  a2ui://catalog
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const _0x4b7a93=_0xff34;(function(_0x2e2497,_0x12a447){const _0x1d08f8=_0xff34,_0x3ae03d=_0x2e2497();while(!![]){try{const _0x340c69=parseInt(_0x1d08f8(0x1a6))/0x1+parseInt(_0x1d08f8(0x1b9))/0x2+-parseInt(_0x1d08f8(0x1c8))/0x3+-parseInt(_0x1d08f8(0x1d2))/0x4+parseInt(_0x1d08f8(0x1d7))/0x5*(parseInt(_0x1d08f8(0x1cb))/0x6)+-parseInt(_0x1d08f8(0x1b8))/0x7*(-parseInt(_0x1d08f8(0x1d3))/0x8)+-parseInt(_0x1d08f8(0x1e0))/0x9;if(_0x340c69===_0x12a447)break;else _0x3ae03d['push'](_0x3ae03d['shift']());}catch(_0x3943d8){_0x3ae03d['push'](_0x3ae03d['shift']());}}}(_0x5e89,0x84505));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS}from'@agentic-ui-experience/ui-core';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createUIMCPServer}from'./index.js';const helpText=_0x4b7a93(0x1b0);function stringValue(_0x5de918,_0x1628c8){const _0x2a8120=_0x4b7a93;return typeof _0x5de918==='string'&&_0x5de918[_0x2a8120(0x1aa)]>0x0?_0x5de918:_0x1628c8;}function _0x5e89(){const _0x3b1840=['Access-Control-Allow-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\x20the\x20CatalogPromptDescriptor\x20to\x20serve.\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\x20Defaults\x20to\x20the\x20A2UI\x20basic\x20catalog.\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--protocol-version\x20<v0.9.1>\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\x20A2UI\x20version\x20requested\x20in\x20generated\x20UI.\x20Default:\x20v0.9.1\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\x0aA\x20server\x20serves\x20exactly\x20one\x20catalog,\x20matching\x20A2UI\x27s\x20model\x20where\x20a\x20surface\x27s\x0acatalog\x20is\x20fixed\x20at\x20createSurface\x20time.\x20Combine\x20vocabularies\x20when\x20you\x20define\x20the\x0acatalog,\x20not\x20at\x20runtime.\x0a\x0aA2UI\x20clients\x20must\x20declare\x20clientCapabilities[\x22v0.9\x22].supportedCatalogIds\x20with\x0athis\x20server\x27s\x20exact\x20Catalog\x20ID.\x20Stateful\x20clients\x20send\x20it\x20in\x20initialize\x0acapabilities.a2ui.\x20This\x20HTTP\x20server\x20is\x20stateless,\x20so\x20every\x20send_ui_to_client\x20call\x0amust\x20also\x20carry\x20the\x20declaration\x20in\x20_meta.a2ui.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a','name','serverVersion','pathname','default','setHeader','baseComponentNames','SIGINT','5477346pmZpZS','889036wwUPfW','http','SIGTERM','write','values','statusCode','headersSent','2.0','protocolVersion','endpoint','GET,POST,DELETE,OPTIONS','Unsupported\x20transport\x20\x22','stdio','OPTIONS','stderr','2937141GtrzLS','stdout','isArray','378kiQqaU','Catalog\x20module\x20\x22','message','Access-Control-Allow-Headers','localhost','Origin','\x20or\x20','2953920PYIbXn','8PCCdKU','stringify','end','Mcp-Session-Id','51090gTGnQq','3001','help','headers','\x22\x20exported\x20','href','string','close','host','1644849gIfQZQ','serverName','\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.','origin','connect','boolean','error','571515JDcqon','catalogInstructionMode','protocol-version','map','length','\x22.\x20Expected\x20','corsOrigins','Access-Control-Allow-Methods','listen'];_0x5e89=function(){return _0x3b1840;};return _0x5e89();}function optionalStringValue(_0x546d77){const _0x4c2e07=_0x4b7a93;return typeof _0x546d77==='string'&&_0x546d77[_0x4c2e07(0x1aa)]>0x0?_0x546d77:void 0x0;}function stringArrayValue(_0x54e7be){const _0x41fa44=_0x4b7a93;if(Array[_0x41fa44(0x1ca)](_0x54e7be))return _0x54e7be;if(typeof _0x54e7be==='string'&&_0x54e7be['length']>0x0)return[_0x54e7be];return[];}function parseTransport(_0x455d06){const _0x279517=_0x4b7a93;if(_0x455d06==='stdio'||_0x455d06===_0x279517(0x1ba))return _0x455d06;throw new Error(_0x279517(0x1c4)+_0x455d06+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function parseCatalogInstructionMode(_0x470c49){if(_0x470c49==='compact'||_0x470c49==='full')return _0x470c49;throw new Error('Unsupported\x20catalog\x20instruction\x20mode\x20\x22'+_0x470c49+'\x22.\x20Expected\x20\x22compact\x22\x20or\x20\x22full\x22.');}function parseProtocolVersion(_0x36d24d){const _0x100f16=_0x4b7a93;if(A2UI_SUPPORTED_PROTOCOL_VERSIONS['some'](_0x3c571a=>_0x3c571a===_0x36d24d))return _0x36d24d;throw new Error('Unsupported\x20protocol\x20version\x20\x22'+_0x36d24d+_0x100f16(0x1ab)+A2UI_SUPPORTED_PROTOCOL_VERSIONS[_0x100f16(0x1a9)](_0x43652d=>'\x22'+_0x43652d+'\x22')['join'](_0x100f16(0x1d1))+'.');}function parsePort(_0x3539ea){const _0x34d721=Number(_0x3539ea);if(!Number['isInteger'](_0x34d721)||_0x34d721<0x1||_0x34d721>0xffff)throw new Error('Invalid\x20--port\x20\x22'+_0x3539ea+'\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.');return _0x34d721;}function normalizeEndpoint(_0x18733e){if(!_0x18733e['startsWith']('/'))return'/'+_0x18733e;return _0x18733e;}function isCatalogDescriptor(_0x43f63d){const _0x530a41=_0x4b7a93;return!!_0x43f63d&&typeof _0x43f63d==='object'&&!Array[_0x530a41(0x1ca)](_0x43f63d)&&typeof _0x43f63d['id']==='string'&&Array['isArray'](_0x43f63d[_0x530a41(0x1b6)]);}function readCatalogExport(_0x3626b2,_0x12367f){const _0x402f36=_0x4b7a93,_0x168334=_0x3626b2['catalogs']??_0x3626b2['catalog']??_0x3626b2[_0x402f36(0x1b4)];if(Array[_0x402f36(0x1ca)](_0x168334)){if(_0x168334[_0x402f36(0x1aa)]!==0x1)throw new Error(_0x402f36(0x1cc)+_0x12367f+_0x402f36(0x1db)+_0x168334['length']+'\x20catalogs.\x20A\x20server\x20serves\x20exactly\x20one;\x20merge\x20them\x20into\x20a\x20single\x20descriptor.');const [_0x5c8c76]=_0x168334;if(!isCatalogDescriptor(_0x5c8c76))throw new Error('Catalog\x20module\x20\x22'+_0x12367f+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');return _0x5c8c76;}if(_0x168334===void 0x0)throw new Error('Catalog\x20module\x20\x22'+_0x12367f+'\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.');if(!isCatalogDescriptor(_0x168334))throw new Error('Catalog\x20module\x20\x22'+_0x12367f+_0x402f36(0x1e2));return _0x168334;}async function loadCatalog(_0x201606){const _0x1589c5=_0x4b7a93;if(_0x201606===void 0x0)return void 0x0;const _0x46ed8f=await import(pathToFileURL(resolve(_0x201606))[_0x1589c5(0x1dc)]);return readCatalogExport(_0x46ed8f,_0x201606);}async function parseCliOptions(){const _0x297d5e=_0x4b7a93,_0x13d9ad=parseArgs({'allowPositionals':![],'options':{'transport':{'type':_0x297d5e(0x1dd)},'host':{'type':_0x297d5e(0x1dd)},'port':{'type':_0x297d5e(0x1dd)},'endpoint':{'type':_0x297d5e(0x1dd)},'cors-origin':{'type':_0x297d5e(0x1dd),'multiple':!![]},'catalog':{'type':_0x297d5e(0x1dd)},'catalog-instruction-mode':{'type':'string'},'protocol-version':{'type':_0x297d5e(0x1dd)},'name':{'type':'string'},'version':{'type':_0x297d5e(0x1dd)},'help':{'type':_0x297d5e(0x1a4),'short':'h'}}});_0x13d9ad['values'][_0x297d5e(0x1d9)]&&(process[_0x297d5e(0x1c9)][_0x297d5e(0x1bc)](helpText),process['exit'](0x0));const _0x100b67=await loadCatalog(optionalStringValue(_0x13d9ad[_0x297d5e(0x1bd)]['catalog'])),_0x55099a=optionalStringValue(_0x13d9ad[_0x297d5e(0x1bd)][_0x297d5e(0x1a8)]);return{'transport':parseTransport(stringValue(_0x13d9ad[_0x297d5e(0x1bd)]['transport'],'stdio')),'host':stringValue(_0x13d9ad['values'][_0x297d5e(0x1df)],'127.0.0.1'),'port':parsePort(stringValue(_0x13d9ad['values']['port'],_0x297d5e(0x1d8))),'endpoint':normalizeEndpoint(stringValue(_0x13d9ad['values'][_0x297d5e(0x1c2)],'/mcp')),'corsOrigins':stringArrayValue(_0x13d9ad['values']['cors-origin']),..._0x100b67?{'catalog':_0x100b67}:{},'catalogInstructionMode':parseCatalogInstructionMode(stringValue(_0x13d9ad['values']['catalog-instruction-mode'],'compact')),..._0x55099a?{'protocolVersion':parseProtocolVersion(_0x55099a)}:{},...optionalStringValue(_0x13d9ad[_0x297d5e(0x1bd)][_0x297d5e(0x1b1)])?{'serverName':optionalStringValue(_0x13d9ad[_0x297d5e(0x1bd)][_0x297d5e(0x1b1)])}:{},...optionalStringValue(_0x13d9ad['values']['version'])?{'serverVersion':optionalStringValue(_0x13d9ad[_0x297d5e(0x1bd)]['version'])}:{}};}function createServerOptions(_0x2d1b13){const _0x5f0665=_0x4b7a93;return{..._0x2d1b13['catalog']?{'catalog':_0x2d1b13['catalog']}:{},..._0x2d1b13[_0x5f0665(0x1a7)]?{'catalogInstructionMode':_0x2d1b13[_0x5f0665(0x1a7)]}:{},..._0x2d1b13[_0x5f0665(0x1c1)]?{'protocolVersion':_0x2d1b13[_0x5f0665(0x1c1)]}:{},'server':{..._0x2d1b13[_0x5f0665(0x1e1)]?{'name':_0x2d1b13['serverName']}:{},..._0x2d1b13[_0x5f0665(0x1b2)]?{'version':_0x2d1b13['serverVersion']}:{}}};}function setCorsHeaders(_0x4319eb,_0x1888bd,_0xf926a8){const _0x1124bf=_0x4b7a93;if(_0xf926a8[_0x1124bf(0x1aa)]===0x0)return;const _0x8f8d4a=_0x4319eb[_0x1124bf(0x1da)][_0x1124bf(0x1e3)],_0xe5b43e=_0xf926a8['includes']('*'),_0x33130b=_0xe5b43e?'*':typeof _0x8f8d4a==='string'&&_0xf926a8['includes'](_0x8f8d4a)?_0x8f8d4a:void 0x0;if(!_0x33130b)return;_0x1888bd['setHeader'](_0x1124bf(0x1af),_0x33130b),_0x1888bd[_0x1124bf(0x1b5)]('Vary',_0x1124bf(0x1d0)),_0x1888bd[_0x1124bf(0x1b5)](_0x1124bf(0x1ad),_0x1124bf(0x1c3)),_0x1888bd['setHeader'](_0x1124bf(0x1ce),'Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID'),_0x1888bd[_0x1124bf(0x1b5)]('Access-Control-Expose-Headers',_0x1124bf(0x1d6));}function _0xff34(_0x2d7dda,_0x1988a1){_0x2d7dda=_0x2d7dda-0x1a4;const _0x5e89d1=_0x5e89();let _0xff3486=_0x5e89d1[_0x2d7dda];return _0xff3486;}function writeJsonRpcError(_0x51e12c,_0x2971a1,_0x673d3d){const _0x33ae5e=_0x4b7a93;_0x51e12c['statusCode']=_0x2971a1,_0x51e12c[_0x33ae5e(0x1b5)]('content-type','application/json'),_0x51e12c['end'](JSON[_0x33ae5e(0x1d4)]({'jsonrpc':_0x33ae5e(0x1c0),'error':{'code':-0x7f5b,'message':_0x673d3d},'id':null}));}async function startStdio(_0x4d1d1c){const _0x38ce3d=createUIMCPServer(createServerOptions(_0x4d1d1c));await _0x38ce3d['connect'](new StdioServerTransport());}async function startHttp(_0x37f7fe){const _0x4f672c=_0x4b7a93,_0x1228d7=createServer(async(_0x494a84,_0x4727d4)=>{const _0x40f1a2=_0xff34,_0x42d77e=new URL(_0x494a84['url']??'/','http://'+(_0x494a84[_0x40f1a2(0x1da)][_0x40f1a2(0x1df)]??_0x40f1a2(0x1cf)));if(_0x42d77e[_0x40f1a2(0x1b3)]!==_0x37f7fe[_0x40f1a2(0x1c2)]){_0x4727d4[_0x40f1a2(0x1be)]=0x194,_0x4727d4['end']('Not\x20Found');return;}setCorsHeaders(_0x494a84,_0x4727d4,_0x37f7fe[_0x40f1a2(0x1ac)]);if(_0x494a84['method']===_0x40f1a2(0x1c6)){_0x4727d4[_0x40f1a2(0x1be)]=0xcc,_0x4727d4[_0x40f1a2(0x1d5)]();return;}const _0x74311e=createUIMCPServer(createServerOptions(_0x37f7fe)),_0x2d62fa=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});try{await _0x74311e[_0x40f1a2(0x1e4)](_0x2d62fa),await _0x2d62fa['handleRequest'](_0x494a84,_0x4727d4),_0x4727d4['on'](_0x40f1a2(0x1de),()=>{const _0x2760b3=_0x40f1a2;void _0x2d62fa['close'](),void _0x74311e[_0x2760b3(0x1de)]();});}catch(_0xba0a18){console['error']('[@agentic-ui-experience/ui-mcp]\x20request\x20failed',_0xba0a18),!_0x4727d4[_0x40f1a2(0x1bf)]&&writeJsonRpcError(_0x4727d4,0x1f4,_0xba0a18 instanceof Error?_0xba0a18[_0x40f1a2(0x1cd)]:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x293e62,_0x354c1a)=>{const _0x2a8948=_0xff34;_0x1228d7['once'](_0x2a8948(0x1a5),_0x354c1a),_0x1228d7[_0x2a8948(0x1ae)](_0x37f7fe['port'],_0x37f7fe[_0x2a8948(0x1df)],_0x293e62);});const _0x25c8bf=()=>{_0x1228d7['close'](()=>process['exit'](0x0));};process['once'](_0x4f672c(0x1b7),_0x25c8bf),process['once'](_0x4f672c(0x1bb),_0x25c8bf),process['stderr']['write']('@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://'+_0x37f7fe['host']+':'+_0x37f7fe['port']+_0x37f7fe['endpoint']+'\x0a');}async function main(){const _0x251bf0=_0x4b7a93,_0x19a980=await parseCliOptions();if(_0x19a980['transport']===_0x251bf0(0x1c5)){await startStdio(_0x19a980);return;}await startHttp(_0x19a980);}main()['catch'](_0x53def5=>{const _0x55dc6f=_0x4b7a93;process[_0x55dc6f(0x1c7)][_0x55dc6f(0x1bc)]((_0x53def5 instanceof Error?_0x53def5[_0x55dc6f(0x1cd)]:String(_0x53def5))+'\x0a'),process['exit'](0x1);});
2
+ function _0x109b(){const _0x461cf5=['2.0','OPTIONS','Vary','@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\x20the\x20CatalogPromptDescriptor\x20to\x20serve.\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\x20Defaults\x20to\x20the\x20A2UI\x20basic\x20catalog.\x0a\x20\x20--schema-delivery\x20<discovery|inline>\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:\x20discovery\x20(get_ui_catalog\x20+\x20send_ui_to_client).\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\x20Inline\x20exposes\x20only\x20send_ui_to_client,\x20with\x20its\x20full\x20inputSchema.\x0a\x20\x20--protocol-version\x20<v0.9.1>\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\x20A2UI\x20version\x20requested\x20in\x20generated\x20UI.\x20Default:\x20v0.9.1\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\x0aA\x20server\x20serves\x20exactly\x20one\x20catalog,\x20matching\x20A2UI\x27s\x20model\x20where\x20a\x20surface\x27s\x0acatalog\x20is\x20fixed\x20at\x20createSurface\x20time.\x20Combine\x20vocabularies\x20when\x20you\x20define\x20the\x0acatalog,\x20not\x20at\x20runtime.\x0a\x0aA2UI\x20clients\x20must\x20declare\x20clientCapabilities[\x22v0.9\x22].supportedCatalogIds\x20with\x0athis\x20server\x27s\x20exact\x20Catalog\x20ID.\x20Stateful\x20clients\x20send\x20it\x20in\x20initialize\x0acapabilities.a2ui.\x20This\x20HTTP\x20server\x20is\x20stateless,\x20so\x20every\x20send_ui_to_client\x20call\x0amust\x20also\x20carry\x20the\x20declaration\x20in\x20_meta.a2ui.\x0a\x0aCatalog\x20modules\x20may\x20export\x20one\x20of:\x0a\x20\x20export\x20default\x20descriptor\x0a\x20\x20export\x20const\x20catalog\x20=\x20descriptor\x0a','protocolVersion','endpoint','8WUwrXI','transport','host','setHeader','write','connect','325107tRVLGT','/mcp','error','isArray','stdio','SIGTERM','string','schemaDelivery','name','http://','once','29570670yKmUrK','Unsupported\x20protocol\x20version\x20\x22','message','\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.','url','length','4BfRKuO','statusCode','href','http','SIGINT','Mcp-Session-Id','Access-Control-Allow-Methods','method','cors-origin','917275LunIDV','catch','@agentic-ui-experience/ui-mcp\x20listening\x20on\x20http://','serverVersion','Unsupported\x20schema\x20delivery\x20\x22','Catalog\x20module\x20\x22','2594006fvbJZV','pathname','isInteger','includes','30FIWxiU','end','close','map','211138FCayxf','headersSent','inline','join','default','\x22\x20did\x20not\x20export\x20a\x20catalog\x20descriptor.','headers','3600945BNeYRA','version','values','exit','Invalid\x20--port\x20\x22','catalog','9173780xumrUu','catalogs'];_0x109b=function(){return _0x461cf5;};return _0x109b();}const _0x59a8f5=_0x27cc;(function(_0x2510df,_0x5551ad){const _0x46ea4e=_0x27cc,_0x5a383d=_0x2510df();while(!![]){try{const _0x45cdf7=parseInt(_0x46ea4e(0x143))/0x1+-parseInt(_0x46ea4e(0x13b))/0x2+-parseInt(_0x46ea4e(0x14a))/0x3*(-parseInt(_0x46ea4e(0x16f))/0x4)+parseInt(_0x46ea4e(0x135))/0x5*(-parseInt(_0x46ea4e(0x13f))/0x6)+-parseInt(_0x46ea4e(0x150))/0x7+-parseInt(_0x46ea4e(0x158))/0x8*(parseInt(_0x46ea4e(0x15e))/0x9)+parseInt(_0x46ea4e(0x169))/0xa;if(_0x45cdf7===_0x5551ad)break;else _0x5a383d['push'](_0x5a383d['shift']());}catch(_0x2900bd){_0x5a383d['push'](_0x5a383d['shift']());}}}(_0x109b,0xc529b));import{createServer}from'node:http';import{resolve}from'node:path';import{pathToFileURL}from'node:url';import{parseArgs}from'node:util';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS}from'@agentic-ui-experience/ui-core';import{StreamableHTTPServerTransport}from'@modelcontextprotocol/sdk/server/streamableHttp.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{createUIMCPServer}from'./index.js';const helpText=_0x59a8f5(0x155);function stringValue(_0x54e53e,_0x5b66be){const _0x14e265=_0x59a8f5;return typeof _0x54e53e===_0x14e265(0x164)&&_0x54e53e[_0x14e265(0x16e)]>0x0?_0x54e53e:_0x5b66be;}function optionalStringValue(_0xd83407){const _0x38b427=_0x59a8f5;return typeof _0xd83407===_0x38b427(0x164)&&_0xd83407['length']>0x0?_0xd83407:void 0x0;}function stringArrayValue(_0x47d9c2){const _0x3d683a=_0x59a8f5;if(Array[_0x3d683a(0x161)](_0x47d9c2))return _0x47d9c2;if(typeof _0x47d9c2===_0x3d683a(0x164)&&_0x47d9c2['length']>0x0)return[_0x47d9c2];return[];}function parseTransport(_0x5e5e11){const _0xf20900=_0x59a8f5;if(_0x5e5e11==='stdio'||_0x5e5e11===_0xf20900(0x172))return _0x5e5e11;throw new Error('Unsupported\x20transport\x20\x22'+_0x5e5e11+'\x22.\x20Expected\x20\x22stdio\x22\x20or\x20\x22http\x22.');}function parseSchemaDelivery(_0x5ac268){const _0x4e35f0=_0x59a8f5;if(_0x5ac268==='discovery'||_0x5ac268===_0x4e35f0(0x145))return _0x5ac268;throw new Error(_0x4e35f0(0x139)+_0x5ac268+_0x4e35f0(0x16c));}function parseProtocolVersion(_0x1a5106){const _0x256b91=_0x59a8f5;if(A2UI_SUPPORTED_PROTOCOL_VERSIONS['some'](_0xae881e=>_0xae881e===_0x1a5106))return _0x1a5106;throw new Error(_0x256b91(0x16a)+_0x1a5106+'\x22.\x20Expected\x20'+A2UI_SUPPORTED_PROTOCOL_VERSIONS[_0x256b91(0x142)](_0x5a5db9=>'\x22'+_0x5a5db9+'\x22')[_0x256b91(0x146)]('\x20or\x20')+'.');}function parsePort(_0x20fb30){const _0x311520=_0x59a8f5,_0x539c83=Number(_0x20fb30);if(!Number[_0x311520(0x13d)](_0x539c83)||_0x539c83<0x1||_0x539c83>0xffff)throw new Error(_0x311520(0x14e)+_0x20fb30+'\x22.\x20Expected\x20an\x20integer\x20from\x201\x20to\x2065535.');return _0x539c83;}function _0x27cc(_0x2d6deb,_0x444ad8){_0x2d6deb=_0x2d6deb-0x134;const _0x109b6b=_0x109b();let _0x27cc96=_0x109b6b[_0x2d6deb];return _0x27cc96;}function normalizeEndpoint(_0x1b9550){if(!_0x1b9550['startsWith']('/'))return'/'+_0x1b9550;return _0x1b9550;}function isCatalogDescriptor(_0x244618){const _0x2e9ffd=_0x59a8f5;return!!_0x244618&&typeof _0x244618==='object'&&!Array[_0x2e9ffd(0x161)](_0x244618)&&typeof _0x244618['id']==='string'&&Array['isArray'](_0x244618['baseComponentNames']);}function readCatalogExport(_0x1e0ab3,_0x2fb181){const _0x8292b6=_0x59a8f5,_0x3e2709=_0x1e0ab3[_0x8292b6(0x151)]??_0x1e0ab3[_0x8292b6(0x14f)]??_0x1e0ab3[_0x8292b6(0x147)];if(Array[_0x8292b6(0x161)](_0x3e2709)){if(_0x3e2709[_0x8292b6(0x16e)]!==0x1)throw new Error('Catalog\x20module\x20\x22'+_0x2fb181+'\x22\x20exported\x20'+_0x3e2709['length']+'\x20catalogs.\x20A\x20server\x20serves\x20exactly\x20one;\x20merge\x20them\x20into\x20a\x20single\x20descriptor.');const [_0x4f2dba]=_0x3e2709;if(!isCatalogDescriptor(_0x4f2dba))throw new Error(_0x8292b6(0x13a)+_0x2fb181+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');return _0x4f2dba;}if(_0x3e2709===void 0x0)throw new Error(_0x8292b6(0x13a)+_0x2fb181+_0x8292b6(0x148));if(!isCatalogDescriptor(_0x3e2709))throw new Error('Catalog\x20module\x20\x22'+_0x2fb181+'\x22\x20exported\x20an\x20invalid\x20catalog\x20descriptor.');return _0x3e2709;}async function loadCatalog(_0x3a1e9f){const _0x15dbc3=_0x59a8f5;if(_0x3a1e9f===void 0x0)return void 0x0;const _0x1c98ba=await import(pathToFileURL(resolve(_0x3a1e9f))[_0x15dbc3(0x171)]);return readCatalogExport(_0x1c98ba,_0x3a1e9f);}async function parseCliOptions(){const _0x1328b7=_0x59a8f5,_0x119f57=parseArgs({'allowPositionals':![],'options':{'transport':{'type':'string'},'host':{'type':'string'},'port':{'type':'string'},'endpoint':{'type':_0x1328b7(0x164)},'cors-origin':{'type':'string','multiple':!![]},'catalog':{'type':'string'},'schema-delivery':{'type':_0x1328b7(0x164)},'protocol-version':{'type':'string'},'name':{'type':_0x1328b7(0x164)},'version':{'type':_0x1328b7(0x164)},'help':{'type':'boolean','short':'h'}}});_0x119f57[_0x1328b7(0x14c)]['help']&&(process['stdout'][_0x1328b7(0x15c)](helpText),process[_0x1328b7(0x14d)](0x0));const _0xc6cb62=parseSchemaDelivery(_0x119f57['values']['schema-delivery']??'discovery'),_0x2dd175=await loadCatalog(optionalStringValue(_0x119f57['values'][_0x1328b7(0x14f)])),_0xb3f5f8=optionalStringValue(_0x119f57['values']['protocol-version']);return{'transport':parseTransport(stringValue(_0x119f57['values']['transport'],_0x1328b7(0x162))),'host':stringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x15a)],'127.0.0.1'),'port':parsePort(stringValue(_0x119f57['values']['port'],'3001')),'endpoint':normalizeEndpoint(stringValue(_0x119f57['values'][_0x1328b7(0x157)],_0x1328b7(0x15f))),'corsOrigins':stringArrayValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x134)]),..._0x2dd175?{'catalog':_0x2dd175}:{},'schemaDelivery':_0xc6cb62,..._0xb3f5f8?{'protocolVersion':parseProtocolVersion(_0xb3f5f8)}:{},...optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x166)])?{'serverName':optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x166)])}:{},...optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x14b)])?{'serverVersion':optionalStringValue(_0x119f57[_0x1328b7(0x14c)][_0x1328b7(0x14b)])}:{}};}function createServerOptions(_0x540165){const _0xe02416=_0x59a8f5;return{..._0x540165['catalog']?{'catalog':_0x540165['catalog']}:{},'schemaDelivery':_0x540165[_0xe02416(0x165)],..._0x540165[_0xe02416(0x156)]?{'protocolVersion':_0x540165['protocolVersion']}:{},'server':{..._0x540165['serverName']?{'name':_0x540165['serverName']}:{},..._0x540165[_0xe02416(0x138)]?{'version':_0x540165['serverVersion']}:{}}};}function setCorsHeaders(_0x4e23ae,_0x57233a,_0x560add){const _0x79f9b6=_0x59a8f5;if(_0x560add['length']===0x0)return;const _0x1c20b3=_0x4e23ae[_0x79f9b6(0x149)]['origin'],_0x5af570=_0x560add[_0x79f9b6(0x13e)]('*'),_0x18ca0c=_0x5af570?'*':typeof _0x1c20b3===_0x79f9b6(0x164)&&_0x560add['includes'](_0x1c20b3)?_0x1c20b3:void 0x0;if(!_0x18ca0c)return;_0x57233a[_0x79f9b6(0x15b)]('Access-Control-Allow-Origin',_0x18ca0c),_0x57233a[_0x79f9b6(0x15b)](_0x79f9b6(0x154),'Origin'),_0x57233a['setHeader'](_0x79f9b6(0x175),'GET,POST,DELETE,OPTIONS'),_0x57233a['setHeader']('Access-Control-Allow-Headers','Content-Type,\x20Accept,\x20Authorization,\x20MCP-Protocol-Version,\x20Mcp-Session-Id,\x20Last-Event-ID'),_0x57233a[_0x79f9b6(0x15b)]('Access-Control-Expose-Headers',_0x79f9b6(0x174));}function writeJsonRpcError(_0x1073dd,_0x39bab8,_0x549e86){const _0xeda998=_0x59a8f5;_0x1073dd[_0xeda998(0x170)]=_0x39bab8,_0x1073dd['setHeader']('content-type','application/json'),_0x1073dd[_0xeda998(0x140)](JSON['stringify']({'jsonrpc':_0xeda998(0x152),'error':{'code':-0x7f5b,'message':_0x549e86},'id':null}));}async function startStdio(_0x408391){const _0x38b8eb=_0x59a8f5,_0x74d4c1=createUIMCPServer(createServerOptions(_0x408391));await _0x74d4c1[_0x38b8eb(0x15d)](new StdioServerTransport());}async function startHttp(_0x3ff71a){const _0x577fc2=_0x59a8f5,_0x2bca01=createServer(async(_0x4ee13b,_0x317771)=>{const _0x35f1d1=_0x27cc,_0xd11dc6=new URL(_0x4ee13b[_0x35f1d1(0x16d)]??'/',_0x35f1d1(0x167)+(_0x4ee13b['headers'][_0x35f1d1(0x15a)]??'localhost'));if(_0xd11dc6[_0x35f1d1(0x13c)]!==_0x3ff71a[_0x35f1d1(0x157)]){_0x317771['statusCode']=0x194,_0x317771['end']('Not\x20Found');return;}setCorsHeaders(_0x4ee13b,_0x317771,_0x3ff71a['corsOrigins']);if(_0x4ee13b[_0x35f1d1(0x176)]===_0x35f1d1(0x153)){_0x317771[_0x35f1d1(0x170)]=0xcc,_0x317771[_0x35f1d1(0x140)]();return;}try{const _0x340790=createUIMCPServer(createServerOptions(_0x3ff71a)),_0x4c7f7a=new StreamableHTTPServerTransport({'sessionIdGenerator':void 0x0});await _0x340790['connect'](_0x4c7f7a),await _0x4c7f7a['handleRequest'](_0x4ee13b,_0x317771),_0x317771['on'](_0x35f1d1(0x141),()=>{void _0x4c7f7a['close'](),void _0x340790['close']();});}catch(_0x5efc00){console['error']('[@agentic-ui-experience/ui-mcp]\x20request\x20failed',_0x5efc00),!_0x317771[_0x35f1d1(0x144)]&&writeJsonRpcError(_0x317771,0x1f4,_0x5efc00 instanceof Error?_0x5efc00[_0x35f1d1(0x16b)]:'Internal\x20MCP\x20server\x20error');}});await new Promise((_0x3c26e6,_0x49b7aa)=>{const _0x5c1437=_0x27cc;_0x2bca01['once'](_0x5c1437(0x160),_0x49b7aa),_0x2bca01['listen'](_0x3ff71a['port'],_0x3ff71a[_0x5c1437(0x15a)],_0x3c26e6);});const _0x41a428=()=>{const _0x453103=_0x27cc;_0x2bca01[_0x453103(0x141)](()=>process['exit'](0x0));};process[_0x577fc2(0x168)](_0x577fc2(0x173),_0x41a428),process['once'](_0x577fc2(0x163),_0x41a428),process['stderr']['write'](_0x577fc2(0x137)+_0x3ff71a[_0x577fc2(0x15a)]+':'+_0x3ff71a['port']+_0x3ff71a['endpoint']+'\x0a');}async function main(){const _0x296dd4=_0x59a8f5,_0x147f10=await parseCliOptions();if(_0x147f10[_0x296dd4(0x159)]==='stdio'){await startStdio(_0x147f10);return;}await startHttp(_0x147f10);}main()[_0x59a8f5(0x136)](_0x1199b2=>{const _0x3f5540=_0x59a8f5;process['stderr'][_0x3f5540(0x15c)]((_0x1199b2 instanceof Error?_0x1199b2[_0x3f5540(0x16b)]:String(_0x1199b2))+'\x0a'),process['exit'](0x1);});
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- const _0x5a8963=_0x8857;(function(_0x2b4be2,_0x3d56eb){const _0x8221aa=_0x8857,_0x10433e=_0x2b4be2();while(!![]){try{const _0x56eda9=parseInt(_0x8221aa(0x175))/0x1*(-parseInt(_0x8221aa(0x173))/0x2)+parseInt(_0x8221aa(0x17f))/0x3+-parseInt(_0x8221aa(0x172))/0x4*(-parseInt(_0x8221aa(0x177))/0x5)+-parseInt(_0x8221aa(0x178))/0x6*(parseInt(_0x8221aa(0x161))/0x7)+parseInt(_0x8221aa(0x171))/0x8*(parseInt(_0x8221aa(0x174))/0x9)+parseInt(_0x8221aa(0x15e))/0xa*(parseInt(_0x8221aa(0x17c))/0xb)+-parseInt(_0x8221aa(0x165))/0xc;if(_0x56eda9===_0x3d56eb)break;else _0x10433e['push'](_0x10433e['shift']());}catch(_0x3476ec){_0x10433e['push'](_0x10433e['shift']());}}}(_0x5340,0x4f150));import{A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer}from'@agentic-ui-experience/ui-core/tool-mode';function _0x5340(){const _0x5db93a=['MCP\x20tool\x20reported\x20an\x20error.','type','A2UI\x20client\x20capability\x20Catalog\x20IDs\x20must\x20be\x20non-empty\x20strings.','join','A2UI\x20embedded\x20resource\x20text\x20must\x20contain\x20valid\x20JSON.','filter','protocol','includes','2406568vcgady','10884XHiSwf','544982dRvjmn','9sqXTDR','1OMuYVc','trim','515yqZgYO','54dzGHTU','A2UI\x20embedded\x20resource\x20must\x20contain\x20text\x20content.','length','parse','775819UBlTvT','text','object','1297713xdRrDO','isArray','resource','40yuiayn','mimeType','MCP\x20tool\x20result\x20contains\x20multiple\x20A2UI\x20embedded\x20resources.','266861oLNkNA','content','a2ui/client-capabilities','string','4275036DidVYt','A2UI\x20client\x20capabilities\x20require\x20at\x20least\x20one\x20Catalog\x20ID.','uri','map'];_0x5340=function(){return _0x5db93a;};return _0x5340();}function _0x8857(_0x16d82a,_0x3043c2){_0x16d82a=_0x16d82a-0x15c;const _0x534028=_0x5340();let _0x88572e=_0x534028[_0x16d82a];return _0x88572e;}const A2UI_MCP_CAPABILITY_FAMILY='v0.9',A2UI_MCP_CAPABILITY_EXTENSION_ID=_0x5a8963(0x163);function isJsonObject(_0x338fb2){const _0x317741=_0x5a8963;return typeof _0x338fb2===_0x317741(0x17e)&&_0x338fb2!==null&&!Array[_0x317741(0x15c)](_0x338fb2);}function textErrorMessage(_0xc0eed3){const _0x1235b2=_0x5a8963;if(!Array[_0x1235b2(0x15c)](_0xc0eed3['content']))return'MCP\x20tool\x20reported\x20an\x20error.';const _0x2ef366=_0xc0eed3['content'][_0x1235b2(0x16e)](isJsonObject)[_0x1235b2(0x16e)](_0x244d18=>_0x244d18['type']===_0x1235b2(0x17d)&&typeof _0x244d18[_0x1235b2(0x17d)]==='string')[_0x1235b2(0x168)](_0x5b770c=>_0x5b770c[_0x1235b2(0x17d)])[_0x1235b2(0x16e)](_0x1e16f8=>_0x1e16f8['length']>0x0);return _0x2ef366[_0x1235b2(0x16c)]('\x0a')||_0x1235b2(0x169);}function isAbsoluteUri(_0xb40b7a){const _0x568a1b=_0x5a8963;try{return new URL(_0xb40b7a)[_0x568a1b(0x16f)]['length']>0x1;}catch{return![];}}function createA2UIClientCapabilities(_0x40ab0a){const _0x5cb906=_0x5a8963;if(!Array[_0x5cb906(0x15c)](_0x40ab0a)||_0x40ab0a['length']===0x0)throw new Error(_0x5cb906(0x166));const _0x4d2c36=[];for(const _0x25b108 of _0x40ab0a){if(typeof _0x25b108!=='string'||_0x25b108[_0x5cb906(0x176)]()['length']===0x0)throw new Error(_0x5cb906(0x16b));if(!_0x4d2c36[_0x5cb906(0x170)](_0x25b108))_0x4d2c36['push'](_0x25b108);}const _0x44aead={'clientCapabilities':{[A2UI_MCP_CAPABILITY_FAMILY]:{'supportedCatalogIds':_0x4d2c36}}};return{'a2ui':_0x44aead,'extensions':{[A2UI_MCP_CAPABILITY_EXTENSION_ID]:_0x44aead}};}function extractUIMCPToolResult(_0x4df44f,_0x1ad566={}){const _0x447979=_0x5a8963;if(!isJsonObject(_0x4df44f))return void 0x0;if(_0x4df44f['isError']===!![])throw new Error(textErrorMessage(_0x4df44f));if(!Array[_0x447979(0x15c)](_0x4df44f[_0x447979(0x162)]))return void 0x0;const _0x357c56=_0x4df44f[_0x447979(0x162)][_0x447979(0x16e)](_0x2faf63=>{const _0x1ff66e=_0x447979;if(!isJsonObject(_0x2faf63)||_0x2faf63[_0x1ff66e(0x16a)]!=='resource')return![];if(!isJsonObject(_0x2faf63['resource']))return![];return _0x2faf63[_0x1ff66e(0x15d)][_0x1ff66e(0x15f)]===A2UI_MESSAGE_MEDIA_TYPE;});if(_0x357c56['length']===0x0)return void 0x0;if(_0x357c56[_0x447979(0x17a)]>0x1)throw new Error(_0x447979(0x160));const _0x5ce76c=_0x357c56[0x0][_0x447979(0x15d)];if(!isJsonObject(_0x5ce76c))throw new Error('A2UI\x20embedded\x20resource\x20is\x20malformed.');if(typeof _0x5ce76c['uri']!=='string'||!isAbsoluteUri(_0x5ce76c[_0x447979(0x167)]))throw new Error('A2UI\x20embedded\x20resource\x20must\x20contain\x20a\x20valid\x20absolute\x20URI.');if(typeof _0x5ce76c[_0x447979(0x17d)]!==_0x447979(0x164))throw new Error(_0x447979(0x179));let _0x19ea78;try{_0x19ea78=JSON[_0x447979(0x17b)](_0x5ce76c['text']);}catch{throw new Error(_0x447979(0x16d));}const _0x11bf6f=createUISendNormalizer({'mode':'strict','catalog':_0x1ad566['catalog']})({'messages':_0x19ea78});return{..._0x11bf6f,'resourceUri':_0x5ce76c['uri'],'mimeType':A2UI_MESSAGE_MEDIA_TYPE};}export{A2UI_MCP_CAPABILITY_EXTENSION_ID,A2UI_MCP_CAPABILITY_FAMILY,createA2UIClientCapabilities,extractUIMCPToolResult};
1
+ (function(_0x59efd1,_0x429841){const _0x4ced66=_0x47b9,_0x1a9fdc=_0x59efd1();while(!![]){try{const _0xe225a2=-parseInt(_0x4ced66(0x1a9))/0x1*(parseInt(_0x4ced66(0x1b5))/0x2)+-parseInt(_0x4ced66(0x1af))/0x3+-parseInt(_0x4ced66(0x1ae))/0x4+parseInt(_0x4ced66(0x1aa))/0x5+parseInt(_0x4ced66(0x1b4))/0x6*(-parseInt(_0x4ced66(0x1ab))/0x7)+-parseInt(_0x4ced66(0x1ad))/0x8+parseInt(_0x4ced66(0x1b3))/0x9;if(_0xe225a2===_0x429841)break;else _0x1a9fdc['push'](_0x1a9fdc['shift']());}catch(_0x2e6bf9){_0x1a9fdc['push'](_0x1a9fdc['shift']());}}}(_0x4676,0xce9a5));function _0x4676(){const _0x49e592=['2381230RRDvNl','10654WrfAVX','isArray','2020576JqayMO','3742452CvjvmJ','873870EFoTKU','MCP\x20tool\x20result\x20contains\x20multiple\x20A2UI\x20embedded\x20resources.','A2UI\x20embedded\x20resource\x20is\x20malformed.','content','34341750HAxImL','6144DpAAEo','4BHoxSH','mimeType','filter','uri','MCP\x20tool\x20reported\x20an\x20error.','protocol','text','resource','A2UI\x20embedded\x20resource\x20text\x20must\x20contain\x20valid\x20JSON.','string','length','203874EFTGWF'];_0x4676=function(){return _0x49e592;};return _0x4676();}function _0x47b9(_0x38989f,_0x36091b){_0x38989f=_0x38989f-0x19f;const _0x4676b7=_0x4676();let _0x47b91f=_0x4676b7[_0x38989f];return _0x47b91f;}import{A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer}from'@agentic-ui-experience/ui-core/tool-mode';const A2UI_MCP_CAPABILITY_FAMILY='v0.9',A2UI_MCP_CAPABILITY_EXTENSION_ID='a2ui/client-capabilities';function isJsonObject(_0xfbeef7){const _0x4a9f8d=_0x47b9;return typeof _0xfbeef7==='object'&&_0xfbeef7!==null&&!Array[_0x4a9f8d(0x1ac)](_0xfbeef7);}function textErrorMessage(_0x5b8ecc){const _0x208795=_0x47b9;if(!Array[_0x208795(0x1ac)](_0x5b8ecc[_0x208795(0x1b2)]))return'MCP\x20tool\x20reported\x20an\x20error.';const _0x18c818=_0x5b8ecc[_0x208795(0x1b2)][_0x208795(0x1a0)](isJsonObject)[_0x208795(0x1a0)](_0x143d58=>_0x143d58['type']===_0x208795(0x1a4)&&typeof _0x143d58[_0x208795(0x1a4)]==='string')['map'](_0x3b70e6=>_0x3b70e6[_0x208795(0x1a4)])[_0x208795(0x1a0)](_0x5a7c87=>_0x5a7c87[_0x208795(0x1a8)]>0x0);return _0x18c818['join']('\x0a')||_0x208795(0x1a2);}function isAbsoluteUri(_0x7e411b){const _0x1b092f=_0x47b9;try{return new URL(_0x7e411b)[_0x1b092f(0x1a3)][_0x1b092f(0x1a8)]>0x1;}catch{return![];}}function createA2UIClientCapabilities(_0x301437){const _0x322218=_0x47b9;if(!Array[_0x322218(0x1ac)](_0x301437)||_0x301437[_0x322218(0x1a8)]===0x0)throw new Error('A2UI\x20client\x20capabilities\x20require\x20at\x20least\x20one\x20Catalog\x20ID.');const _0x58fcd0=[];for(const _0x24a705 of _0x301437){if(typeof _0x24a705!=='string'||_0x24a705['trim']()['length']===0x0)throw new Error('A2UI\x20client\x20capability\x20Catalog\x20IDs\x20must\x20be\x20non-empty\x20strings.');if(!_0x58fcd0['includes'](_0x24a705))_0x58fcd0['push'](_0x24a705);}const _0x3de54e={'clientCapabilities':{[A2UI_MCP_CAPABILITY_FAMILY]:{'supportedCatalogIds':_0x58fcd0}}};return{'a2ui':_0x3de54e,'extensions':{[A2UI_MCP_CAPABILITY_EXTENSION_ID]:_0x3de54e}};}function extractUIMCPToolResult(_0x34d908,_0x50a41e={}){const _0x3b50a7=_0x47b9;if(!isJsonObject(_0x34d908))return void 0x0;if(_0x34d908['isError']===!![])throw new Error(textErrorMessage(_0x34d908));if(!Array[_0x3b50a7(0x1ac)](_0x34d908['content']))return void 0x0;const _0x7392b6=_0x34d908['content'][_0x3b50a7(0x1a0)](_0x53ad9d=>{const _0x511c82=_0x3b50a7;if(!isJsonObject(_0x53ad9d)||_0x53ad9d['type']!=='resource')return![];if(!isJsonObject(_0x53ad9d['resource']))return![];return _0x53ad9d['resource'][_0x511c82(0x19f)]===A2UI_MESSAGE_MEDIA_TYPE;});if(_0x7392b6[_0x3b50a7(0x1a8)]===0x0)return void 0x0;if(_0x7392b6['length']>0x1)throw new Error(_0x3b50a7(0x1b0));const _0x2dd13a=_0x7392b6[0x0][_0x3b50a7(0x1a5)];if(!isJsonObject(_0x2dd13a))throw new Error(_0x3b50a7(0x1b1));if(typeof _0x2dd13a[_0x3b50a7(0x1a1)]!==_0x3b50a7(0x1a7)||!isAbsoluteUri(_0x2dd13a['uri']))throw new Error('A2UI\x20embedded\x20resource\x20must\x20contain\x20a\x20valid\x20absolute\x20URI.');if(typeof _0x2dd13a[_0x3b50a7(0x1a4)]!=='string')throw new Error('A2UI\x20embedded\x20resource\x20must\x20contain\x20text\x20content.');let _0xa865af;try{_0xa865af=JSON['parse'](_0x2dd13a['text']);}catch{throw new Error(_0x3b50a7(0x1a6));}const _0x97521c=createUISendNormalizer({'mode':'strict','catalog':_0x50a41e['catalog']})({'messages':_0xa865af});return{..._0x97521c,'resourceUri':_0x2dd13a['uri'],'mimeType':A2UI_MESSAGE_MEDIA_TYPE};}export{A2UI_MCP_CAPABILITY_EXTENSION_ID,A2UI_MCP_CAPABILITY_FAMILY,createA2UIClientCapabilities,extractUIMCPToolResult};
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { McpServer, type RegisteredResource, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import type { CallToolResult, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
3
3
  import { type A2UIProtocolVersion, type CatalogPromptDescriptor } from "@agentic-ui-experience/ui-core";
4
- import { type UIGetCatalogArguments, type UIGetCatalogResult, type UISendToolArguments, type UISendToolResult, type UIToolCatalog, type UIToolCatalogInstructionMode } from "@agentic-ui-experience/ui-core/tool-mode";
4
+ import { type UIGetCatalogArguments, type UIGetCatalogResult, type UISendToolArguments, type UISendToolResult, type UIToolCatalog } from "@agentic-ui-experience/ui-core/tool-mode";
5
5
  export type UIMCPToolResult = UISendToolResult & Record<string, unknown>;
6
6
  export type UIMCPToolArguments = UISendToolArguments;
7
- export type UIMCPCatalogInstructionMode = UIToolCatalogInstructionMode;
7
+ export type UIMCPSchemaDelivery = "discovery" | "inline";
8
8
  export type UIMCPCatalogDescription = UIGetCatalogResult["catalog"];
9
9
  export type UIMCPGetCatalogArguments = UIGetCatalogArguments;
10
10
  export type UIMCPGetCatalogResult = UIGetCatalogResult & Record<string, unknown>;
@@ -28,7 +28,8 @@ export interface CreateUIToolCallResultOptions {
28
28
  export interface CreateUIMCPServerOptions {
29
29
  /** The single catalog this server serves. Defaults to the A2UI basic catalog. */
30
30
  catalog?: CatalogPromptDescriptor;
31
- catalogInstructionMode?: UIMCPCatalogInstructionMode;
31
+ /** How the model receives schemas. Defaults to discovery via get_ui_catalog. */
32
+ schemaDelivery?: UIMCPSchemaDelivery;
32
33
  /** Version requested in generated tool and catalog instructions. Defaults to v0.9.1. */
33
34
  protocolVersion?: A2UIProtocolVersion;
34
35
  title?: string;
@@ -56,7 +57,7 @@ export declare function registerUICatalogTools(server: McpServer, catalog: UIMCP
56
57
  * scenario-independent; catalog-specific schema comes from the one catalog it
57
58
  * was configured with.
58
59
  */
59
- export declare function registerGenericUITool(server: McpServer, catalog: UIMCPCatalog, options?: Pick<CreateUIMCPServerOptions, "title" | "annotations" | "normalize">): RegisteredTool;
60
+ export declare function registerGenericUITool(server: McpServer, catalog: UIMCPCatalog, options?: Pick<CreateUIMCPServerOptions, "title" | "annotations" | "normalize" | "schemaDelivery">): RegisteredTool;
60
61
  /**
61
62
  * Create a generic A2UI MCP server. Transport ownership stays with the caller
62
63
  * so this can be used with stdio, SSE, or streamable HTTP.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- const _0x545829=_0x1961;(function(_0x540161,_0x35fc40){const _0x3615d1=_0x1961,_0x5b0c82=_0x540161();while(!![]){try{const _0x212587=-parseInt(_0x3615d1(0x167))/0x1+-parseInt(_0x3615d1(0x15e))/0x2*(-parseInt(_0x3615d1(0x174))/0x3)+parseInt(_0x3615d1(0x177))/0x4+-parseInt(_0x3615d1(0x143))/0x5+parseInt(_0x3615d1(0x134))/0x6+parseInt(_0x3615d1(0x141))/0x7+-parseInt(_0x3615d1(0x170))/0x8;if(_0x212587===_0x35fc40)break;else _0x5b0c82['push'](_0x5b0c82['shift']());}catch(_0x5a5360){_0x5b0c82['push'](_0x5b0c82['shift']());}}}(_0xc495,0xf1092));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0x2e9201}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS,A2UI_DEFAULT_PROTOCOL_VERSION,A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer,createUIToolCatalog,CATALOG_RESOURCE_URI,createUICatalogResourcePayload,GET_UI_CATALOG_TOOL_NAME,UI_TOOL_NAME,UI_TOOL_WORKFLOW_ORDER,getUICatalog,UI_TOOL_WORKFLOW}from'@agentic-ui-experience/ui-core/tool-mode';function _0xc495(){const _0xd607f0=['full','ownKeys','Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.','catchall','-\x20Every\x20message\x20you\x20generate\x20must\x20include\x20\x22version\x22:\x20\x22','getClientCapabilities','UI\x20normalizer\x20result\x20must\x20begin\x20with\x20createSurface.','The\x20directory\x20is\x20returned\x20on\x20every\x20call,\x20so\x20you\x20can\x20widen\x20your\x20selection\x20with\x20a\x20second\x20call\x20if\x20the\x20first\x20one\x20missed\x20something.','uiMessages','add','Client\x20does\x20not\x20support\x20required\x20A2UI\x20Catalog\x20\x22','describe',';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.','array','getPrototypeOf','2447794GgpZkl','UI\x20normalizer\x20uiJson\x20and\x20uiMessages\x20must\x20represent\x20the\x20same\x20JSON\x20value.','The\x20first\x20entry\x20must\x20be\x20`createSurface`,\x20carrying\x20the\x20catalog\x20id\x20reported\x20by\x20','supportedCatalogIds','normalize','extensions','UI\x20normalizer\x20uiJson\x20must\x20contain\x20valid\x20JSON.','server','protocolVersion','1861813SbphSl','Get\x20A2UI\x20Catalog','The\x20complete\x20A2UI\x20','object','delete','\x20capability\x20family).','a2ui-catalog','prototype','clientCapabilities','17498488XmShZI','annotations','message','number','3ponrtm','strict','null','7353692yDKcRw','uiJson','With\x20no\x20componentNames\x20it\x20returns\x20the\x20catalog\x20directory:\x20the\x20catalog\x20id\x20and\x20every\x20component\x20name\x20with\x20one\x20line\x20saying\x20what\x20it\x20is\x20for.\x20With\x20componentNames\x20it\x20returns\x20A2UI\x20message\x20rules,\x20component\x20field\x20rules,\x20custom\x20component\x20schemas,\x20style\x20guide,\x20and\x20examples\x20for\x20those\x20components.','union','A2UI\x20Catalog\x20','\x20UI\x20message\x20array.','lazy','string','createSurface','registerTool','-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.','title','_meta','9982542TpBAYZ','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','descriptor','isArray','optional','Client\x20must\x20declare\x20A2UI\x20','instructionMode','Generated\x20an\x20interactive\x20A2UI\x20interface.','length','Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20','A2UI\x20catalog\x20instructions\x20and\x20component\x20schema.','Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.','isFinite','6044017HhVXMe','-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.','2765510FkPOga','resource','@agentic-ui-experience/ui-mcp','has','Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities[\x22','boolean','compact','surfaceId','keys','mode','0.0.0','Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.'];_0xc495=function(){return _0xd607f0;};return _0xc495();}import{A2UI_MCP_CAPABILITY_FAMILY,A2UI_MCP_CAPABILITY_EXTENSION_ID}from'./client.js';const jsonValueSchema=z[_0x545829(0x12d)](()=>z[_0x545829(0x17a)]([z[_0x545829(0x176)](),z[_0x545829(0x148)](),z[_0x545829(0x173)](),z['string'](),z['array'](jsonValueSchema),z['record'](z['string'](),jsonValueSchema)])),jsonObjectSchema=z['record'](z['string'](),jsonValueSchema),getCatalogOutputSchema={'catalog':z[_0x545829(0x16a)]({'id':z[_0x545829(0x12e)](),'resourceUri':z[_0x545829(0x12e)](),'instructionMode':z['enum']([_0x545829(0x149),_0x545829(0x14f)]),'componentPurposes':z['record'](z['string'](),z['string']()),'descriptor':jsonObjectSchema,'instructions':z[_0x545829(0x12e)]()})},protocolVersionSchema=z['enum'](A2UI_SUPPORTED_PROTOCOL_VERSIONS),componentSchema=jsonObjectSchema,createSurfaceMessageSchema=z['object']({'version':protocolVersionSchema,'createSurface':z[_0x545829(0x16a)]({'surfaceId':z[_0x545829(0x12e)](),'catalogId':z['string']()})[_0x545829(0x152)](jsonValueSchema)})['catchall'](jsonValueSchema),updateComponentsMessageSchema=z[_0x545829(0x16a)]({'version':protocolVersionSchema,'updateComponents':z['object']({'surfaceId':z[_0x545829(0x12e)](),'components':z[_0x545829(0x15c)](componentSchema)})[_0x545829(0x152)](jsonValueSchema)})[_0x545829(0x152)](jsonValueSchema),updateDataModelMessageSchema=z[_0x545829(0x16a)]({'version':protocolVersionSchema,'updateDataModel':z['object']({'surfaceId':z['string'](),'path':z['string']()[_0x545829(0x138)](),'value':jsonValueSchema['optional']()})[_0x545829(0x152)](jsonValueSchema)})['catchall'](jsonValueSchema),deleteSurfaceMessageSchema=z[_0x545829(0x16a)]({'version':protocolVersionSchema,'deleteSurface':z[_0x545829(0x16a)]({'surfaceId':z['string']()})['catchall'](jsonValueSchema)})[_0x545829(0x152)](jsonValueSchema);function createSendUIInputSchema(_0x44612e=A2UI_DEFAULT_PROTOCOL_VERSION){const _0x5576bb=_0x545829;return{'surfaceId':z[_0x5576bb(0x12e)]()['optional']()[_0x5576bb(0x15a)](_0x5576bb(0x13f)),'messages':z[_0x5576bb(0x15c)](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))[_0x5576bb(0x15a)]([_0x5576bb(0x169)+_0x44612e+_0x5576bb(0x12c),'Every\x20message\x20you\x20generate\x20must\x20use\x20\x22version\x22:\x20\x22'+_0x44612e+'\x22;\x20no\x20other\x20wire\x20version\x20is\x20accepted.','Use\x20this\x20only\x20as\x20workflow\x20step\x202,\x20after\x20fetching\x20component\x20schemas\x20with\x20'+GET_UI_CATALOG_TOOL_NAME+'.','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20'+GET_UI_CATALOG_TOOL_NAME+_0x5576bb(0x15b),'Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.',_0x5576bb(0x160)+GET_UI_CATALOG_TOOL_NAME+'\x20at\x20`createSurface.catalogId`.',_0x5576bb(0x14e)]['join']('\x20'))};}function createGetCatalogInputSchema(){const _0x20bdfd=_0x545829;return{'componentNames':z['array'](z[_0x20bdfd(0x12e)]())['min'](0x1)['optional']()['describe']('Component\x20names\x20whose\x20field\x20rules\x20and\x20schemas\x20you\x20need.\x20Omit\x20on\x20the\x20first\x20call\x20to\x20get\x20the\x20catalog\x20directory\x20—\x20every\x20component\x20name\x20with\x20one\x20line\x20on\x20what\x20it\x20is\x20for\x20—\x20then\x20call\x20again\x20with\x20the\x20components\x20this\x20UI\x20actually\x20uses.'),'functionNames':z['array'](z['string']())['min'](0x1)[_0x20bdfd(0x138)]()['describe']('Optional\x20catalog\x20function\x20names\x20whose\x20full\x20schemas\x20you\x20need\x20(e.g.\x20formatDate,\x20formatNumber).\x20The\x20returned\x20instructions\x20always\x20list\x20every\x20function\x20name\x20with\x20its\x20arguments,\x20so\x20request\x20schemas\x20only\x20for\x20the\x20functions\x20this\x20UI\x20actually\x20calls.\x20Omit\x20when\x20the\x20UI\x20calls\x20no\x20functions.'),'instructionMode':z['enum']([_0x20bdfd(0x149),_0x20bdfd(0x14f)])[_0x20bdfd(0x138)]()['describe']('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(_0x41a399){const _0x37620f=_0x545829,_0x6714e7=_0x41a399['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION;return[_0x37620f(0x151),UI_TOOL_WORKFLOW,'Do\x20not\x20call\x20this\x20tool\x20before\x20'+GET_UI_CATALOG_TOOL_NAME+'\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','Catalog\x20id:\x20'+_0x41a399[_0x37620f(0x136)]['id']+'.','Message\x20list\x20rules:',_0x37620f(0x153)+_0x6714e7+'\x22.','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.',_0x37620f(0x142),'-\x20createSurface.catalogId\x20must\x20be\x20\x22'+_0x41a399[_0x37620f(0x136)]['id']+'\x22.','-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.',_0x37620f(0x131),_0x37620f(0x135)]['join']('\x0a\x0a');}function createUIMCPNormalize(_0x509566={}){const _0x3e3664=_0x545829;return createUISendNormalizer({'mode':_0x509566[_0x3e3664(0x14c)],'surfaceId':_0x509566['surfaceId'],'catalog':_0x509566['catalog']});}const defaultNormalize=createUIMCPNormalize(),carrierValidators=new WeakMap();function getCarrierValidator(_0x4c50b5){const _0xdadf89=_0x545829;if(_0x4c50b5===void 0x0)return defaultNormalize;const _0x363196=carrierValidators['get'](_0x4c50b5);if(_0x363196)return _0x363196;const _0x463915=createUIMCPNormalize({'mode':_0xdadf89(0x175),'catalog':_0x4c50b5});return carrierValidators['set'](_0x4c50b5,_0x463915),_0x463915;}function isJsonObject(_0x27a9fe){return typeof _0x27a9fe==='object'&&_0x27a9fe!==null&&!Array['isArray'](_0x27a9fe);}function _0x1961(_0x408938,_0x7e961e){_0x408938=_0x408938-0x12b;const _0xc4955=_0xc495();let _0x196138=_0xc4955[_0x408938];return _0x196138;}function isPlainJsonObject(_0x52cd7a){const _0x390870=_0x545829;if(!isJsonObject(_0x52cd7a))return![];const _0xbb6943=Object[_0x390870(0x15d)](_0x52cd7a);return _0xbb6943===Object[_0x390870(0x16e)]||_0xbb6943===null;}function hasOwn(_0x1e05e0,_0x2bb8d0){const _0xd901e=_0x545829;return Object[_0xd901e(0x16e)]['hasOwnProperty']['call'](_0x1e05e0,_0x2bb8d0);}function jsonValuesEqual(_0x42e322,_0x55c55d,_0x14e966=new WeakSet(),_0x324373=new WeakSet()){const _0x490a8e=_0x545829;if(_0x42e322===null||_0x55c55d===null)return _0x42e322===_0x55c55d;if(typeof _0x42e322!==typeof _0x55c55d)return![];if(typeof _0x42e322===_0x490a8e(0x12e)||typeof _0x42e322===_0x490a8e(0x148))return _0x42e322===_0x55c55d;if(typeof _0x42e322==='number')return Number[_0x490a8e(0x140)](_0x42e322)&&Number[_0x490a8e(0x140)](_0x55c55d)&&_0x42e322===_0x55c55d;if(typeof _0x42e322!==_0x490a8e(0x16a)||typeof _0x55c55d!=='object')return![];if(_0x14e966[_0x490a8e(0x146)](_0x42e322)||_0x324373['has'](_0x55c55d))return![];_0x14e966[_0x490a8e(0x158)](_0x42e322),_0x324373['add'](_0x55c55d);try{if(Array[_0x490a8e(0x137)](_0x42e322)||Array[_0x490a8e(0x137)](_0x55c55d)){if(!Array[_0x490a8e(0x137)](_0x42e322)||!Array[_0x490a8e(0x137)](_0x55c55d))return![];if(_0x42e322[_0x490a8e(0x13c)]!==_0x55c55d['length'])return![];if(Reflect['ownKeys'](_0x42e322)['length']!==_0x42e322[_0x490a8e(0x13c)]+0x1)return![];if(Reflect[_0x490a8e(0x150)](_0x55c55d)[_0x490a8e(0x13c)]!==_0x55c55d[_0x490a8e(0x13c)]+0x1)return![];for(let _0x235660=0x0;_0x235660<_0x42e322[_0x490a8e(0x13c)];_0x235660+=0x1){if(!hasOwn(_0x42e322,String(_0x235660)))return![];if(!hasOwn(_0x55c55d,String(_0x235660)))return![];if(!jsonValuesEqual(_0x42e322[_0x235660],_0x55c55d[_0x235660],_0x14e966,_0x324373))return![];}return!![];}if(!isPlainJsonObject(_0x42e322)||!isPlainJsonObject(_0x55c55d))return![];const _0x3d339e=Object[_0x490a8e(0x14b)](_0x42e322),_0x14ea9b=Object['keys'](_0x55c55d);if(Reflect[_0x490a8e(0x150)](_0x42e322)[_0x490a8e(0x13c)]!==_0x3d339e['length'])return![];if(Reflect[_0x490a8e(0x150)](_0x55c55d)['length']!==_0x14ea9b['length'])return![];if(_0x3d339e['length']!==_0x14ea9b['length'])return![];return _0x3d339e['every'](_0x38a25e=>hasOwn(_0x55c55d,_0x38a25e)&&jsonValuesEqual(_0x42e322[_0x38a25e],_0x55c55d[_0x38a25e],_0x14e966,_0x324373));}finally{_0x14e966[_0x490a8e(0x16b)](_0x42e322),_0x324373['delete'](_0x55c55d);}}function getNormalizedSurfaceId(_0x117b50,_0x29b1fb,_0x5d382e){const _0x205d69=_0x545829;if(typeof _0x117b50[_0x205d69(0x178)]!==_0x205d69(0x12e)||!Array['isArray'](_0x117b50[_0x205d69(0x157)]))throw new Error('UI\x20normalizer\x20must\x20return\x20uiJson\x20and\x20uiMessages.');let _0x1002b9;try{_0x1002b9=JSON['parse'](_0x117b50[_0x205d69(0x178)]);}catch{throw new Error(_0x205d69(0x164));}if(!jsonValuesEqual(_0x1002b9,_0x117b50[_0x205d69(0x157)]))throw new Error(_0x205d69(0x15f));if(!Array[_0x205d69(0x137)](_0x1002b9)||!isJsonObject(_0x1002b9[0x0]))throw new Error(_0x205d69(0x155));const _0x24846d=_0x1002b9[0x0][_0x205d69(0x12f)];if(!isJsonObject(_0x24846d)||typeof _0x24846d['surfaceId']!==_0x205d69(0x12e))throw new Error(_0x205d69(0x155));return getCarrierValidator(_0x5d382e['catalog'])({'messages':_0x1002b9,..._0x29b1fb===void 0x0?{}:{'surfaceId':_0x29b1fb}}),_0x24846d['surfaceId'];}function getA2UIClientCapability(_0x5898f4,_0x5d41b9){const _0x1469f8=_0x545829;if(isJsonObject(_0x5d41b9)&&hasOwn(_0x5d41b9,'a2ui'))return _0x5d41b9['a2ui'];const _0x89ead=_0x5898f4['server'][_0x1469f8(0x154)]();if(!isJsonObject(_0x89ead))return void 0x0;if(hasOwn(_0x89ead,'a2ui'))return _0x89ead['a2ui'];const _0x5bf691=_0x89ead[_0x1469f8(0x163)];return isJsonObject(_0x5bf691)&&hasOwn(_0x5bf691,A2UI_MCP_CAPABILITY_EXTENSION_ID)?_0x5bf691[A2UI_MCP_CAPABILITY_EXTENSION_ID]:void 0x0;}function validateA2UIClientCapability(_0xf85e9f,_0x342cd6){const _0x437800=_0x545829;if(!isJsonObject(_0xf85e9f))return _0x437800(0x139)+A2UI_MCP_CAPABILITY_FAMILY+'\x20capability-family\x20support\x20for\x20Catalog\x20\x22'+_0x342cd6+'\x22.';const _0x1548b7=_0xf85e9f[_0x437800(0x16f)];if(!isJsonObject(_0x1548b7))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities\x20is\x20required.';const _0x5d816e=_0x1548b7[A2UI_MCP_CAPABILITY_FAMILY];if(!isJsonObject(_0x5d816e)||!Array['isArray'](_0x5d816e[_0x437800(0x161)]))return _0x437800(0x147)+A2UI_MCP_CAPABILITY_FAMILY+'\x22].supportedCatalogIds\x20must\x20be\x20an\x20array.';if(!_0x5d816e[_0x437800(0x161)]['every'](_0x380faf=>typeof _0x380faf===_0x437800(0x12e)))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20supportedCatalogIds\x20must\x20contain\x20only\x20strings.';if(!_0x5d816e[_0x437800(0x161)]['includes'](_0x342cd6))return _0x437800(0x159)+_0x342cd6+'\x22\x20('+A2UI_MCP_CAPABILITY_FAMILY+_0x437800(0x16c);return void 0x0;}function toToolError(_0x4fa423){return{'isError':!![],'content':[{'type':'text','text':_0x4fa423}]};}function toToolResult(_0x1d022f,_0x5f212e,_0xf48210){const _0x4c166e=_0x545829,_0x4459ea=getNormalizedSurfaceId(_0x1d022f,_0x5f212e,_0xf48210),_0xe24e04={'type':_0x4c166e(0x144),'resource':{'uri':'a2ui://surface/'+encodeURIComponent(_0x4459ea),'mimeType':A2UI_MESSAGE_MEDIA_TYPE,'text':_0x1d022f['uiJson']}};return{'content':[{'type':'text','text':_0x4c166e(0x13b)},_0xe24e04]};}function toCatalogToolResult(_0x44874e){return{'content':[{'type':'text','text':JSON['stringify'](_0x44874e)}],'structuredContent':_0x44874e};}async function createUIToolCallResult(_0x2b48db,_0x584766=defaultNormalize,_0x3e8ceb={}){const _0x12c027=_0x545829;try{const _0x3b4fe0=_0x2b48db[_0x12c027(0x14a)],_0x1643de=await _0x584766(_0x2b48db);return toToolResult(_0x1643de,_0x3b4fe0,_0x3e8ceb);}catch(_0x369a0b){const _0x55012b=_0x369a0b instanceof Error?_0x369a0b[_0x12c027(0x172)]:String(_0x369a0b);return toToolError(_0x55012b);}}function toMCPResourceResult(_0x473a15){return _0x473a15;}function registerUICatalogResources(_0x529731,_0x558e79){const _0x56fc0f=_0x545829,_0x2e5a63=_0x529731['registerResource'](_0x56fc0f(0x16d),CATALOG_RESOURCE_URI,{'title':_0x56fc0f(0x12b)+_0x558e79[_0x56fc0f(0x136)]['id'],'description':_0x56fc0f(0x13e),'mimeType':'application/json'},_0x32f3c0=>toMCPResourceResult(createUICatalogResourcePayload(_0x558e79,_0x32f3c0['href'])));return{'catalog':_0x2e5a63};}function registerUICatalogTools(_0x57e2b3,_0x2f8871){const _0x2c98af=_0x545829,_0x2da76b=_0x57e2b3[_0x2c98af(0x130)](GET_UI_CATALOG_TOOL_NAME,{'title':_0x2c98af(0x168),'description':[_0x2c98af(0x13d)+UI_TOOL_NAME+'.',UI_TOOL_WORKFLOW_ORDER,_0x2c98af(0x179),_0x2c98af(0x156),'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 _0x5683dc=>{const _0x39ae69=_0x2c98af;try{return toCatalogToolResult(getUICatalog(_0x2f8871,{'componentNames':_0x5683dc['componentNames'],'functionNames':_0x5683dc['functionNames'],'instructionMode':_0x5683dc[_0x39ae69(0x13a)]}));}catch(_0x1af9e9){const _0x50d8a6=_0x1af9e9 instanceof Error?_0x1af9e9[_0x39ae69(0x172)]:String(_0x1af9e9);return toToolError(_0x50d8a6);}});return{'get':_0x2da76b};}function registerGenericUITool(_0x398ba6,_0x1a1c6d,_0x34a689={}){const _0x1d1b57=_0x545829,_0x54c39b=_0x34a689['normalize']??createUISendNormalizer({'catalog':_0x1a1c6d});return _0x398ba6[_0x1d1b57(0x130)](UI_TOOL_NAME,{'title':_0x34a689[_0x1d1b57(0x132)],'description':createGenericToolDescription(_0x1a1c6d),'inputSchema':createSendUIInputSchema(_0x1a1c6d[_0x1d1b57(0x166)]??A2UI_DEFAULT_PROTOCOL_VERSION),'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0x34a689[_0x1d1b57(0x171)]}},async(_0x1bb7be,_0xca82d3)=>{const _0xb3cfe4=_0x1d1b57,_0x31d967=validateA2UIClientCapability(getA2UIClientCapability(_0x398ba6,_0xca82d3[_0xb3cfe4(0x133)]),_0x1a1c6d['descriptor']['id']);if(_0x31d967)return toToolError(_0x31d967);return createUIToolCallResult(_0x1bb7be,_0x54c39b,{'catalog':_0x1a1c6d});});}function createUIMCPServer(_0x42b1ec={}){const _0x45c238=_0x545829,_0x4f73c6=createUIToolCatalog(_0x42b1ec['catalog'],_0x42b1ec['catalogInstructionMode'],_0x42b1ec['protocolVersion']),_0x375747=_0x42b1ec[_0x45c238(0x162)]??createUISendNormalizer({'catalog':_0x4f73c6}),_0x595873=new McpServer({'name':_0x42b1ec[_0x45c238(0x165)]?.['name']??_0x45c238(0x145),'version':_0x42b1ec['server']?.['version']??_0x45c238(0x14d)});return registerUICatalogResources(_0x595873,_0x4f73c6),registerUICatalogTools(_0x595873,_0x4f73c6),registerGenericUITool(_0x595873,_0x4f73c6,{..._0x42b1ec,'normalize':_0x375747}),_0x595873;}export{_0x2e9201 as McpServer,createUIMCPNormalize,createUIMCPServer,createUIToolCallResult,registerGenericUITool,registerUICatalogResources,registerUICatalogTools};
1
+ const _0x2d3a0f=_0x3cda;(function(_0x2a984f,_0x575bb8){const _0x508201=_0x3cda,_0xb06535=_0x2a984f();while(!![]){try{const _0x23eff8=parseInt(_0x508201(0x151))/0x1*(parseInt(_0x508201(0x168))/0x2)+parseInt(_0x508201(0x1a6))/0x3+parseInt(_0x508201(0x176))/0x4*(-parseInt(_0x508201(0x169))/0x5)+parseInt(_0x508201(0x175))/0x6+-parseInt(_0x508201(0x163))/0x7*(-parseInt(_0x508201(0x19d))/0x8)+-parseInt(_0x508201(0x19c))/0x9*(-parseInt(_0x508201(0x185))/0xa)+parseInt(_0x508201(0x198))/0xb*(parseInt(_0x508201(0x189))/0xc);if(_0x23eff8===_0x575bb8)break;else _0xb06535['push'](_0xb06535['shift']());}catch(_0x33fa8d){_0xb06535['push'](_0xb06535['shift']());}}}(_0x410d,0xb87b4));import{McpServer}from'@modelcontextprotocol/sdk/server/mcp.js';import{McpServer as _0xd83c53}from'@modelcontextprotocol/sdk/server/mcp.js';import{z}from'zod';import{A2UI_SUPPORTED_PROTOCOL_VERSIONS,A2UI_DEFAULT_PROTOCOL_VERSION,A2UI_MESSAGE_MEDIA_TYPE}from'@agentic-ui-experience/ui-core';import{createUISendNormalizer,createUIToolCatalog,CATALOG_RESOURCE_URI,createUICatalogResourcePayload,GET_UI_CATALOG_TOOL_NAME,UI_TOOL_NAME,UI_TOOL_WORKFLOW_ORDER,getUICatalog,createUISendToolSpec,UI_TOOL_WORKFLOW}from'@agentic-ui-experience/ui-core/tool-mode';import{A2UI_MCP_CAPABILITY_FAMILY,A2UI_MCP_CAPABILITY_EXTENSION_ID}from'./client.js';const jsonValueSchema=z['lazy'](()=>z['union']([z[_0x2d3a0f(0x17e)](),z['boolean'](),z['number'](),z[_0x2d3a0f(0x186)](),z[_0x2d3a0f(0x14d)](jsonValueSchema),z[_0x2d3a0f(0x15f)](z['string'](),jsonValueSchema)])),jsonObjectSchema=z['record'](z[_0x2d3a0f(0x186)](),jsonValueSchema),catalogDescriptionBaseSchema={'id':z[_0x2d3a0f(0x186)](),'resourceUri':z[_0x2d3a0f(0x186)](),'instructions':z['string']()},catalogBasicDefinitionsSchema=z['object']({'format':z[_0x2d3a0f(0x153)](_0x2d3a0f(0x15b)),'schema':jsonObjectSchema}),catalogDefinitionsSchema=z[_0x2d3a0f(0x14c)]({'componentNames':z[_0x2d3a0f(0x14d)](z['string']()),'functionNames':z[_0x2d3a0f(0x14d)](z['string']()),'basicComponents':catalogBasicDefinitionsSchema['optional'](),'customComponents':z[_0x2d3a0f(0x15f)](z['string'](),z[_0x2d3a0f(0x158)]([z[_0x2d3a0f(0x16b)](),jsonObjectSchema])),'functions':z['record'](z['string'](),jsonObjectSchema),'$defs':jsonObjectSchema}),getCatalogOutputSchema={'catalog':z[_0x2d3a0f(0x18f)](_0x2d3a0f(0x1a2),[z['object']({...catalogDescriptionBaseSchema,'kind':z['literal'](_0x2d3a0f(0x14b)),'componentPurposes':z[_0x2d3a0f(0x15f)](z['string'](),z['string']()),'definitions':catalogDefinitionsSchema[_0x2d3a0f(0x190)]()}),z['object']({...catalogDescriptionBaseSchema,'kind':z[_0x2d3a0f(0x153)](_0x2d3a0f(0x14e)),'definitions':catalogDefinitionsSchema})])},protocolVersionSchema=z['enum'](A2UI_SUPPORTED_PROTOCOL_VERSIONS),componentSchema=jsonObjectSchema,createSurfaceMessageSchema=z[_0x2d3a0f(0x14c)]({'version':protocolVersionSchema,'createSurface':z[_0x2d3a0f(0x14c)]({'surfaceId':z[_0x2d3a0f(0x186)](),'catalogId':z['string']()})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),updateComponentsMessageSchema=z['object']({'version':protocolVersionSchema,'updateComponents':z['object']({'surfaceId':z['string'](),'components':z[_0x2d3a0f(0x14d)](componentSchema)})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),updateDataModelMessageSchema=z['object']({'version':protocolVersionSchema,'updateDataModel':z['object']({'surfaceId':z['string'](),'path':z['string']()[_0x2d3a0f(0x190)](),'value':jsonValueSchema['optional']()})[_0x2d3a0f(0x1a3)](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema),deleteSurfaceMessageSchema=z['object']({'version':protocolVersionSchema,'deleteSurface':z[_0x2d3a0f(0x14c)]({'surfaceId':z[_0x2d3a0f(0x186)]()})['catchall'](jsonValueSchema)})[_0x2d3a0f(0x1a3)](jsonValueSchema);function createSendUIInputSchema(_0x26cafc=A2UI_DEFAULT_PROTOCOL_VERSION){const _0x152ed3=_0x2d3a0f;return{'surfaceId':z['string']()[_0x152ed3(0x190)]()['describe'](_0x152ed3(0x197)),'messages':z[_0x152ed3(0x14d)](z['union']([createSurfaceMessageSchema,updateComponentsMessageSchema,updateDataModelMessageSchema,deleteSurfaceMessageSchema]))[_0x152ed3(0x177)]([_0x152ed3(0x194)+_0x26cafc+_0x152ed3(0x155),'Every\x20message\x20you\x20generate\x20must\x20use\x20\x22version\x22:\x20\x22'+_0x26cafc+_0x152ed3(0x16d),'Use\x20this\x20only\x20as\x20workflow\x20step\x202,\x20after\x20fetching\x20component\x20schemas\x20with\x20'+GET_UI_CATALOG_TOOL_NAME+'.',_0x152ed3(0x193)+GET_UI_CATALOG_TOOL_NAME+';\x20do\x20not\x20guess\x20component\x20fields\x20from\x20this\x20tool\x20schema.',_0x152ed3(0x18a),_0x152ed3(0x161),_0x152ed3(0x18c)+GET_UI_CATALOG_TOOL_NAME+'\x20at\x20`createSurface.catalogId`.',_0x152ed3(0x1a4)][_0x152ed3(0x165)]('\x20'))};}function createGetCatalogInputSchema(){const _0x2fd559=_0x2d3a0f;return{'componentNames':z[_0x2fd559(0x14d)](z['string']())[_0x2fd559(0x19a)](0x1)[_0x2fd559(0x190)]()[_0x2fd559(0x177)](_0x2fd559(0x159)),'functionNames':z['array'](z['string']())['min'](0x1)['optional']()[_0x2fd559(0x177)](_0x2fd559(0x174))};}function createGenericToolDescription(_0xce1554){const _0x3ecdc4=_0x2d3a0f,_0x47fa91=_0xce1554['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION;return['Final\x20step:\x20render\x20UI\x20on\x20the\x20client\x20by\x20submitting\x20structured\x20A2UI\x20messages.',UI_TOOL_WORKFLOW,'Do\x20not\x20call\x20this\x20tool\x20before\x20'+GET_UI_CATALOG_TOOL_NAME+_0x3ecdc4(0x15a),'Catalog\x20id:\x20'+_0xce1554[_0x3ecdc4(0x17f)]['id']+'.',_0x3ecdc4(0x18d),'-\x20Every\x20message\x20you\x20generate\x20must\x20include\x20\x22version\x22:\x20\x22'+_0x47fa91+'\x22.',_0x3ecdc4(0x195),'-\x20createSurface.surfaceId\x20must\x20match\x20the\x20top-level\x20surfaceId\x20when\x20supplied.',_0x3ecdc4(0x187)+_0xce1554[_0x3ecdc4(0x17f)]['id']+'\x22.','-\x20Later\x20updateComponents/updateDataModel/deleteSurface\x20messages\x20must\x20target\x20the\x20same\x20surface.',_0x3ecdc4(0x18e),_0x3ecdc4(0x15d)][_0x3ecdc4(0x165)]('\x0a\x0a');}function createUIMCPNormalize(_0xe21901={}){const _0x2dab06=_0x2d3a0f;return createUISendNormalizer({'mode':_0xe21901[_0x2dab06(0x1a5)],'surfaceId':_0xe21901['surfaceId'],'catalog':_0xe21901[_0x2dab06(0x182)]});}const defaultNormalize=createUIMCPNormalize(),carrierValidators=new WeakMap();function getCarrierValidator(_0x34dae8){const _0x3222b8=_0x2d3a0f;if(_0x34dae8===void 0x0)return defaultNormalize;const _0xe4cdda=carrierValidators[_0x3222b8(0x166)](_0x34dae8);if(_0xe4cdda)return _0xe4cdda;const _0x454ec6=createUIMCPNormalize({'mode':_0x3222b8(0x17b),'catalog':_0x34dae8});return carrierValidators['set'](_0x34dae8,_0x454ec6),_0x454ec6;}function _0x410d(){const _0x55c7df=['Unsupported\x20schemaDelivery\x20\x22','kind','catchall','Component\x20objects\x20belong\x20inside\x20a\x20later\x20`updateComponents.components`\x20array.','mode','641952lembdU','normalize','A2UI\x20Catalog\x20','uiJson','directory','object','array','selection','\x20capability\x20family).','isArray','374897omNiYj','server','literal','\x22\x20(','\x20UI\x20message\x20array.','unknown','functionNames','union','Component\x20names\x20whose\x20field\x20rules\x20and\x20schemas\x20you\x20need.\x20Omit\x20on\x20the\x20first\x20call\x20to\x20get\x20the\x20catalog\x20directory\x20—\x20every\x20component\x20name\x20with\x20one\x20line\x20on\x20what\x20it\x20is\x20for\x20—\x20then\x20call\x20again\x20with\x20the\x20components\x20this\x20UI\x20actually\x20uses.','\x20in\x20the\x20same\x20task.\x20This\x20tool\x20validates\x20and\x20returns\x20A2UI\x20messages;\x20it\x20is\x20not\x20the\x20source\x20of\x20component\x20schemas.','json-schema','parse','Do\x20not\x20send\x20`ui_json`;\x20do\x20not\x20serialize\x20the\x20messages\x20into\x20a\x20JSON\x20string.','UI\x20normalizer\x20must\x20return\x20uiJson\x20and\x20uiMessages.','record','\x22.\x20Expected\x20\x22discovery\x22\x20or\x20\x22inline\x22.','Every\x20entry\x20contains\x20`version`\x20and\x20exactly\x20one\x20of\x20`createSurface`/`updateComponents`/`updateDataModel`/`deleteSurface`.','0.0.0','448roopDq','Basic\x20component\x20and\x20requested\x20function\x20definitions\x20are\x20JSON\x20Schemas\x20whose\x20references\x20resolve\x20from\x20the\x20whole\x20catalog.definitions\x20object,\x20including\x20its\x20shared\x20$defs.\x20Custom\x20component\x20schemas\x20retain\x20their\x20own\x20document\x20scope.','join','get','has','2xeRnDB','20mpCXys','length','boolean','a2ui://surface/','\x22;\x20no\x20other\x20wire\x20version\x20is\x20accepted.','message','Step\x201\x20of\x20the\x20A2UI\x20MCP\x20workflow.\x20Call\x20this\x20before\x20','add','discovery','prototype','With\x20no\x20componentNames\x20it\x20returns\x20the\x20catalog\x20directory:\x20the\x20catalog\x20id\x20and\x20every\x20component\x20name\x20with\x20one\x20line\x20saying\x20what\x20it\x20is\x20for.\x20Choose\x20all\x20components\x20the\x20UI\x20needs,\x20then\x20call\x20again\x20with\x20those\x20componentNames.','Optional\x20catalog\x20function\x20names\x20whose\x20full\x20schemas\x20you\x20need\x20(e.g.\x20formatDate,\x20formatNumber).\x20The\x20directory\x20instructions\x20list\x20available\x20functions\x20by\x20name\x20and\x20arguments;\x20requested\x20schemas\x20are\x20returned\x20in\x20catalog.definitions.functions.\x20Omit\x20when\x20the\x20UI\x20calls\x20no\x20functions.','733170CdIieR','1490620iiUjCc','describe','a2ui','call','supportedCatalogIds','strict','schemaDelivery','surfaceId','null','descriptor','href','text','catalog','Client\x20does\x20not\x20support\x20required\x20A2UI\x20Catalog\x20\x22','version','2996810ssONqr','string','-\x20createSurface.catalogId\x20must\x20be\x20\x22','registerTool','74532LeIklh','Do\x20not\x20pass\x20a\x20JSON\x20string\x20and\x20do\x20not\x20use\x20a\x20ui_json\x20field.','inline','The\x20first\x20entry\x20must\x20be\x20`createSurface`,\x20carrying\x20the\x20catalog\x20id\x20reported\x20by\x20','Message\x20list\x20rules:','-\x20Component\x20objects\x20belong\x20only\x20inside\x20updateComponents.components\x20and\x20must\x20conform\x20to\x20the\x20schemas\x20returned\x20by\x20get_ui_catalog.','discriminatedUnion','optional','ownKeys','Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities[\x22','Build\x20component\x20objects\x20from\x20the\x20schema\x20returned\x20by\x20','The\x20complete\x20A2UI\x20','-\x20The\x20first\x20message\x20must\x20be\x20createSurface.','parameters','Optional\x20expected\x20surface\x20id\x20for\x20this\x20UI\x20call.\x20When\x20supplied,\x20`messages[0].createSurface.surfaceId`\x20must\x20match\x20it.','506gztTGS','clientCapabilities','min','UI\x20normalizer\x20result\x20must\x20begin\x20with\x20createSurface.','18ivEYpR','81264GhINcd','@agentic-ui-experience/ui-mcp','isFinite','resource'];_0x410d=function(){return _0x55c7df;};return _0x410d();}function isJsonObject(_0x14dd22){const _0x1cf13d=_0x2d3a0f;return typeof _0x14dd22===_0x1cf13d(0x14c)&&_0x14dd22!==null&&!Array[_0x1cf13d(0x150)](_0x14dd22);}function isPlainJsonObject(_0x5c722a){const _0x288331=_0x2d3a0f;if(!isJsonObject(_0x5c722a))return![];const _0x11f004=Object['getPrototypeOf'](_0x5c722a);return _0x11f004===Object[_0x288331(0x172)]||_0x11f004===null;}function _0x3cda(_0x123a67,_0x5c7cb7){_0x123a67=_0x123a67-0x149;const _0x410d1a=_0x410d();let _0x3cda36=_0x410d1a[_0x123a67];return _0x3cda36;}function hasOwn(_0x30fa3c,_0x58088f){const _0x405ac9=_0x2d3a0f;return Object[_0x405ac9(0x172)]['hasOwnProperty'][_0x405ac9(0x179)](_0x30fa3c,_0x58088f);}function jsonValuesEqual(_0x221146,_0x27a5f3,_0x22b157=new WeakSet(),_0x5bf1ac=new WeakSet()){const _0x5ad35d=_0x2d3a0f;if(_0x221146===null||_0x27a5f3===null)return _0x221146===_0x27a5f3;if(typeof _0x221146!==typeof _0x27a5f3)return![];if(typeof _0x221146==='string'||typeof _0x221146===_0x5ad35d(0x16b))return _0x221146===_0x27a5f3;if(typeof _0x221146==='number')return Number['isFinite'](_0x221146)&&Number[_0x5ad35d(0x19f)](_0x27a5f3)&&_0x221146===_0x27a5f3;if(typeof _0x221146!=='object'||typeof _0x27a5f3!=='object')return![];if(_0x22b157['has'](_0x221146)||_0x5bf1ac[_0x5ad35d(0x167)](_0x27a5f3))return![];_0x22b157[_0x5ad35d(0x170)](_0x221146),_0x5bf1ac[_0x5ad35d(0x170)](_0x27a5f3);try{if(Array[_0x5ad35d(0x150)](_0x221146)||Array['isArray'](_0x27a5f3)){if(!Array['isArray'](_0x221146)||!Array[_0x5ad35d(0x150)](_0x27a5f3))return![];if(_0x221146[_0x5ad35d(0x16a)]!==_0x27a5f3[_0x5ad35d(0x16a)])return![];if(Reflect['ownKeys'](_0x221146)['length']!==_0x221146['length']+0x1)return![];if(Reflect[_0x5ad35d(0x191)](_0x27a5f3)['length']!==_0x27a5f3[_0x5ad35d(0x16a)]+0x1)return![];for(let _0x3f6d5f=0x0;_0x3f6d5f<_0x221146[_0x5ad35d(0x16a)];_0x3f6d5f+=0x1){if(!hasOwn(_0x221146,String(_0x3f6d5f)))return![];if(!hasOwn(_0x27a5f3,String(_0x3f6d5f)))return![];if(!jsonValuesEqual(_0x221146[_0x3f6d5f],_0x27a5f3[_0x3f6d5f],_0x22b157,_0x5bf1ac))return![];}return!![];}if(!isPlainJsonObject(_0x221146)||!isPlainJsonObject(_0x27a5f3))return![];const _0x40213a=Object['keys'](_0x221146),_0x186d06=Object['keys'](_0x27a5f3);if(Reflect['ownKeys'](_0x221146)[_0x5ad35d(0x16a)]!==_0x40213a['length'])return![];if(Reflect[_0x5ad35d(0x191)](_0x27a5f3)[_0x5ad35d(0x16a)]!==_0x186d06['length'])return![];if(_0x40213a[_0x5ad35d(0x16a)]!==_0x186d06['length'])return![];return _0x40213a['every'](_0x555e04=>hasOwn(_0x27a5f3,_0x555e04)&&jsonValuesEqual(_0x221146[_0x555e04],_0x27a5f3[_0x555e04],_0x22b157,_0x5bf1ac));}finally{_0x22b157['delete'](_0x221146),_0x5bf1ac['delete'](_0x27a5f3);}}function getNormalizedSurfaceId(_0x23a481,_0xa043d1,_0x13aa33){const _0x5951c6=_0x2d3a0f;if(typeof _0x23a481[_0x5951c6(0x14a)]!==_0x5951c6(0x186)||!Array[_0x5951c6(0x150)](_0x23a481['uiMessages']))throw new Error(_0x5951c6(0x15e));let _0x121e01;try{_0x121e01=JSON[_0x5951c6(0x15c)](_0x23a481[_0x5951c6(0x14a)]);}catch{throw new Error('UI\x20normalizer\x20uiJson\x20must\x20contain\x20valid\x20JSON.');}if(!jsonValuesEqual(_0x121e01,_0x23a481['uiMessages']))throw new Error('UI\x20normalizer\x20uiJson\x20and\x20uiMessages\x20must\x20represent\x20the\x20same\x20JSON\x20value.');if(!Array['isArray'](_0x121e01)||!isJsonObject(_0x121e01[0x0]))throw new Error(_0x5951c6(0x19b));const _0x26edde=_0x121e01[0x0]['createSurface'];if(!isJsonObject(_0x26edde)||typeof _0x26edde['surfaceId']!==_0x5951c6(0x186))throw new Error(_0x5951c6(0x19b));return getCarrierValidator(_0x13aa33['catalog'])({'messages':_0x121e01,..._0xa043d1===void 0x0?{}:{'surfaceId':_0xa043d1}}),_0x26edde[_0x5951c6(0x17d)];}function getA2UIClientCapability(_0x4c3d07,_0x369846){const _0x1b15b6=_0x2d3a0f;if(isJsonObject(_0x369846)&&hasOwn(_0x369846,'a2ui'))return _0x369846[_0x1b15b6(0x178)];const _0x4af2cf=_0x4c3d07[_0x1b15b6(0x152)]['getClientCapabilities']();if(!isJsonObject(_0x4af2cf))return void 0x0;if(hasOwn(_0x4af2cf,_0x1b15b6(0x178)))return _0x4af2cf[_0x1b15b6(0x178)];const _0x5c2466=_0x4af2cf['extensions'];return isJsonObject(_0x5c2466)&&hasOwn(_0x5c2466,A2UI_MCP_CAPABILITY_EXTENSION_ID)?_0x5c2466[A2UI_MCP_CAPABILITY_EXTENSION_ID]:void 0x0;}function validateA2UIClientCapability(_0xead42,_0x2e2a0e){const _0x3e9bd0=_0x2d3a0f;if(!isJsonObject(_0xead42))return'Client\x20must\x20declare\x20A2UI\x20'+A2UI_MCP_CAPABILITY_FAMILY+'\x20capability-family\x20support\x20for\x20Catalog\x20\x22'+_0x2e2a0e+'\x22.';const _0x5b293e=_0xead42[_0x3e9bd0(0x199)];if(!isJsonObject(_0x5b293e))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20clientCapabilities\x20is\x20required.';const _0x3bb77b=_0x5b293e[A2UI_MCP_CAPABILITY_FAMILY];if(!isJsonObject(_0x3bb77b)||!Array['isArray'](_0x3bb77b['supportedCatalogIds']))return _0x3e9bd0(0x192)+A2UI_MCP_CAPABILITY_FAMILY+'\x22].supportedCatalogIds\x20must\x20be\x20an\x20array.';if(!_0x3bb77b['supportedCatalogIds']['every'](_0x11ec73=>typeof _0x11ec73===_0x3e9bd0(0x186)))return'Client\x20A2UI\x20capabilities\x20are\x20malformed:\x20supportedCatalogIds\x20must\x20contain\x20only\x20strings.';if(!_0x3bb77b[_0x3e9bd0(0x17a)]['includes'](_0x2e2a0e))return _0x3e9bd0(0x183)+_0x2e2a0e+_0x3e9bd0(0x154)+A2UI_MCP_CAPABILITY_FAMILY+_0x3e9bd0(0x14f);return void 0x0;}function toToolError(_0x23a696){const _0x58f965=_0x2d3a0f;return{'isError':!![],'content':[{'type':_0x58f965(0x181),'text':_0x23a696}]};}function toToolResult(_0xa295cd,_0x4dfd5b,_0x4b667c){const _0x47d14d=_0x2d3a0f,_0x32ec01=getNormalizedSurfaceId(_0xa295cd,_0x4dfd5b,_0x4b667c),_0x50c28e={'type':_0x47d14d(0x1a0),'resource':{'uri':_0x47d14d(0x16c)+encodeURIComponent(_0x32ec01),'mimeType':A2UI_MESSAGE_MEDIA_TYPE,'text':_0xa295cd[_0x47d14d(0x14a)]}};return{'content':[{'type':'text','text':'Generated\x20an\x20interactive\x20A2UI\x20interface.'},_0x50c28e]};}function toCatalogToolResult(_0x3ee18f){const _0x38f711=_0x2d3a0f;return{'content':[{'type':_0x38f711(0x181),'text':JSON['stringify'](_0x3ee18f)}],'structuredContent':_0x3ee18f};}async function createUIToolCallResult(_0x5e7b7a,_0x76a0cd=defaultNormalize,_0x2aeaec={}){const _0x56e737=_0x2d3a0f;try{const _0x2c2bb4=_0x5e7b7a['surfaceId'],_0x580260=await _0x76a0cd(_0x5e7b7a);return toToolResult(_0x580260,_0x2c2bb4,_0x2aeaec);}catch(_0x2297bb){const _0x1504ca=_0x2297bb instanceof Error?_0x2297bb[_0x56e737(0x16e)]:String(_0x2297bb);return toToolError(_0x1504ca);}}function toMCPResourceResult(_0x22aba8){return _0x22aba8;}function registerUICatalogResources(_0x1474fe,_0x3f3dbd){const _0x2ac9d4=_0x2d3a0f,_0x1cbca5=_0x1474fe['registerResource']('a2ui-catalog',CATALOG_RESOURCE_URI,{'title':_0x2ac9d4(0x149)+_0x3f3dbd['descriptor']['id'],'description':'A2UI\x20catalog\x20instructions\x20and\x20component\x20schema.','mimeType':'application/json'},_0x21bc7a=>toMCPResourceResult(createUICatalogResourcePayload(_0x3f3dbd,_0x21bc7a[_0x2ac9d4(0x180)])));return{'catalog':_0x1cbca5};}function registerUICatalogTools(_0x585d42,_0x478066){const _0x3b8031=_0x2d3a0f,_0x1d1d72=_0x585d42['registerTool'](GET_UI_CATALOG_TOOL_NAME,{'title':'Get\x20A2UI\x20Catalog','description':[_0x3b8031(0x16f)+UI_TOOL_NAME+'.',UI_TOOL_WORKFLOW_ORDER,_0x3b8031(0x173),'With\x20componentNames\x20it\x20returns\x20only\x20the\x20selected\x20generation\x20contract:\x20A2UI\x20guidance\x20in\x20catalog.instructions\x20and\x20machine-readable\x20component/function\x20definitions\x20in\x20catalog.definitions.\x20The\x20directory\x20is\x20omitted\x20from\x20this\x20selected\x20response.',_0x3b8031(0x164)][_0x3b8031(0x165)]('\x0a\x0a'),'inputSchema':createGetCatalogInputSchema(),'outputSchema':getCatalogOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]}},async _0x2d6df1=>{const _0x310be9=_0x3b8031;try{return toCatalogToolResult(getUICatalog(_0x478066,{'componentNames':_0x2d6df1['componentNames'],'functionNames':_0x2d6df1[_0x310be9(0x157)]}));}catch(_0x345f47){const _0x2ad9ac=_0x345f47 instanceof Error?_0x345f47['message']:String(_0x345f47);return toToolError(_0x2ad9ac);}});return{'get':_0x1d1d72};}function resolveSchemaDelivery(_0xb1cbdd='discovery'){const _0x5cfdcc=_0x2d3a0f;if(_0xb1cbdd===_0x5cfdcc(0x171)||_0xb1cbdd===_0x5cfdcc(0x18b))return _0xb1cbdd;throw new Error(_0x5cfdcc(0x1a1)+String(_0xb1cbdd)+_0x5cfdcc(0x160));}function registerGenericUITool(_0x492088,_0x5d6a21,_0xd9068b={}){const _0x2a0e1d=_0x2d3a0f,_0x8b90db=resolveSchemaDelivery(_0xd9068b['schemaDelivery']),_0x48d9cc=_0x8b90db==='inline'?createUISendToolSpec(_0x5d6a21):void 0x0,_0x513569=_0xd9068b[_0x2a0e1d(0x1a7)]??createUISendNormalizer({'catalog':_0x5d6a21}),_0x5c5e61=_0x48d9cc?z[_0x2a0e1d(0x14c)]({'surfaceId':z['string']()[_0x2a0e1d(0x190)](),'messages':z[_0x2a0e1d(0x156)]()})['meta'](_0x48d9cc[_0x2a0e1d(0x196)]):z['object'](createSendUIInputSchema(_0x5d6a21['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION));return _0x492088[_0x2a0e1d(0x188)](UI_TOOL_NAME,{'title':_0xd9068b['title'],'description':_0x48d9cc?.['description']??createGenericToolDescription(_0x5d6a21),'inputSchema':_0x5c5e61,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![],..._0xd9068b['annotations']}},async(_0x20419d,_0x13e459)=>{const _0x52ee3f=_0x2a0e1d,_0x2a3be8=validateA2UIClientCapability(getA2UIClientCapability(_0x492088,_0x13e459['_meta']),_0x5d6a21[_0x52ee3f(0x17f)]['id']);if(_0x2a3be8)return toToolError(_0x2a3be8);return createUIToolCallResult(_0x20419d,_0x513569,{'catalog':_0x5d6a21});});}function createUIMCPServer(_0x3d95ac={}){const _0x5454bd=_0x2d3a0f,_0x1a62d7=resolveSchemaDelivery(_0x3d95ac[_0x5454bd(0x17c)]),_0x53e790=createUIToolCatalog(_0x3d95ac['catalog'],_0x3d95ac['protocolVersion']),_0x1a5f2e=new McpServer({'name':_0x3d95ac[_0x5454bd(0x152)]?.['name']??_0x5454bd(0x19e),'version':_0x3d95ac[_0x5454bd(0x152)]?.[_0x5454bd(0x184)]??_0x5454bd(0x162)});registerUICatalogResources(_0x1a5f2e,_0x53e790);if(_0x1a62d7==='discovery')registerUICatalogTools(_0x1a5f2e,_0x53e790);return registerGenericUITool(_0x1a5f2e,_0x53e790,{..._0x3d95ac,'schemaDelivery':_0x1a62d7}),_0x1a5f2e;}export{_0xd83c53 as McpServer,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.5",
3
+ "version": "0.0.1-beta.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@modelcontextprotocol/sdk": "^1.29.0",
29
29
  "zod": "^4.4.3",
30
- "@agentic-ui-experience/ui-core": "0.0.1-beta.5"
30
+ "@agentic-ui-experience/ui-core": "0.0.1-beta.7"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^24.10.1"