@triptease/design-system-mcp 1.3.0 → 1.3.1

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/dist/index.js +176 -10
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -24640,10 +24640,9 @@ var ProgressTokenSchema = union([string2(), number2().int()]);
24640
24640
  var CursorSchema = string2();
24641
24641
  var TaskCreationParamsSchema = looseObject({
24642
24642
  /**
24643
- * Time in milliseconds to keep task results available after completion.
24644
- * If null, the task has unlimited lifetime until manually cleaned up.
24643
+ * Requested duration in milliseconds to retain task from creation.
24645
24644
  */
24646
- ttl: union([number2(), _null3()]).optional(),
24645
+ ttl: number2().optional(),
24647
24646
  /**
24648
24647
  * Time in milliseconds to wait between task status requests.
24649
24648
  */
@@ -24943,7 +24942,11 @@ var ClientCapabilitiesSchema = object2({
24943
24942
  /**
24944
24943
  * Present if the client supports task creation.
24945
24944
  */
24946
- tasks: ClientTasksCapabilitySchema.optional()
24945
+ tasks: ClientTasksCapabilitySchema.optional(),
24946
+ /**
24947
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
24948
+ */
24949
+ extensions: record(string2(), AssertObjectSchema).optional()
24947
24950
  });
24948
24951
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
24949
24952
  /**
@@ -25004,7 +25007,11 @@ var ServerCapabilitiesSchema = object2({
25004
25007
  /**
25005
25008
  * Present if the server supports task creation.
25006
25009
  */
25007
- tasks: ServerTasksCapabilitySchema.optional()
25010
+ tasks: ServerTasksCapabilitySchema.optional(),
25011
+ /**
25012
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
25013
+ */
25014
+ extensions: record(string2(), AssertObjectSchema).optional()
25008
25015
  });
25009
25016
  var InitializeResultSchema = ResultSchema.extend({
25010
25017
  /**
@@ -25196,6 +25203,12 @@ var ResourceSchema = object2({
25196
25203
  * The MIME type of this resource, if known.
25197
25204
  */
25198
25205
  mimeType: optional(string2()),
25206
+ /**
25207
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
25208
+ *
25209
+ * This can be used by Hosts to display file sizes and estimate context window usage.
25210
+ */
25211
+ size: optional(number2()),
25199
25212
  /**
25200
25213
  * Optional annotations for the client.
25201
25214
  */
@@ -27691,6 +27704,10 @@ var Protocol = class {
27691
27704
  this._progressHandlers.clear();
27692
27705
  this._taskProgressTokens.clear();
27693
27706
  this._pendingDebouncedNotifications.clear();
27707
+ for (const info of this._timeoutInfo.values()) {
27708
+ clearTimeout(info.timeoutId);
27709
+ }
27710
+ this._timeoutInfo.clear();
27694
27711
  for (const controller of this._requestHandlerAbortControllers.values()) {
27695
27712
  controller.abort();
27696
27713
  }
@@ -27821,7 +27838,9 @@ var Protocol = class {
27821
27838
  await capturedTransport?.send(errorResponse);
27822
27839
  }
27823
27840
  }).catch((error48) => this._onerror(new Error(`Failed to send response: ${error48}`))).finally(() => {
27824
- this._requestHandlerAbortControllers.delete(request.id);
27841
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
27842
+ this._requestHandlerAbortControllers.delete(request.id);
27843
+ }
27825
27844
  });
27826
27845
  }
