keryx 0.36.1 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util/mcpServer.ts +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keryx",
3
- "version": "0.36.1",
3
+ "version": "0.36.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/util/mcpServer.ts CHANGED
@@ -363,9 +363,24 @@ export async function adoptMcpSession(
363
363
  * Actions with `mcp.tool === false` are excluded from tool registration.
364
364
  */
365
365
  export function createMcpServer(): McpServer {
366
+ // Advertise the MCP Apps UI extension so hosts negotiate UI support during
367
+ // `initialize` (spec 2026-01-26, SEP-1724). Only declared when at least one
368
+ // action ships a UI, keeping the capability surface minimal.
369
+ const hasUiActions = api.actions.actions.some((a: Action) => a.mcp?.ui);
366
370
  const mcpServer = new McpServer(
367
371
  { name: pkg.name, version: pkg.version },
368
- { instructions: config.server.mcp.instructions },
372
+ {
373
+ instructions: config.server.mcp.instructions,
374
+ ...(hasUiActions
375
+ ? {
376
+ capabilities: {
377
+ extensions: {
378
+ [UI_EXTENSION_ID]: { mimeTypes: [MCP_APP_MIME_TYPE] },
379
+ },
380
+ },
381
+ }
382
+ : {}),
383
+ },
369
384
  );
370
385
 
371
386
  registerTools(mcpServer);
@@ -376,6 +391,12 @@ export function createMcpServer(): McpServer {
376
391
  return mcpServer;
377
392
  }
378
393
 
394
+ /**
395
+ * MCP Apps extension identifier used for capability negotiation during `initialize`.
396
+ * @see https://github.com/modelcontextprotocol/ext-apps
397
+ */
398
+ const UI_EXTENSION_ID = "io.modelcontextprotocol/ui";
399
+
379
400
  /**
380
401
  * Compute the `ui://` resource URI for an action's MCP App.
381
402
  * Defaults to `ui://<tool-name>` when `mcp.ui.resourceUri` is not set.
@@ -496,6 +517,8 @@ function registerTools(mcpServer: McpServer) {
496
517
 
497
518
  // MCP App responses carry both a text block (added to model context)
498
519
  // and structuredContent (delivered to the app UI for rendering).
520
+ // ext-apps hosts render the UI from the tool's `_meta.ui.resourceUri`
521
+ // and the separate `ui://` resource — the content array stays text-only.
499
522
  if (response instanceof UIResponse) {
500
523
  return {
501
524
  content: [{ type: "text" as const, text: response.text }],