@corsair-dev/mcp 0.1.20 → 0.1.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"openai-agents.d.ts","sourceRoot":"","sources":["../../src/adapters/openai-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,MAAM,2BAA2B,GAAG,cAAc,GAAG;IAC1D,IAAI,EAAE,OAAO,UAAU,CAAC;CACxB,CAAC;AAEF,qBAAa,oBAAoB;IAChC,QAAQ,CAAC,IAAI,mBAAmB;IAEhC,KAAK,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE;CA4C5D"}
1
+ {"version":3,"file":"openai-agents.d.ts","sourceRoot":"","sources":["../../src/adapters/openai-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,2BAA2B,GAAG,cAAc,GAAG;IAC1D,IAAI,EAAE,OAAO,UAAU,CAAC;CACxB,CAAC;AAEF,qBAAa,oBAAoB;IAChC,QAAQ,CAAC,IAAI,mBAAmB;IAEhC,KAAK,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE;CA0C5D"}
@@ -0,0 +1,4 @@
1
+ import type { ZodRawShape } from 'zod';
2
+ /** Convert a Zod v4 raw shape to JSON Schema for tool parameter definitions. */
3
+ export declare function shapeToJsonSchema(shape: ZodRawShape): Record<string, unknown>;
4
+ //# sourceMappingURL=json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/core/json-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAGvC,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK7E"}
package/dist/index.js CHANGED
@@ -1,10 +1,19 @@
1
1
  // src/adapters/anthropic-api.ts
2
- import { z as z2 } from "zod";
3
- import { zodToJsonSchema } from "zod-to-json-schema";
2
+ import { z as z3 } from "zod";
3
+
4
+ // src/core/json-schema.ts
5
+ import { z } from "zod";
6
+ import * as z4mini from "zod/v4-mini";
7
+ function shapeToJsonSchema(shape) {
8
+ return z4mini.toJSONSchema(z.object(shape), {
9
+ target: "draft-7",
10
+ io: "input"
11
+ });
12
+ }
4
13
 
5
14
  // src/core/tools.ts
6
15
  import { listOperations, setupCorsair } from "corsair";
7
- import { z } from "zod";
16
+ import { z as z2 } from "zod";
8
17
 
9
18
  // src/core/schema-format.ts
10
19
  import { formatDocSchemaShape, getSchema } from "corsair";
@@ -26,8 +35,8 @@ function buildCorsairToolDefs(options) {
26
35
  name: "list_operations",
27
36
  description: "List available Corsair operations. Without options returns all API endpoints across every plugin. Filter by plugin (e.g. 'slack') and/or type ('api' | 'webhooks' | 'db').",
28
37
  shape: {
29
- plugin: z.string().optional().describe("Plugin ID to filter by, e.g. 'slack' or 'github'"),
30
- type: z.enum(["api", "webhooks", "db"]).optional().describe("Operation type: 'api' (default), 'webhooks', or 'db'")
38
+ plugin: z2.string().optional().describe("Plugin ID to filter by, e.g. 'slack' or 'github'"),
39
+ type: z2.enum(["api", "webhooks", "db"]).optional().describe("Operation type: 'api' (default), 'webhooks', or 'db'")
31
40
  },
32
41
  handler: async ({ plugin, type }) => {
33
42
  const result = listOperations(corsair, {
@@ -43,7 +52,7 @@ function buildCorsairToolDefs(options) {
43
52
  name: "get_schema",
44
53
  description: "Get the schema and metadata for a Corsair operation path. Accepts API paths ('slack.api.channels.list'), webhook paths ('slack.webhooks.messages.message'), or DB paths ('slack.db.messages.search').",
45
54
  shape: {
46
- path: z.string().describe(
55
+ path: z2.string().describe(
47
56
  "Full dot-path from list_operations, e.g. 'slack.api.channels.list'"
48
57
  )
49
58
  },
@@ -61,7 +70,7 @@ function buildCorsairToolDefs(options) {
61
70
  name: "run_script",
62
71
  description: "Run a JavaScript script with `corsair` as the only variable in scope. Call Corsair operations, filter or transform the results inline, and return only what you need. The return value becomes the tool output.",
63
72
  shape: {
64
- code: z.string().describe(
73
+ code: z2.string().describe(
65
74
  'Async JS script with `corsair` in scope. Return the value you want. Example:\nconst result = await corsair.slack.api.channels.list({});\nconst channel = result.channels?.find(c => c.name === "general");\nreturn channel?.id;'
66
75
  )
67
76
  },
@@ -106,7 +115,7 @@ ${full}`
106
115
  name: "corsair_setup",
107
116
  description: "Helps the user configure Corsair. Call this to see if any keys or tokens need to be set up. It will also provide the instructions to set them up. For multi-tenant Corsair instances, pass tenantId to set up a specific tenant.",
108
117
  shape: {
109
- tenantId: z.string().optional().describe(
118
+ tenantId: z2.string().optional().describe(
110
119
  "Tenant ID to configure for multi-tenant Corsair instances. Defaults to the server's configured tenantId, then 'default'."
111
120
  )
112
121
  },
@@ -137,16 +146,16 @@ ${full}`
137
146
  name: "request_permission",
138
147
  description: "Request permission from the user to execute a protected endpoint. Call this when a script returns a [PERMISSION_REQUIRED] message. Returns an approval URL. After calling this, call ask_human with the approval URL so the user can review and approve.",
139
148
  shape: {
140
- endpoint: z.string().describe(
149
+ endpoint: z2.string().describe(
141
150
  'Full endpoint path from the PERMISSION_REQUIRED message, e.g. "slack.messages.post"'
142
151
  ),
143
- args: z.record(z.string(), z.unknown()).describe(
152
+ args: z2.record(z2.string(), z2.unknown()).describe(
144
153
  "The arguments object from the PERMISSION_REQUIRED message"
145
154
  ),
146
- description: z.string().describe(
155
+ description: z2.string().describe(
147
156
  'Short human-readable summary of what this action will do, e.g. "Post a message to #general in Slack"'
148
157
  ),
149
- jid: z.string().optional().describe(
158
+ jid: z2.string().optional().describe(
150
159
  "Optional chat/conversation ID for resuming after approval"
151
160
  )
152
161
  },
@@ -181,7 +190,7 @@ var BaseProvider = class {
181
190
  var AnthropicProvider = class extends BaseProvider {
182
191
  name = "anthropic";
183
192
  wrapTool(def) {
184
- const schema = zodToJsonSchema(z2.object(def.shape), { target: "openApi3" });
193
+ const schema = shapeToJsonSchema(def.shape);
185
194
  return {
186
195
  type: "custom",
187
196
  name: def.name,
@@ -196,7 +205,7 @@ var AnthropicProvider = class extends BaseProvider {
196
205
  return `Error: ${message}`;
197
206
  }
198
207
  },
199
- parse: (content) => z2.object(def.shape).parse(content)
208
+ parse: (content) => z3.object(def.shape).parse(content)
200
209
  };
201
210
  }
202
211
  };
@@ -217,7 +226,7 @@ var ClaudeProvider = class {
217
226
  };
218
227
 
219
228
  // src/adapters/mastra.ts
220
- import { z as z3 } from "zod";
229
+ import { z as z4 } from "zod";
221
230
  var MastraProvider = class {
222
231
  name = "mastra";
223
232
  async build(options) {
@@ -230,7 +239,7 @@ var MastraProvider = class {
230
239
  (def) => createTool({
231
240
  id: def.name,
232
241
  description: def.description,
233
- inputSchema: z3.object(def.shape),
242
+ inputSchema: z4.object(def.shape),
234
243
  execute: async (inputData) => {
235
244
  const result = await def.handler(
236
245
  inputData
@@ -252,12 +261,11 @@ var MastraProvider = class {
252
261
  };
253
262
 
254
263
  // src/adapters/ollama.ts
255
- import { z as z4 } from "zod";
256
- import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
264
+ import { z as z5 } from "zod";
257
265
  var OllamaProvider = class extends BaseProvider {
258
266
  name = "ollama";
259
267
  wrapTool(def) {
260
- const schema = zodToJsonSchema2(z4.object(def.shape));
268
+ const schema = shapeToJsonSchema(def.shape);
261
269
  return {
262
270
  type: "function",
263
271
  function: {
@@ -277,7 +285,7 @@ var OllamaProvider = class extends BaseProvider {
277
285
  execute: async (args) => {
278
286
  try {
279
287
  const raw = typeof args === "string" ? JSON.parse(args) : args;
280
- const validated = z4.object(def.shape).parse(raw);
288
+ const validated = z5.object(def.shape).parse(raw);
281
289
  const result = await def.handler(validated);
282
290
  return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
283
291
  } catch (err) {
@@ -299,14 +307,13 @@ function getOpenAIMcpConfig(baseUrl, headers) {
299
307
  }
300
308
 
301
309
  // src/adapters/openai-agents.ts
302
- import { z as z5 } from "zod";
303
- import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
310
+ import { z as z6 } from "zod";
304
311
  var OpenAIAgentsProvider = class {
305
312
  name = "openai-agents";
306
313
  build(options) {
307
314
  const { tool, ...mcpOptions } = options;
308
315
  return buildCorsairToolDefs(mcpOptions).map((def) => {
309
- const jsonSchema = zodToJsonSchema3(z5.object(def.shape));
316
+ const jsonSchema = shapeToJsonSchema(def.shape);
310
317
  const shapeKeys = new Set(Object.keys(def.shape));
311
318
  return tool({
312
319
  name: def.name,
@@ -323,7 +330,7 @@ var OpenAIAgentsProvider = class {
323
330
  }
324
331
  if (Object.keys(extra).length > 0) raw.args = extra;
325
332
  }
326
- const args = z5.object(def.shape).parse(raw);
333
+ const args = z6.object(def.shape).parse(raw);
327
334
  const result = await def.handler(args);
328
335
  return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
329
336
  } catch (err) {
@@ -356,7 +363,7 @@ async function createVercelAiMcpClient(options) {
356
363
 
357
364
  // src/core/base.ts
358
365
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
359
- import { z as z6 } from "zod";
366
+ import { z as z7 } from "zod";
360
367
  function createBaseMcpServer(options) {
361
368
  const server = new McpServer({
362
369
  name: "corsair",
@@ -366,7 +373,7 @@ function createBaseMcpServer(options) {
366
373
  for (const def of buildCorsairToolDefs(options)) {
367
374
  server.registerTool(
368
375
  def.name,
369
- { description: def.description, inputSchema: z6.object(def.shape) },
376
+ { description: def.description, inputSchema: z7.object(def.shape) },
370
377
  def.handler
371
378
  );
372
379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/mcp",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "MCP server and SDK adapters for Corsair — list operations, inspect schemas, run API calls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,7 @@
20
20
  "@modelcontextprotocol/sdk": "^1.27.1",
21
21
  "express": "^4.21.0",
22
22
  "zod": "^4.1.13",
23
- "zod-to-json-schema": "^3.25.0",
24
- "corsair": "0.1.70"
23
+ "corsair": "0.1.75"
25
24
  },
26
25
  "peerDependencies": {
27
26
  "@ai-sdk/mcp": ">=0.0.1",