@corsair-dev/mcp 0.1.14 → 0.1.16

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":"ollama.d.ts","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACvC,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D,CAAC;AAMF,qBAAa,cAAe,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,IAAI,YAAY;IAEzB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,iBAAiB;CAqCnD"}
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/adapters/ollama.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D,CAAC;AAKF,qBAAa,cAAe,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IAClE,QAAQ,CAAC,IAAI,YAAY;IAEzB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,iBAAiB;CAqChD"}
@@ -10,14 +10,10 @@ export type PermissionAdapter = {
10
10
  };
11
11
  export type BaseMcpOptions = {
12
12
  corsair: {
13
- list_operations: (opts?: {
14
- plugin?: string;
15
- type?: 'api' | 'webhooks' | 'db';
16
- }) => unknown;
17
- get_schema: (path: string) => unknown;
18
13
  [key: string]: unknown;
19
14
  };
20
15
  permissions?: PermissionAdapter;
16
+ setup?: boolean;
21
17
  basePermissionUrl?: string;
22
18
  };
23
19
  //# sourceMappingURL=adapters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QACR,eAAe,EAAE,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,IAAI,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,IAAI,CAAC;SACjC,KAAK,OAAO,CAAC;QACd,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;QACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB,CAAC,MAAM,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACpE,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,cAAc,GACrB,cAAc,EAAE,CAwKlB"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/core/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACpE,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,cAAc,GACrB,cAAc,EAAE,CA2KlB"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { AnthropicProvider } from './adapters/anthropic-api.js';
2
2
  export { ClaudeProvider } from './adapters/claude.js';
3
3
  export { MastraProvider } from './adapters/mastra.js';
4
+ export { OllamaProvider } from './adapters/ollama.js';
4
5
  export type { OpenAIMcpConfig } from './adapters/openai.js';
5
6
  export { getOpenAIMcpConfig } from './adapters/openai.js';
6
7
  export type { OpenAIAgentsProviderOptions } from './adapters/openai-agents.js';
@@ -13,5 +14,4 @@ export { createMcpRouter } from './core/http.js';
13
14
  export { BaseProvider } from './core/provider.js';
14
15
  export { runStdioMcpServer } from './core/stdio.js';
15
16
  export type { CorsairToolDef } from './core/tools.js';
16
- export { OllamaProvider } from './adapters/ollama.js';
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBA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AE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import { z as z2 } from "zod";
3
3
  import { zodToJsonSchema } from "zod-to-json-schema";
4
4
 
5
5
  // src/core/tools.ts
6
- import { setupCorsair } from "corsair";
6
+ import { getSchema, listOperations, setupCorsair } from "corsair";
7
7
  import { z } from "zod";
