@kadoa/mcp 0.4.1 → 0.4.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/dist/index.js +86 -92
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -6,25 +6,43 @@ var __getProtoOf = Object.getPrototypeOf;
6
6
  var __defProp = Object.defineProperty;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ function __accessProp(key) {
10
+ return this[key];
11
+ }
12
+ var __toESMCache_node;
13
+ var __toESMCache_esm;
9
14
  var __toESM = (mod, isNodeMode, target) => {
15
+ var canCache = mod != null && typeof mod === "object";
16
+ if (canCache) {
17
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
18
+ var cached = cache.get(mod);
19
+ if (cached)
20
+ return cached;
21
+ }
10
22
  target = mod != null ? __create(__getProtoOf(mod)) : {};
11
23
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
12
24
  for (let key of __getOwnPropNames(mod))
13
25
  if (!__hasOwnProp.call(to, key))
14
26
  __defProp(to, key, {
15
- get: () => mod[key],
27
+ get: __accessProp.bind(mod, key),
16
28
  enumerable: true
17
29
  });
30
+ if (canCache)
31
+ cache.set(mod, to);
18
32
  return to;
19
33
  };
20
34
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
+ var __returnValue = (v) => v;
36
+ function __exportSetter(name, newValue) {
37
+ this[name] = __returnValue.bind(null, newValue);
38
+ }
21
39
  var __export = (target, all) => {
22
40
  for (var name in all)
23
41
  __defProp(target, name, {
24
42
  get: all[name],
25
43
  enumerable: true,
26
44
  configurable: true,
27
- set: (newValue) => all[name] = () => newValue
45
+ set: __exportSetter.bind(all, name)
28
46
  });
29
47
  };
30
48
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -43738,6 +43756,12 @@ var init_axios2 = __esm(() => {
43738
43756
  } = axios_default);
43739
43757
  });
43740
43758
 
43759
+ // node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
43760
+ function isUnsafeProperty(key) {
43761
+ return key === "__proto__";
43762
+ }
43763
+ var init_isUnsafeProperty = () => {};
43764
+
43741
43765
  // node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