27827
27846
  _onprogress(notification) {
@@ -28517,6 +28536,147 @@ var ExperimentalServerTasks = class {
28517
28536
  requestStream(request, resultSchema, options) {
28518
28537
  return this._server.requestStream(request, resultSchema, options);
28519
28538
  }
28539
+ /**
28540
+ * Sends a sampling request and returns an AsyncGenerator that yields response messages.
28541
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
28542
+ *
28543
+ * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
28544
+ * before the final result.
28545
+ *
28546
+ * @example
28547
+ * ```typescript
28548
+ * const stream = server.experimental.tasks.createMessageStream({
28549
+ * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
28550
+ * maxTokens: 100
28551
+ * }, {
28552
+ * onprogress: (progress) => {
28553
+ * // Handle streaming tokens via progress notifications
28554
+ * console.log('Progress:', progress.message);
28555
+ * }
28556
+ * });
28557
+ *
28558
+ * for await (const message of stream) {
28559
+ * switch (message.type) {
28560
+ * case 'taskCreated':
28561
+ * console.log('Task created:', message.task.taskId);
28562
+ * break;
28563
+ * case 'taskStatus':
28564
+ * console.log('Task status:', message.task.status);
28565
+ * break;
28566
+ * case 'result':
28567
+ * console.log('Final result:', message.result);
28568
+ * break;
28569
+ * case 'error':
28570
+ * console.error('Error:', message.error);
28571
+ * break;
28572
+ * }
28573
+ * }
28574
+ * ```
28575
+ *
28576
+ * @param params - The sampling request parameters
28577
+ * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
28578
+ * @returns AsyncGenerator that yields ResponseMessage objects
28579
+ *
28580
+ * @experimental
28581
+ */
28582
+ createMessageStream(params, options) {
28583
+ const clientCapabilities = this._server.getClientCapabilities();
28584
+ if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
28585
+ throw new Error("Client does not support sampling tools capability.");
28586
+ }
28587
+ if (params.messages.length > 0) {
28588
+ const lastMessage = params.messages[params.messages.length - 1];
28589
+ const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
28590
+ const hasToolResults = lastContent.some((c) => c.type === "tool_result");
28591
+ const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
28592
+ const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
28593
+ const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
28594
+ if (hasToolResults) {
28595
+ if (lastContent.some((c) => c.type !== "tool_result")) {
28596
+ throw new Error("The last message must contain only tool_result content if any is present");
28597
+ }
28598
+ if (!hasPreviousToolUse) {
28599
+ throw new Error("tool_result blocks are not matching any tool_use from the previous message");
28600
+ }
28601
+ }
28602
+ if (hasPreviousToolUse) {
28603
+ const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
28604
+ const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
28605
+ if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
28606
+ throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
28607
+ }
28608
+ }
28609
+ }
28610
+ return this.requestStream({
28611
+ method: "sampling/createMessage",
28612
+ params
28613
+ }, CreateMessageResultSchema, options);
28614
+ }
28615
+ /**
28616
+ * Sends an elicitation request and returns an AsyncGenerator that yields response messages.
28617
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
28618
+ *
28619
+ * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
28620
+ * and 'taskStatus' messages before the final result.
28621
+ *
28622
+ * @example
28623
+ * ```typescript
28624
+ * const stream = server.experimental.tasks.elicitInputStream({
28625
+ * mode: 'url',
28626
+ * message: 'Please authenticate',
28627
+ * elicitationId: 'auth-123',
28628
+ * url: 'https://example.com/auth'
28629
+ * }, {
28630
+ * task: { ttl: 300000 } // Task-augmented for long-running auth flow
28631
+ * });
28632
+ *
28633
+ * for await (const message of stream) {
28634
+ * switch (message.type) {
28635
+ * case 'taskCreated':
28636
+ * console.log('Task created:', message.task.taskId);
28637
+ * break;
28638
+ * case 'taskStatus':
28639
+ * console.log('Task status:', message.task.status);
28640
+ * break;
28641
+ * case 'result':
28642
+ * console.log('User action:', message.result.action);
28643
+ * break;
28644
+ * case 'error':
28645
+ * console.error('Error:', message.error);
28646
+ * break;
28647
+ * }
28648
+ * }
28649
+ * ```
28650
+ *
28651
+ * @param params - The elicitation request parameters
28652
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
28653
+ * @returns AsyncGenerator that yields ResponseMessage objects
28654
+ *
28655
+ * @experimental
28656
+ */
28657
+ elicitInputStream(params, options) {
28658
+ const clientCapabilities = this._server.getClientCapabilities();
28659
+ const mode = params.mode ?? "form";
28660
+ switch (mode) {
28661
+ case "url": {
28662
+ if (!clientCapabilities?.elicitation?.url) {
28663
+ throw new Error("Client does not support url elicitation.");
28664
+ }
28665
+ break;
28666
+ }
28667
+ case "form": {
28668
+ if (!clientCapabilities?.elicitation?.form) {
28669
+ throw new Error("Client does not support form elicitation.");
28670
+ }
28671
+ break;
28672
+ }
28673
+ }
28674
+ const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
28675
+ return this.requestStream({
28676
+ method: "elicitation/create",
28677
+ params: normalizedParams
28678
+ }, ElicitResultSchema, options);
28679
+ }
28520
28680
  /**
28521
28681
  * Gets the current status of a task.
28522
28682
  *
@@ -29915,6 +30075,9 @@ var McpServer = class {
29915
30075
  annotations = rest.shift();
29916
30076
  }
29917
30077
  } else if (typeof firstArg === "object" && firstArg !== null) {
30078
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
30079
+ throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
30080
+ }
29918
30081
  annotations = rest.shift();
29919
30082
  }
29920
30083
  }
@@ -30057,6 +30220,9 @@ function getZodSchemaObject(schema) {
30057
30220
  if (isZodRawShapeCompat(schema)) {
30058
30221
  return objectFromShape(schema);
30059
30222
  }
30223
+ if (!isZodSchemaInstance(schema)) {
30224
+ throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
30225
+ }
30060
30226
  return schema;
30061
30227
  }
30062
30228
  function promptArgumentsFromSchema(schema) {
@@ -30196,7 +30362,7 @@ var StdioServerTransport = class {
30196
30362
  // package.json
30197
30363
  var package_default = {
30198
30364
  name: "@triptease/design-system-mcp",
30199
- version: "1.3.0",
30365
+ version: "1.3.1",
30200
30366
  description: "MCP server for Triptease design system documentation",
30201
30367
  type: "module",
30202
30368
  main: "dist/index.js",
@@ -30235,15 +30401,15 @@ var package_default = {
30235
30401
  "@triptease/tt-weekday-picker": "1.0.1"
30236
30402
  },
30237
30403
  dependencies: {
30238
- "@triptease/stylesheet": "2.1.11"
30404
+ "@triptease/stylesheet": "3.0.0"
30239
30405
  },
30240
30406
  devDependencies: {
30241
- "@modelcontextprotocol/sdk": "1.26.0",
30407
+ "@modelcontextprotocol/sdk": "^1.29.0",
30242
30408
  esbuild: "^0.27.3",
30243
30409
  "tsc-alias": "^1.8.16",
30244
30410
  typescript: "^5.7.2",
30245
30411
  "vite-tsconfig-paths": "^6.0.5",
30246
- vitest: "4.1.2",
30412
+ vitest: "^4.1.4",
30247
30413
  zod: "4.3.6"
30248
30414
  },
30249
30415
  publishConfig: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triptease/design-system-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "MCP server for Triptease design system documentation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,15 +39,15 @@
39
39
  "@triptease/tt-weekday-picker": "1.0.1"
40
40
  },
41
41
  "dependencies": {
42
- "@triptease/stylesheet": "2.1.11"
42
+ "@triptease/stylesheet": "3.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@modelcontextprotocol/sdk": "1.26.0",
45
+ "@modelcontextprotocol/sdk": "^1.29.0",
46
46
  "esbuild": "^0.27.3",
47
47
  "tsc-alias": "^1.8.16",
48
48
  "typescript": "^5.7.2",
49
49
  "vite-tsconfig-paths": "^6.0.5",
50
- "vitest": "4.1.2",
50
+ "vitest": "^4.1.4",
51
51
  "zod": "4.3.6"
52
52
  },
53
53
  "publishConfig": {