8
8
  function buildCorsairToolDefs(options) {
9
- const { corsair, permissions, basePermissionUrl } = options;
9
+ const { corsair, permissions, basePermissionUrl, setup } = options;
10
10
  const defs = [
11
11
  {
12
12
  name: "list_operations",
@@ -16,12 +16,12 @@ function buildCorsairToolDefs(options) {
16
16
  type: z.enum(["api", "webhooks", "db"]).optional().describe("Operation type: 'api' (default), 'webhooks', or 'db'")
17
17
  },
18
18
  handler: async ({ plugin, type }) => {
19
- const result = corsair.list_operations({
19
+ const result = listOperations(corsair, {
20
20
  plugin,
21
21
  type
22
22
  });
23
23
  return {
24
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
24
+ content: [{ type: "text", text: result }]
25
25
  };
26
26
  }
27
27
  },
@@ -34,7 +34,7 @@ function buildCorsairToolDefs(options) {
34
34
  )
35
35
  },
36
36
  handler: async ({ path }) => {
37
- const result = corsair.get_schema(path);
37
+ const result = getSchema(corsair, path);
38
38
  return {
39
39
  content: [{ type: "text", text: result }]
40
40
  };
@@ -77,8 +77,10 @@ ${full}`
77
77
  };
78
78
  }
79
79
  }
80
- },
81
- {
80
+ }
81
+ ];
82
+ if (setup == null || setup === true) {
83
+ defs.push({
82
84
  name: "corsair_setup",
83
85
  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.",
84
86
  shape: {},
@@ -105,8 +107,8 @@ ${full}`
105
107
  };
106
108
  }
107
109
  }
108
- }
109
- ];
110
+ });
111
+ }
110
112
  if (permissions && basePermissionUrl) {
111
113
  defs.push({
112
114
  name: "request_permission",
@@ -226,6 +228,44 @@ var MastraProvider = class {
226
228
  }
227
229
  };
228
230
 
231
+ // src/adapters/ollama.ts
232
+ import { z as z4 } from "zod";
233
+ import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
234
+ var OllamaProvider = class extends BaseProvider {
235
+ name = "ollama";
236
+ wrapTool(def) {
237
+ const schema = zodToJsonSchema2(z4.object(def.shape));
238
+ return {
239
+ type: "function",
240
+ function: {
241
+ name: def.name,
242
+ description: def.description,
243
+ parameters: schema
244
+ },
245
+ /**
246
+ * The `execute` helper provides a simplified execution interface for runners.
247
+ * It handles:
248
+ * 1. Parsing arguments (handles both object and JSON string inputs).
249
+ * 2. Validation against the tool's Zod schema.
250
+ * 3. Execution of the underlying Corsair tool handler.
251
+ * 4. Extraction and concatenation of text results into a single string.
252
+ * 5. Graceful error handling for robust integration.
253
+ */
254
+ execute: async (args) => {
255
+ try {
256
+ const raw = typeof args === "string" ? JSON.parse(args) : args;
257
+ const validated = z4.object(def.shape).parse(raw);
258
+ const result = await def.handler(validated);
259
+ return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
260
+ } catch (err) {
261
+ const message = err instanceof Error ? err.message : String(err);
262
+ return `Error: ${message}`;
263
+ }
264
+ }
265
+ };
266
+ }
267
+ };
268
+
229
269
  // src/adapters/openai.ts
230
270
  function getOpenAIMcpConfig(baseUrl, headers) {
231
271
  return {
@@ -236,14 +276,14 @@ function getOpenAIMcpConfig(baseUrl, headers) {
236
276
  }
237
277
 
238
278
  // src/adapters/openai-agents.ts
239
- import { z as z4 } from "zod";
240
- import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
279
+ import { z as z5 } from "zod";
280
+ import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
241
281
  var OpenAIAgentsProvider = class {
242
282
  name = "openai-agents";
243
283
  build(options) {
244
284
  const { tool, ...mcpOptions } = options;
245
285
  return buildCorsairToolDefs(mcpOptions).map((def) => {
246
- const jsonSchema = zodToJsonSchema2(z4.object(def.shape));
286
+ const jsonSchema = zodToJsonSchema3(z5.object(def.shape));
247
287
  const shapeKeys = new Set(Object.keys(def.shape));
248
288
  return tool({
249
289
  name: def.name,
@@ -260,7 +300,7 @@ var OpenAIAgentsProvider = class {
260
300
  }
261
301
  if (Object.keys(extra).length > 0) raw.args = extra;
262
302
  }
263
- const args = z4.object(def.shape).parse(raw);
303
+ const args = z5.object(def.shape).parse(raw);
264
304
  const result = await def.handler(args);
265
305
  return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
266
306
  } catch (err) {
@@ -293,7 +333,7 @@ async function createVercelAiMcpClient(options) {
293
333
 
294
334
  // src/core/base.ts
295
335
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
296
- import { z as z5 } from "zod";
336
+ import { z as z6 } from "zod";
297
337
  function createBaseMcpServer(options) {
298
338
  const server = new McpServer({
299
339
  name: "corsair",
@@ -303,7 +343,7 @@ function createBaseMcpServer(options) {
303
343
  for (const def of buildCorsairToolDefs(options)) {
304
344
  server.registerTool(
305
345
  def.name,
306
- { description: def.description, inputSchema: z5.object(def.shape) },
346
+ { description: def.description, inputSchema: z6.object(def.shape) },
307
347
  def.handler
308
348
  );
309
349
  }
@@ -376,44 +416,6 @@ async function runStdioMcpServer(options) {
376
416
  const transport = new StdioServerTransport();
377
417
  await server.connect(transport);
378
418
  }
379
-
380
- // src/adapters/ollama.ts
381
- import { z as z6 } from "zod";
382
- import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
383
- var OllamaProvider = class extends BaseProvider {
384
- name = "ollama";
385
- wrapTool(def) {
386
- const schema = zodToJsonSchema3(z6.object(def.shape));
387
- return {
388
- type: "function",
389
- function: {
390
- name: def.name,
391
- description: def.description,
392
- parameters: schema
393
- },
394
- /**
395
- * The `execute` helper provides a simplified execution interface for runners.
396
- * It handles:
397
- * 1. Parsing arguments (handles both object and JSON string inputs).
398
- * 2. Validation against the tool's Zod schema.
399
- * 3. Execution of the underlying Corsair tool handler.
400
- * 4. Extraction and concatenation of text results into a single string.
401
- * 5. Graceful error handling for robust integration.
402
- */
403
- execute: async (args) => {
404
- try {
405
- const raw = typeof args === "string" ? JSON.parse(args) : args;
406
- const validated = z6.object(def.shape).parse(raw);
407
- const result = await def.handler(validated);
408
- return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
409
- } catch (err) {
410
- const message = err instanceof Error ? err.message : String(err);
411
- return `Error: ${message}`;
412
- }
413
- }
414
- };
415
- }
416
- };
417
419
  export {
418
420
  AnthropicProvider,
419
421
  BaseProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/mcp",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
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",
@@ -21,7 +21,7 @@
21
21
  "express": "^4.21.0",
22
22
  "zod": "^3.25.0",
23
23
  "zod-to-json-schema": "^3.25.0",
24
- "corsair": "0.1.54"
24
+ "corsair": "0.1.62"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@ai-sdk/mcp": ">=0.0.1",