43742
43766
  function isPlainObject4(value) {
43743
43767
  if (!value || typeof value !== "object") {
@@ -43752,12 +43776,6 @@ function isPlainObject4(value) {
43752
43776
  }
43753
43777
  var init_isPlainObject = () => {};
43754
43778
 
43755
- // node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
43756
- function isUnsafeProperty(key) {
43757
- return key === "__proto__";
43758
- }
43759
- var init_isUnsafeProperty = () => {};
43760
-
43761
43779
  // node_modules/es-toolkit/dist/object/merge.mjs
43762
43780
  function merge3(target, source) {
43763
43781
  const sourceKeys = Object.keys(source);
@@ -43830,16 +43848,11 @@ var init_dist = __esm(() => {
43830
43848
  init_upperFirst();
43831
43849
  });
43832
43850
 
43833
- // node_modules/uuid/dist-node/stringify.js
43834
- function unsafeStringify(arr, offset = 0) {
43835
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
43836
- }
43837
- var byteToHex;
43838
- var init_stringify = __esm(() => {
43839
- byteToHex = [];
43840
- for (let i = 0;i < 256; ++i) {
43841
- byteToHex.push((i + 256).toString(16).slice(1));
43842
- }
43851
+ // node_modules/uuid/dist-node/native.js
43852
+ import { randomUUID } from "node:crypto";
43853
+ var native_default;
43854
+ var init_native = __esm(() => {
43855
+ native_default = { randomUUID };
43843
43856
  });
43844
43857
 
43845
43858
  // node_modules/uuid/dist-node/rng.js
@@ -43857,11 +43870,16 @@ var init_rng = __esm(() => {
43857
43870
  poolPtr = rnds8Pool.length;
43858
43871
  });
43859
43872
 
43860
- // node_modules/uuid/dist-node/native.js
43861
- import { randomUUID } from "node:crypto";
43862
- var native_default;
43863
- var init_native = __esm(() => {
43864
- native_default = { randomUUID };
43873
+ // node_modules/uuid/dist-node/stringify.js
43874
+ function unsafeStringify(arr, offset = 0) {
43875
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
43876
+ }
43877
+ var byteToHex;
43878
+ var init_stringify = __esm(() => {
43879
+ byteToHex = [];
43880
+ for (let i = 0;i < 256; ++i) {
43881
+ byteToHex.push((i + 256).toString(16).slice(1));
43882
+ }
43865
43883
  });
43866
43884
 
43867
43885
  // node_modules/uuid/dist-node/v4.js
@@ -46569,7 +46587,7 @@ var import_debug, __require2, BASE_PATH, BaseAPI = class {
46569
46587
  options: localVarRequestOptions
46570
46588
  };
46571
46589
  },
46572
- v4WorkflowsWorkflowIdDataGet: async (workflowId, xApiKey, authorization, runId, format, sortBy, order, filters, page, limit, gzip, rowIds, includeAnomalies, options = {}) => {
46590
+ v4WorkflowsWorkflowIdDataGet: async (workflowId, xApiKey, authorization, runId, format, sortBy2, order, filters, page, limit, gzip, rowIds, includeAnomalies, options = {}) => {
46573
46591
  assertParamExists("v4WorkflowsWorkflowIdDataGet", "workflowId", workflowId);
46574
46592
  const localVarPath = `/v4/workflows/{workflowId}/data`.replace(`{${"workflowId"}}`, encodeURIComponent(String(workflowId)));
46575
46593
  const localVarUrlObj = new URL$1(localVarPath, DUMMY_BASE_URL);
@@ -46588,8 +46606,8 @@ var import_debug, __require2, BASE_PATH, BaseAPI = class {
46588
46606
  if (format !== undefined) {
46589
46607
  localVarQueryParameter["format"] = format;
46590
46608
  }
46591
- if (sortBy !== undefined) {
46592
- localVarQueryParameter["sortBy"] = sortBy;
46609
+ if (sortBy2 !== undefined) {
46610
+ localVarQueryParameter["sortBy"] = sortBy2;
46593
46611
  }
46594
46612
  if (order !== undefined) {
46595
46613
  localVarQueryParameter["order"] = order;
@@ -46987,8 +47005,8 @@ var import_debug, __require2, BASE_PATH, BaseAPI = class {
46987
47005
  const localVarOperationServerBasePath = operationServerMap["WorkflowsApi.v4WorkflowsWorkflowIdComplianceRejectPut"]?.[localVarOperationServerIndex]?.url;
46988
47006
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
46989
47007
  },
46990
- async v4WorkflowsWorkflowIdDataGet(workflowId, xApiKey, authorization, runId, format, sortBy, order, filters, page, limit, gzip, rowIds, includeAnomalies, options) {
46991
- const localVarAxiosArgs = await localVarAxiosParamCreator.v4WorkflowsWorkflowIdDataGet(workflowId, xApiKey, authorization, runId, format, sortBy, order, filters, page, limit, gzip, rowIds, includeAnomalies, options);
47008
+ async v4WorkflowsWorkflowIdDataGet(workflowId, xApiKey, authorization, runId, format, sortBy2, order, filters, page, limit, gzip, rowIds, includeAnomalies, options) {
47009
+ const localVarAxiosArgs = await localVarAxiosParamCreator.v4WorkflowsWorkflowIdDataGet(workflowId, xApiKey, authorization, runId, format, sortBy2, order, filters, page, limit, gzip, rowIds, includeAnomalies, options);
46992
47010
  const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
46993
47011
  const localVarOperationServerBasePath = operationServerMap["WorkflowsApi.v4WorkflowsWorkflowIdDataGet"]?.[localVarOperationServerIndex]?.url;
46994
47012
  return (axios2, basePath) => createRequestFunction(localVarAxiosArgs, axios_default, BASE_PATH, configuration)(axios2, localVarOperationServerBasePath || basePath);
@@ -48416,11 +48434,11 @@ var import_debug, __require2, BASE_PATH, BaseAPI = class {
48416
48434
  }
48417
48435
  }, safeDelayMs);
48418
48436
  }
48419
- normalizeReconnectDelay(delay) {
48420
- if (typeof delay !== "number" || !Number.isFinite(delay)) {
48437
+ normalizeReconnectDelay(delay2) {
48438
+ if (typeof delay2 !== "number" || !Number.isFinite(delay2)) {
48421
48439
  return _Realtime2.DEFAULT_RECONNECT_DELAY_MS;
48422
48440
  }
48423
- return Math.min(Math.max(0, Math.trunc(delay)), _Realtime2.MAX_RECONNECT_DELAY_MS);
48441
+ return Math.min(Math.max(0, Math.trunc(delay2)), _Realtime2.MAX_RECONNECT_DELAY_MS);
48424
48442
  }
48425
48443
  isDuplicateEvent(eventId) {
48426
48444
  if (!eventId) {
@@ -49179,9 +49197,9 @@ var import_debug, __require2, BASE_PATH, BaseAPI = class {
49179
49197
  this._baseUrl = config2.baseUrl ?? PUBLIC_API_URI;
49180
49198
  this._apiKey = config2.apiKey ?? "";
49181
49199
  this._bearerToken = config2.bearerToken;
49182
- const timeout = config2.timeout ?? 30000;
49200
+ const timeout2 = config2.timeout ?? 30000;
49183
49201
  const headers = createSdkHeaders();
49184
- this._axiosInstance = createAxiosInstance({ timeout, headers });
49202
+ this._axiosInstance = createAxiosInstance({ timeout: timeout2, headers });
49185
49203
  this._axiosInstance.interceptors.request.use((reqConfig) => {
49186
49204
  if (this._bearerToken) {
49187
49205
  if (!reqConfig.headers["Authorization"]) {
@@ -50963,7 +50981,7 @@ function registerTools(server, ctx) {
50963
50981
  inputSchema: strictSchema({
50964
50982
  key: exports_external.string().describe("Variable key (must be unique within scope). Referenced in prompts as @key."),
50965
50983
  value: exports_external.string().describe("Variable value"),
50966
- dataType: exports_external.enum(["STRING", "NUMBER", "BOOLEAN", "JSON"]).optional().describe("Data type of the value (defaults to STRING)")
50984
+ dataType: exports_external.enum(["STRING", "SECRET", "OBJECT", "ARRAY"]).optional().describe("Data type of the value (defaults to STRING)")
50967
50985
  }),
50968
50986
  annotations: {
50969
50987
  readOnlyHint: false,
@@ -51017,7 +51035,7 @@ function registerTools(server, ctx) {
51017
51035
  variableId: exports_external.string().describe("The variable ID to update"),
51018
51036
  key: exports_external.string().optional().describe("New variable key"),
51019
51037
  value: exports_external.string().optional().describe("New variable value"),
51020
- dataType: exports_external.enum(["STRING", "NUMBER", "BOOLEAN", "JSON"]).optional().describe("New data type")
51038
+ dataType: exports_external.enum(["STRING", "SECRET", "OBJECT", "ARRAY"]).optional().describe("New data type")
51021
51039
  }),
51022
51040
  annotations: {
51023
51041
  readOnlyHint: false,
@@ -51065,7 +51083,7 @@ function registerTools(server, ctx) {
51065
51083
  });
51066
51084
  }));
51067
51085
  server.registerTool("list_templates", {
51068
- description: "List all templates in the current team. Templates define reusable configurations (prompt, schema, validation, notifications) that can be linked to multiple workflows.",
51086
+ description: "List all templates in the current team. Templates define reusable configurations (prompt, schema, notifications) that can be linked to multiple workflows.",
51069
51087
  inputSchema: strictSchema({}),
51070
51088
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
51071
51089
  }, withErrorHandling("list_templates", async () => {
@@ -51083,7 +51101,7 @@ function registerTools(server, ctx) {
51083
51101
  return jsonResult({ template });
51084
51102
  }));
51085
51103
  server.registerTool("create_template", {
51086
- description: "Create a new template. Templates define reusable configurations that can be linked to workflows. After creation, use create_template_version to publish a version with prompt, schema, and validation rules.",
51104
+ description: "Create a new template. Templates define reusable configurations that can be linked to workflows. After creation, use create_template_version to publish a version with prompt, schema, and notifications.",
51087
51105
  inputSchema: strictSchema({
51088
51106
  name: exports_external.string().describe("Template name (1-255 chars)"),
51089
51107
  description: exports_external.string().optional().describe("Template description (max 2000 chars)")
@@ -51153,37 +51171,13 @@ function registerTools(server, ctx) {
51153
51171
  isKey: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).optional().describe("Whether the field is a key field")
51154
51172
  };
51155
51173
  server.registerTool("create_template_version", {
51156
- description: "Publish a new version of a template. Versions capture the full workflow config: prompt, schema, validation rules, and notifications. All fields are optional — include only what this version should set.",
51174
+ description: "Publish a new version of a template. Versions capture the full workflow config: prompt, schema, and notifications. All fields are optional — include only what this version should set.",
51157
51175
  inputSchema: strictSchema({
51158
51176
  templateId: exports_external.string().describe("The template ID to publish a version for"),
51159
51177
  prompt: exports_external.string().optional().describe("User prompt to copy into workflow config"),
51160
51178
  schemaId: exports_external.string().optional().describe("Existing schema ID to reference (mutually exclusive with schemaFields)"),
51161
51179
  schemaFields: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object(TemplateSchemaFieldShape))).optional().describe("Inline schema fields to create a new schema (mutually exclusive with schemaId)"),
51162
51180
  schemaEntity: exports_external.string().optional().describe("Entity name for the inline schema"),
51163
- dataValidation: exports_external.preprocess(coerceJson(), exports_external.object({
51164
- config: exports_external.object({
51165
- enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()).describe("Whether data validation is enabled"),
51166
- alerting: exports_external.object({
51167
- system: exports_external.object({
51168
- enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()),
51169
- threshold: exports_external.preprocess(coerceNumber(), exports_external.number()).optional()
51170
- }).optional().describe("System alerting configuration"),
51171
- user: exports_external.object({
51172
- enabled: exports_external.preprocess(coerceBoolean(), exports_external.boolean()),
51173
- threshold: exports_external.preprocess(coerceNumber(), exports_external.number()).optional()
51174
- }).optional().describe("User alerting configuration")
51175
- }).optional().describe("Alerting configuration")
51176
- }).optional().describe("Data validation config to copy into workflow.config.dataValidation"),
51177
- rules: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object({
51178
- name: exports_external.string().describe("Rule name"),
51179
- description: exports_external.string().optional().describe("Rule description"),
51180
- ruleType: exports_external.enum(["regex", "custom_sql", "llm"]).describe("Type of validation rule"),
51181
- targetColumns: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.string())).optional().describe("Columns this rule targets"),
51182
- parameters: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).describe("Rule parameters (e.g., {sql: '...', pattern: '...'})"),
51183
- status: exports_external.enum(["preview", "enabled", "disabled"]).optional().describe("Initial rule status (defaults to 'enabled')"),
51184
- metadata: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).optional().describe("Additional metadata")
51185
- }))).optional().describe("Validation rules to clone as data_validation rows")
51186
- })).optional().describe("Data validation configuration: { config?: { enabled, alerting? }, rules?: [{ name, ruleType, parameters, ... }] }"),
51187
51181
  notifications: exports_external.preprocess(coerceArray(), exports_external.array(exports_external.object({
51188
51182
  eventType: exports_external.string().describe("Notification event type"),
51189
51183
  eventConfiguration: exports_external.preprocess(coerceJson(), exports_external.record(exports_external.string(), exports_external.unknown())).optional(),
@@ -51269,7 +51263,7 @@ function registerTools(server, ctx) {
51269
51263
  });
51270
51264
  }));
51271
51265
  server.registerTool("apply_template_update", {
51272
- description: "Apply a specific template version to workflows. Updates the workflows' config (prompt, schema, validation, notifications) to match the specified version.",
51266
+ description: "Apply a specific template version to workflows. Updates the workflows' config (prompt, schema, notifications) to match the specified version.",
51273
51267
  inputSchema: strictSchema({
51274
51268
  templateId: exports_external.string().describe("The template ID"),
51275
51269
  targetVersion: exports_external.preprocess(coerceNumber(), exports_external.number().int().min(1)).describe("Version number to apply"),
@@ -51288,7 +51282,7 @@ function registerTools(server, ctx) {
51288
51282
  });
51289
51283
  }));
51290
51284
  server.registerTool("save_workflow_as_template", {
51291
- description: "Create a template from an existing workflow's configuration (prompt, schema, validation, notifications). " + "Provide 'name' to create a new template, or 'templateId' to add a new version to an existing template.",
51285
+ description: "Create a template from an existing workflow's configuration (prompt, schema, notifications). " + "Provide 'name' to create a new template, or 'templateId' to add a new version to an existing template.",
51292
51286
  inputSchema: strictSchema({
51293
51287
  workflowId: exports_external.string().describe("Source workflow ID to extract config from"),
51294
51288
  name: exports_external.string().optional().describe("Name for the new template (required if templateId is not set)"),
@@ -51341,7 +51335,7 @@ var package_default;
51341
51335
  var init_package = __esm(() => {
51342
51336
  package_default = {
51343
51337
  name: "@kadoa/mcp",
51344
- version: "0.4.1",
51338
+ version: "0.4.2",
51345
51339
  description: "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
51346
51340
  type: "module",
51347
51341
  main: "dist/index.js",
@@ -51359,7 +51353,7 @@ var init_package = __esm(() => {
51359
51353
  build: "bun build src/index.ts --outdir=dist --target=node --external express --external ioredis",
51360
51354
  "check-types": "tsc --noEmit",
51361
51355
  test: "BUN_TEST=1 bun test",
51362
- "test:unit": "BUN_TEST=1 bun test tests/unit --timeout=120000",
51356
+ "test:unit": "BUN_TEST=1 bun test tests/unit/server.test.ts --timeout=120000 && BUN_TEST=1 bun test $(find tests/unit -maxdepth 1 -name '*.test.ts' ! -name 'server.test.ts') --timeout=120000",
51363
51357
  "test:e2e": "BUN_TEST=1 bun test tests/e2e --timeout=600000",
51364
51358
  "test:eval": "BUN_TEST=1 bun test tests/evals --timeout=300000",
51365
51359
  prepublishOnly: "bun run check-types && bun run test:unit && bun run build"
@@ -51469,7 +51463,7 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
51469
51463
  };
51470
51464
  writable.on("close", cancel);
51471
51465
  writable.on("error", cancel);
51472
- (currentReadPromise ?? reader.read()).then(flow, handleStreamError);
51466
+ (currentReadPromise ?? reader.read()).then(flow2, handleStreamError);
51473
51467
  return reader.closed.finally(() => {
51474
51468
  writable.off("close", cancel);
51475
51469
  writable.off("error", cancel);
@@ -51480,16 +51474,16 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
51480
51474
  }
51481
51475
  }
51482
51476
  function onDrain() {
51483
- reader.read().then(flow, handleStreamError);
51477
+ reader.read().then(flow2, handleStreamError);
51484
51478
  }
51485
- function flow({ done, value }) {
51479
+ function flow2({ done, value }) {
51486
51480
  try {
51487
51481
  if (done) {
51488
51482
  writable.end();
51489
51483
  } else if (!writable.write(value)) {
51490
51484
  writable.once("drain", onDrain);
51491
51485
  } else {
51492
- return reader.read().then(flow, handleStreamError);
51486
+ return reader.read().then(flow2, handleStreamError);
51493
51487
  }
51494
51488
  } catch (e) {
51495
51489
  handleStreamError(e);
@@ -51660,8 +51654,8 @@ var RequestError, toRequestError = (e) => {
51660
51654
  await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
51661
51655
  }
51662
51656
  outgoing[outgoingEnded]?.();
51663
- }, isPromise = (res) => typeof res.then === "function", responseViaResponseObject = async (res, outgoing, options = {}) => {
51664
- if (isPromise(res)) {
51657
+ }, isPromise2 = (res) => typeof res.then === "function", responseViaResponseObject = async (res, outgoing, options = {}) => {
51658
+ if (isPromise2(res)) {
51665
51659
  if (options.errorHandler) {
51666
51660
  try {
51667
51661
  res = await res;
@@ -51689,11 +51683,11 @@ var RequestError, toRequestError = (e) => {
51689
51683
  let maxReadCount = 2;
51690
51684
  for (let i = 0;i < maxReadCount; i++) {
51691
51685
  currentReadPromise ||= reader.read();
51692
- const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
51686
+ const chunk2 = await readWithoutBlocking(currentReadPromise).catch((e) => {
51693
51687
  console.error(e);
51694
51688
  done = true;
51695
51689
  });
51696
- if (!chunk) {
51690
+ if (!chunk2) {
51697
51691
  if (i === 1) {
51698
51692
  await new Promise((resolve) => setTimeout(resolve));
51699
51693
  maxReadCount = 3;
@@ -51702,10 +51696,10 @@ var RequestError, toRequestError = (e) => {
51702
51696
  break;
51703
51697
  }
51704
51698
  currentReadPromise = undefined;
51705
- if (chunk.value) {
51706
- values.push(chunk.value);
51699
+ if (chunk2.value) {
51700
+ values.push(chunk2.value);
51707
51701
  }
51708
- if (chunk.done) {
51702
+ if (chunk2.done) {
51709
51703
  done = true;
51710
51704
  break;
51711
51705
  }
@@ -52842,7 +52836,7 @@ var require_lib = __commonJS((exports, module) => {
52842
52836
  preflightContinue: false,
52843
52837
  optionsSuccessStatus: 204
52844
52838
  };
52845
- function isString2(s) {
52839
+ function isString3(s) {
52846
52840
  return typeof s === "string" || s instanceof String;
52847
52841
  }
52848
52842
  function isOriginAllowed(origin2, allowedOrigin) {
@@ -52853,7 +52847,7 @@ var require_lib = __commonJS((exports, module) => {
52853
52847
  }
52854
52848
  }
52855
52849
  return false;
52856
- } else if (isString2(allowedOrigin)) {
52850
+ } else if (isString3(allowedOrigin)) {
52857
52851
  return origin2 === allowedOrigin;
52858
52852
  } else if (allowedOrigin instanceof RegExp) {
52859
52853
  return allowedOrigin.test(origin2);
@@ -52868,7 +52862,7 @@ var require_lib = __commonJS((exports, module) => {
52868
52862
  key: "Access-Control-Allow-Origin",
52869
52863
  value: "*"
52870
52864
  }]);
52871
- } else if (isString2(options.origin)) {
52865
+ } else if (isString3(options.origin)) {
52872
52866
  headers.push([{
52873
52867
  key: "Access-Control-Allow-Origin",
52874
52868
  value: options.origin
@@ -53513,7 +53507,7 @@ var require_ipv6 = __commonJS((exports) => {
53513
53507
  n = n.replace(/^(0{1,})(0)$/, '<span class="parse-error">$1</span>$2');
53514
53508
  return n;
53515
53509
  }
53516
- function compact(address, slice) {
53510
+ function compact2(address, slice) {
53517
53511
  const s1 = [];
53518
53512
  const s2 = [];
53519
53513
  let i;
@@ -53753,7 +53747,7 @@ var require_ipv6 = __commonJS((exports) => {
53753
53747
  const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1);
53754
53748
  if (zeroes.length > 0) {
53755
53749
  const index = zeroLengths.indexOf(Math.max(...zeroLengths));
53756
- groups = compact(this.parsedAddress, zeroes[index]);
53750
+ groups = compact2(this.parsedAddress, zeroes[index]);
53757
53751
  } else {
53758
53752
  groups = this.parsedAddress;
53759
53753
  }
@@ -53803,14 +53797,14 @@ var require_ipv6 = __commonJS((exports) => {
53803
53797
  const halves = address.split("::");
53804
53798
  if (halves.length === 2) {
53805
53799
  let first = halves[0].split(":");
53806
- let last = halves[1].split(":");
53800
+ let last2 = halves[1].split(":");
53807
53801
  if (first.length === 1 && first[0] === "") {
53808
53802
  first = [];
53809
53803
  }
53810
- if (last.length === 1 && last[0] === "") {
53811
- last = [];
53804
+ if (last2.length === 1 && last2[0] === "") {
53805
+ last2 = [];
53812
53806
  }
53813
- const remaining = this.groups - (first.length + last.length);
53807
+ const remaining = this.groups - (first.length + last2.length);
53814
53808
  if (!remaining) {
53815
53809
  throw new address_error_1.AddressError("Error parsing groups");
53816
53810
  }
@@ -53821,7 +53815,7 @@ var require_ipv6 = __commonJS((exports) => {
53821
53815
  for (let i = 0;i < remaining; i++) {
53822
53816
  groups.push("0");
53823
53817
  }
53824
- groups = groups.concat(last);
53818
+ groups = groups.concat(last2);
53825
53819
  } else if (halves.length === 1) {
53826
53820
  groups = address.split(":");
53827
53821
  this.elidedGroups = 0;
@@ -56457,7 +56451,7 @@ async function startHttpServer(options) {
56457
56451
  });
56458
56452
  return;
56459
56453
  }
56460
- const identity = `jwt:${auth.userId.slice(0, 8)}...:team=${auth.teamId.slice(0, 8)}...`;
56454
+ const identity2 = `jwt:${auth.userId.slice(0, 8)}...:team=${auth.teamId.slice(0, 8)}...`;
56461
56455
  if (isJwtExpired(auth.jwt)) {
56462
56456
  try {
56463
56457
  const refreshed = await refreshSupabaseJwtRaw(auth.refreshToken);
@@ -56473,13 +56467,13 @@ async function startHttpServer(options) {
56473
56467
  supabaseJwt: refreshed.jwt,
56474
56468
  supabaseRefreshToken: refreshed.refreshToken
56475
56469
  }, Math.ceil(remainingMs / 1000));
56476
- console.error(`[PROACTIVE_REFRESH] OK: JWT refreshed on ${method} (${identity})`);
56470
+ console.error(`[PROACTIVE_REFRESH] OK: JWT refreshed on ${method} (${identity2})`);
56477
56471
  }
56478
56472
  }
56479
56473
  }
56480
56474
  } catch (error48) {
56481
56475
  if (error48 instanceof SessionExpiredError) {
56482
- console.error(`[PROACTIVE_REFRESH] Session dead on ${method} (${identity}): ${error48.message}`);
56476
+ console.error(`[PROACTIVE_REFRESH] Session dead on ${method} (${identity2}): ${error48.message}`);
56483
56477
  await store.del("access_tokens", auth.mcpToken);
56484
56478
  res.status(401).json({
56485
56479
  jsonrpc: "2.0",
@@ -56492,7 +56486,7 @@ async function startHttpServer(options) {
56492
56486
  }
56493
56487
  }
56494
56488
  try {
56495
- console.error(`[MCP] POST method=${method} auth=${identity}`);
56489
+ console.error(`[MCP] POST method=${method} auth=${identity2}`);
56496
56490
  const transport = new StreamableHTTPServerTransport({
56497
56491
  sessionIdGenerator: undefined
56498
56492
  });
@@ -56524,7 +56518,7 @@ async function startHttpServer(options) {
56524
56518
  await server.connect(transport);
56525
56519
  await transport.handleRequest(req, res, req.body);
56526
56520
  } catch (error48) {
56527
- console.error(`[MCP] 500 method=${method} auth=${identity} error=`, error48);
56521
+ console.error(`[MCP] 500 method=${method} auth=${identity2} error=`, error48);
56528
56522
  if (!res.headersSent) {
56529
56523
  res.status(500).json({
56530
56524
  jsonrpc: "2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoa/mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "build": "bun build src/index.ts --outdir=dist --target=node --external express --external ioredis",
19
19
  "check-types": "tsc --noEmit",
20
20
  "test": "BUN_TEST=1 bun test",
21
- "test:unit": "BUN_TEST=1 bun test tests/unit --timeout=120000",
21
+ "test:unit": "BUN_TEST=1 bun test tests/unit/server.test.ts --timeout=120000 && BUN_TEST=1 bun test $(find tests/unit -maxdepth 1 -name '*.test.ts' ! -name 'server.test.ts') --timeout=120000",
22
22
  "test:e2e": "BUN_TEST=1 bun test tests/e2e --timeout=600000",
23
23
  "test:eval": "BUN_TEST=1 bun test tests/evals --timeout=300000",
24
24
  "prepublishOnly": "bun run check-types && bun run test:unit && bun run build"