@corsair-dev/mcp 0.1.13 → 0.1.15

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":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,qBAAa,cAAc;IAC1B,QAAQ,CAAC,IAAI,YAAY;IAEnB,KAAK,CACV,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;CAMjD"}
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,qBAAa,cAAc;IAC1B,QAAQ,CAAC,IAAI,YAAY;IAEnB,KAAK,CACV,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;CAQjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"mastra.d.ts","sourceRoot":"","sources":["../../src/adapters/mastra.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,qBAAa,cAAc;IAC1B,QAAQ,CAAC,IAAI,YAAY;IAEnB,KAAK,CAAC,OAAO,EAAE,cAAc;;;CAyBnC"}
1
+ {"version":3,"file":"mastra.d.ts","sourceRoot":"","sources":["../../src/adapters/mastra.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,qBAAa,cAAc;IAC1B,QAAQ,CAAC,IAAI,YAAY;IAEnB,KAAK,CAAC,OAAO,EAAE,cAAc;;;CA2BnC"}
@@ -0,0 +1,16 @@
1
+ import { BaseProvider } from '../core/provider.js';
2
+ import type { CorsairToolDef } from '../core/tools.js';
3
+ export type CorsairOllamaTool = {
4
+ type: 'function';
5
+ function: {
6
+ name: string;
7
+ description: string;
8
+ parameters: Record<string, unknown>;
9
+ };
10
+ execute: (args: Record<string, unknown>) => Promise<string>;
11
+ };
12
+ export declare class OllamaProvider extends BaseProvider<CorsairOllamaTool> {
13
+ readonly name = "ollama";
14
+ wrapTool(def: CorsairToolDef): CorsairOllamaTool;
15
+ }
16
+ //# sourceMappingURL=ollama.d.ts.map
@@ -0,0 +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;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../src/adapters/vercel-ai.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,wBAAwB,4CAYjC"}
1
+ {"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../src/adapters/vercel-ai.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,wBAAwB,4CAcjC"}
@@ -10,11 +10,6 @@ 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;
@@ -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,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,CAwKlB"}
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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","source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A2B,EAAE,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,7 +3,7 @@ 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
9
  const { corsair, permissions, basePermissionUrl } = options;
@@ -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
  };
@@ -226,6 +226,44 @@ var MastraProvider = class {
226
226
  }
227
227
  };
228
228
 
229
+ // src/adapters/ollama.ts
230
+ import { z as z4 } from "zod";
231
+ import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
232
+ var OllamaProvider = class extends BaseProvider {
233
+ name = "ollama";
234
+ wrapTool(def) {
235
+ const schema = zodToJsonSchema2(z4.object(def.shape));
236
+ return {
237
+ type: "function",
238
+ function: {
239
+ name: def.name,
240
+ description: def.description,
241
+ parameters: schema
242
+ },
243
+ /**
244
+ * The `execute` helper provides a simplified execution interface for runners.
245
+ * It handles:
246
+ * 1. Parsing arguments (handles both object and JSON string inputs).
247
+ * 2. Validation against the tool's Zod schema.
248
+ * 3. Execution of the underlying Corsair tool handler.
249
+ * 4. Extraction and concatenation of text results into a single string.
250
+ * 5. Graceful error handling for robust integration.
251
+ */
252
+ execute: async (args) => {
253
+ try {
254
+ const raw = typeof args === "string" ? JSON.parse(args) : args;
255
+ const validated = z4.object(def.shape).parse(raw);
256
+ const result = await def.handler(validated);
257
+ return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
258
+ } catch (err) {
259
+ const message = err instanceof Error ? err.message : String(err);
260
+ return `Error: ${message}`;
261
+ }
262
+ }
263
+ };
264
+ }
265
+ };
266
+
229
267
  // src/adapters/openai.ts
230
268
  function getOpenAIMcpConfig(baseUrl, headers) {
231
269
  return {
@@ -236,14 +274,14 @@ function getOpenAIMcpConfig(baseUrl, headers) {
236
274
  }
237
275
 
238
276
  // src/adapters/openai-agents.ts
239
- import { z as z4 } from "zod";
240
- import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
277
+ import { z as z5 } from "zod";
278
+ import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
241
279
  var OpenAIAgentsProvider = class {
242
280
  name = "openai-agents";
243
281
  build(options) {
244
282
  const { tool, ...mcpOptions } = options;
245
283
  return buildCorsairToolDefs(mcpOptions).map((def) => {
246
- const jsonSchema = zodToJsonSchema2(z4.object(def.shape));
284
+ const jsonSchema = zodToJsonSchema3(z5.object(def.shape));
247
285
  const shapeKeys = new Set(Object.keys(def.shape));
248
286
  return tool({
249
287
  name: def.name,
@@ -260,7 +298,7 @@ var OpenAIAgentsProvider = class {
260
298
  }
261
299
  if (Object.keys(extra).length > 0) raw.args = extra;
262
300
  }
263
- const args = z4.object(def.shape).parse(raw);
301
+ const args = z5.object(def.shape).parse(raw);
264
302
  const result = await def.handler(args);
265
303
  return result.content.filter((c) => c.type === "text").map((c) => "text" in c ? c.text : "").join("\n");
266
304
  } catch (err) {
@@ -293,7 +331,7 @@ async function createVercelAiMcpClient(options) {
293
331
 
294
332
  // src/core/base.ts
295
333
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
296
- import { z as z5 } from "zod";
334
+ import { z as z6 } from "zod";
297
335
  function createBaseMcpServer(options) {
298
336
  const server = new McpServer({
299
337
  name: "corsair",
@@ -303,7 +341,7 @@ function createBaseMcpServer(options) {
303
341
  for (const def of buildCorsairToolDefs(options)) {
304
342
  server.registerTool(
305
343
  def.name,
306
- { description: def.description, inputSchema: z5.object(def.shape) },
344
+ { description: def.description, inputSchema: z6.object(def.shape) },
307
345
  def.handler
308
346
  );
309
347
  }
@@ -381,6 +419,7 @@ export {
381
419
  BaseProvider,
382
420
  ClaudeProvider,
383
421
  MastraProvider,
422
+ OllamaProvider,
384
423
  OpenAIAgentsProvider,
385
424
  createBaseMcpServer,
386
425
  createMcpRouter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/mcp",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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,14 +21,15 @@
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.49"
24
+ "corsair": "0.1.60"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@ai-sdk/mcp": ">=0.0.1",
28
28
  "@anthropic-ai/claude-agent-sdk": ">=0.2.0",
29
29
  "@anthropic-ai/sdk": ">=0.78.0",
30
30
  "@mastra/core": ">=1.0.0",
31
- "@openai/agents": ">=0.5.0"
31
+ "@openai/agents": ">=0.5.0",
32
+ "openai": ">=4.0.0"
32
33
  },
33
34
  "peerDependenciesMeta": {
34
35
  "@ai-sdk/mcp": {
@@ -45,6 +46,9 @@
45
46
  },
46
47
  "@openai/agents": {
47
48
  "optional": true
49
+ },
50
+ "openai": {
51
+ "optional": true
48
52
  }
49
53
  },
50
54
  "devDependencies": {