@corsair-dev/mcp 0.1.14 → 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.
- package/dist/adapters/ollama.d.ts.map +1 -1
- package/dist/core/adapters.d.ts +0 -5
- package/dist/core/adapters.d.ts.map +1 -1
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -48
- package/package.json +2 -2
|
@@ -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;
|
|
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"}
|
package/dist/core/adapters.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/core/tools.d.ts.map
CHANGED
|
@@ -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;
|
|
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';
|
|
@@ -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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,2BAA2B,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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,2BAA2B,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
|
|
19
|
+
const result = listOperations(corsair, {
|
|
20
20
|
plugin,
|
|
21
21
|
type
|
|
22
22
|
});
|
|
23
23
|
return {
|
|
24
|
-
content: [{ type: "text", text:
|
|
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
|
|
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
|
|
240
|
-
import { zodToJsonSchema as
|
|
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 =
|
|
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 =
|
|
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
|
|
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:
|
|
344
|
+
{ description: def.description, inputSchema: z6.object(def.shape) },
|
|
307
345
|
def.handler
|
|
308
346
|
);
|
|
309
347
|
}
|
|
@@ -376,44 +414,6 @@ async function runStdioMcpServer(options) {
|
|
|
376
414
|
const transport = new StdioServerTransport();
|
|
377
415
|
await server.connect(transport);
|
|
378
416
|
}
|
|
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
417
|
export {
|
|
418
418
|
AnthropicProvider,
|
|
419
419
|
BaseProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/mcp",
|
|
3
|
-
"version": "0.1.
|
|
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,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.
|
|
24
|
+
"corsair": "0.1.60"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@ai-sdk/mcp": ">=0.0.1",
|