@corsair-dev/mcp 0.1.23 → 0.1.25
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/core/adapters.d.ts +3 -8
- package/dist/core/adapters.d.ts.map +1 -1
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/index.js +9 -81
- package/package.json +2 -2
package/dist/core/adapters.d.ts
CHANGED
|
@@ -12,13 +12,8 @@ export type BaseMcpOptions = {
|
|
|
12
12
|
corsair: {
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* Default tenant used by the corsair_setup tool. The tool input can override
|
|
19
|
-
* this per call. If omitted, setupCorsair uses its "default" tenant behavior.
|
|
20
|
-
*/
|
|
21
|
-
tenantId?: string;
|
|
22
|
-
basePermissionUrl?: string;
|
|
15
|
+
runOptions?: {
|
|
16
|
+
readonly: boolean;
|
|
17
|
+
};
|
|
23
18
|
};
|
|
24
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;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,
|
|
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,UAAU,CAAC,EAAE;QACZ,QAAQ,EAAE,OAAO,CAAC;KAClB,CAAC;CACF,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;AAGzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,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,
|
|
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;AAGpD,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,CAuGlB"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ function shapeToJsonSchema(shape) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// src/core/tools.ts
|
|
15
|
-
import { listOperations,
|
|
15
|
+
import { listOperations, runReadonly } from "corsair";
|
|
16
16
|
import { z as z2 } from "zod";
|
|
17
17
|
|
|
18
18
|
// src/core/schema-format.ts
|
|
@@ -23,13 +23,7 @@ function formatGetSchemaResponse(corsair, path) {
|
|
|
23
23
|
|
|
24
24
|
// src/core/tools.ts
|
|
25
25
|
function buildCorsairToolDefs(options) {
|
|
26
|
-
const {
|
|
27
|
-
corsair,
|
|
28
|
-
permissions,
|
|
29
|
-
basePermissionUrl,
|
|
30
|
-
setup,
|
|
31
|
-
tenantId: defaultTenantId
|
|
32
|
-
} = options;
|
|
26
|
+
const { corsair, runOptions } = options;
|
|
33
27
|
const defs = [
|
|
34
28
|
{
|
|
35
29
|
name: "list_operations",
|
|
@@ -75,14 +69,14 @@ function buildCorsairToolDefs(options) {
|
|
|
75
69
|
)
|
|
76
70
|
},
|
|
77
71
|
handler: async ({ code }) => {
|
|
72
|
+
const readonly = runOptions?.readonly || false;
|
|
78
73
|
try {
|
|
79
74
|
const fn = new Function(
|
|
80
75
|
"corsair",
|
|
81
76
|
`return (async () => { ${code} })()`
|
|
82
77
|
);
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
);
|
|
78
|
+
const invoke = () => fn(corsair);
|
|
79
|
+
const result = readonly ? await runReadonly(invoke) : await invoke();
|
|
86
80
|
return {
|
|
87
81
|
content: [
|
|
88
82
|
{
|
|
@@ -110,72 +104,6 @@ ${full}`
|
|
|
110
104
|
}
|
|
111
105
|
}
|
|
112
106
|
];
|
|
113
|
-
if (setup == null || setup === true) {
|
|
114
|
-
defs.push({
|
|
115
|
-
name: "corsair_setup",
|
|
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.",
|
|
117
|
-
shape: {
|
|
118
|
-
tenantId: z2.string().optional().describe(
|
|
119
|
-
"Tenant ID to configure for multi-tenant Corsair instances. Defaults to the server's configured tenantId, then 'default'."
|
|
120
|
-
)
|
|
121
|
-
},
|
|
122
|
-
handler: async ({ tenantId }) => {
|
|
123
|
-
try {
|
|
124
|
-
const setupTenantId = typeof tenantId === "string" && tenantId.length > 0 ? tenantId : defaultTenantId;
|
|
125
|
-
const text = await setupCorsair(
|
|
126
|
-
corsair,
|
|
127
|
-
setupTenantId ? { tenantId: setupTenantId } : void 0
|
|
128
|
-
);
|
|
129
|
-
return {
|
|
130
|
-
content: [
|
|
131
|
-
{ type: "text", text: text || "Corsair setup complete." }
|
|
132
|
-
]
|
|
133
|
-
};
|
|
134
|
-
} catch (err) {
|
|
135
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
136
|
-
return {
|
|
137
|
-
isError: true,
|
|
138
|
-
content: [{ type: "text", text: `Setup failed: ${message}` }]
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
if (permissions && basePermissionUrl) {
|
|
145
|
-
defs.push({
|
|
146
|
-
name: "request_permission",
|
|
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.",
|
|
148
|
-
shape: {
|
|
149
|
-
endpoint: z2.string().describe(
|
|
150
|
-
'Full endpoint path from the PERMISSION_REQUIRED message, e.g. "slack.messages.post"'
|
|
151
|
-
),
|
|
152
|
-
args: z2.record(z2.string(), z2.unknown()).describe(
|
|
153
|
-
"The arguments object from the PERMISSION_REQUIRED message"
|
|
154
|
-
),
|
|
155
|
-
description: z2.string().describe(
|
|
156
|
-
'Short human-readable summary of what this action will do, e.g. "Post a message to #general in Slack"'
|
|
157
|
-
),
|
|
158
|
-
jid: z2.string().optional().describe(
|
|
159
|
-
"Optional chat/conversation ID for resuming after approval"
|
|
160
|
-
)
|
|
161
|
-
},
|
|
162
|
-
handler: async ({ endpoint, args, description }) => {
|
|
163
|
-
const { permissionId, approvalUrl } = await permissions.createPermissionRequest({
|
|
164
|
-
endpoint,
|
|
165
|
-
args,
|
|
166
|
-
description
|
|
167
|
-
});
|
|
168
|
-
const result = {
|
|
169
|
-
permissionId,
|
|
170
|
-
approvalUrl,
|
|
171
|
-
message: `Permission request created. Ask the user to approve at: ${approvalUrl}`
|
|
172
|
-
};
|
|
173
|
-
return {
|
|
174
|
-
content: [{ type: "text", text: JSON.stringify(result) }]
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
107
|
return defs;
|
|
180
108
|
}
|
|
181
109
|
|
|
@@ -689,7 +617,7 @@ var UnsupportedFunctionalityError = class extends (_b14 = AISDKError, _a14 = sym
|
|
|
689
617
|
}
|
|
690
618
|
};
|
|
691
619
|
|
|
692
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.
|
|
620
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
693
621
|
import * as z42 from "zod/v4";
|
|
694
622
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
|
|
695
623
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
@@ -824,7 +752,7 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
824
752
|
}
|
|
825
753
|
};
|
|
826
754
|
|
|
827
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.
|
|
755
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.4.3/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
828
756
|
var { btoa: btoa2, atob } = globalThis;
|
|
829
757
|
var name14 = "AI_DownloadError";
|
|
830
758
|
var marker15 = `vercel.ai.error.${name14}`;
|
|
@@ -2244,7 +2172,7 @@ function dynamicTool(tool2) {
|
|
|
2244
2172
|
return { ...tool2, type: "dynamic" };
|
|
2245
2173
|
}
|
|
2246
2174
|
|
|
2247
|
-
// ../../node_modules/.pnpm/@ai-sdk+mcp@1.0.25_zod@4.
|
|
2175
|
+
// ../../node_modules/.pnpm/@ai-sdk+mcp@1.0.25_zod@4.4.3/node_modules/@ai-sdk/mcp/dist/index.mjs
|
|
2248
2176
|
import { z as z22 } from "zod/v4";
|
|
2249
2177
|
import { z as z7 } from "zod/v4";
|
|
2250
2178
|
|
|
@@ -2291,7 +2219,7 @@ async function pkceChallenge(length) {
|
|
|
2291
2219
|
};
|
|
2292
2220
|
}
|
|
2293
2221
|
|
|
2294
|
-
// ../../node_modules/.pnpm/@ai-sdk+mcp@1.0.25_zod@4.
|
|
2222
|
+
// ../../node_modules/.pnpm/@ai-sdk+mcp@1.0.25_zod@4.4.3/node_modules/@ai-sdk/mcp/dist/index.mjs
|
|
2295
2223
|
import { z as z32 } from "zod/v4";
|
|
2296
2224
|
var name15 = "AI_MCPClientError";
|
|
2297
2225
|
var marker16 = `vercel.ai.error.${name15}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
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
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
22
22
|
"express": "^4.21.0",
|
|
23
23
|
"zod": "^4.1.13",
|
|
24
|
-
"corsair": "0.1.
|
|
24
|
+
"corsair": "0.1.107"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@anthropic-ai/claude-agent-sdk": ">=0.2.0",
|