@kraken-ai/platform 0.0.1
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/LICENSE +67 -0
- package/README.md +36 -0
- package/dist/chunk-HGJSK6MW.js +294 -0
- package/dist/chunk-HGJSK6MW.js.map +1 -0
- package/dist/cli.js +1297 -0
- package/dist/cli.js.map +1 -0
- package/dist/connector-CumEDPfS.d.cts +103 -0
- package/dist/connector-CumEDPfS.d.ts +103 -0
- package/dist/index.cjs +1381 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +796 -0
- package/dist/index.d.ts +796 -0
- package/dist/index.js +1240 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +315 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +15 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: Optima Engineering LLC
|
|
7
|
+
Licensed Work: @kraken-ai/platform
|
|
8
|
+
The Licensed Work is (c) 2025 Optima Engineering LLC.
|
|
9
|
+
Additional Use Grant: You may make production use of the Licensed Work solely
|
|
10
|
+
to build applications that interact with the Kraken AI
|
|
11
|
+
platform operated by Optima Engineering LLC. Any other
|
|
12
|
+
production use, including use to create, offer, or operate
|
|
13
|
+
any product or service that directly or indirectly competes
|
|
14
|
+
with the Kraken AI platform or any commercial product
|
|
15
|
+
offered by Optima Engineering LLC or its affiliates, is not
|
|
16
|
+
permitted under this License.
|
|
17
|
+
Change Date: Four years from the date the Licensed Work is
|
|
18
|
+
published.
|
|
19
|
+
Change License: Apache License, Version 2.0
|
|
20
|
+
|
|
21
|
+
For information about alternative licensing arrangements, please contact
|
|
22
|
+
Optima Engineering LLC.
|
|
23
|
+
|
|
24
|
+
Notice
|
|
25
|
+
|
|
26
|
+
Business Source License 1.1
|
|
27
|
+
|
|
28
|
+
Terms
|
|
29
|
+
|
|
30
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
31
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
32
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
33
|
+
|
|
34
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
35
|
+
available distribution of a specific version of the Licensed Work under this
|
|
36
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
37
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
38
|
+
above terminate.
|
|
39
|
+
|
|
40
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
41
|
+
currently in effect as described in this License, you must purchase a
|
|
42
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
43
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
44
|
+
|
|
45
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
46
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
47
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
48
|
+
for each version of the Licensed Work released by Licensor.
|
|
49
|
+
|
|
50
|
+
You must conspicuously display this License on each original or modified copy
|
|
51
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
52
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
53
|
+
License apply to your use of that work.
|
|
54
|
+
|
|
55
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
56
|
+
terminate your rights under this License for the current and all other
|
|
57
|
+
versions of the Licensed Work.
|
|
58
|
+
|
|
59
|
+
This License does not grant you any right in any trademark or logo of
|
|
60
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
61
|
+
Licensor as expressly required by this License).
|
|
62
|
+
|
|
63
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
64
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
65
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
66
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
67
|
+
TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @kraken-ai/platform
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the Kraken AI Platform. Provides a `PlatformClient` for interacting with the platform API and a `kraken` CLI for managing credentials and generating types from platform schemas.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @kraken-ai/platform
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## PlatformClient
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { PlatformClient } from "@kraken-ai/platform";
|
|
15
|
+
|
|
16
|
+
const client = new PlatformClient({
|
|
17
|
+
baseUrl: "https://your-platform.example.com",
|
|
18
|
+
apiKey: "your-api-key",
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Namespaces: `client.agents`, `client.data`, `client.runs`, `client.pipelines`.
|
|
23
|
+
|
|
24
|
+
## CLI
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
kraken login # store API credentials
|
|
28
|
+
kraken generate # discover local + fetch remote schemas, generate types
|
|
29
|
+
kraken logout # clear stored credentials
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run `kraken --help` for full usage.
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
[BUSL-1.1](LICENSE) — converts to Apache 2.0 four years after each version is published.
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// src/agents/errors.ts
|
|
2
|
+
var SecurityError = class extends Error {
|
|
3
|
+
code = "SECURITY_VIOLATION";
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "SecurityError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var ConnectorError = class extends Error {
|
|
10
|
+
code = "CONNECTOR_ERROR";
|
|
11
|
+
constructor(message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = "ConnectorError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/agents/connector-wrap.ts
|
|
18
|
+
var MAX_TOOL_RESULT_SIZE = 10 * 1024 * 1024;
|
|
19
|
+
var isMcpContent = (val) => typeof val === "object" && val !== null && "__mcpPassThrough" in val && val.__mcpPassThrough === true;
|
|
20
|
+
var wrapToolResult = (value) => {
|
|
21
|
+
if (value === null || value === void 0) {
|
|
22
|
+
return { content: [] };
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === "string") {
|
|
25
|
+
return { content: [{ type: "text", text: value }] };
|
|
26
|
+
}
|
|
27
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
28
|
+
return { content: [{ type: "text", text: String(value) }] };
|
|
29
|
+
}
|
|
30
|
+
if (isMcpContent(value)) {
|
|
31
|
+
const result = { content: value.content };
|
|
32
|
+
if (value.isError) {
|
|
33
|
+
return { ...result, isError: true };
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
const json = JSON.stringify(value, null, 2);
|
|
38
|
+
if (json.length > MAX_TOOL_RESULT_SIZE) {
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: `[Result truncated: ${json.length} bytes]` }],
|
|
41
|
+
isError: true
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { content: [{ type: "text", text: json }] };
|
|
45
|
+
};
|
|
46
|
+
var wrapToolError = (error) => {
|
|
47
|
+
if (error instanceof ConnectorError) {
|
|
48
|
+
return {
|
|
49
|
+
content: [{ type: "text", text: error.message }],
|
|
50
|
+
isError: true
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (error instanceof Error) {
|
|
54
|
+
console.error("[connector] Internal handler error:", error.message, error.stack);
|
|
55
|
+
} else {
|
|
56
|
+
console.error("[connector] Internal handler error:", String(error));
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: "text", text: "Internal handler error" }],
|
|
60
|
+
isError: true
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var mcpResult = (content, isError) => ({
|
|
64
|
+
__mcpPassThrough: true,
|
|
65
|
+
content,
|
|
66
|
+
isError
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// src/agents/connector-server.ts
|
|
70
|
+
import { randomUUID } from "crypto";
|
|
71
|
+
import { createServer } from "http";
|
|
72
|
+
import * as z from "zod";
|
|
73
|
+
var DEFAULT_HANDLER_TIMEOUT_MS = 3e4;
|
|
74
|
+
var MAX_BODY_SIZE = 10 * 1024 * 1024;
|
|
75
|
+
var withTimeout = (promise, ms) => Promise.race([
|
|
76
|
+
promise,
|
|
77
|
+
new Promise(
|
|
78
|
+
(_, reject) => setTimeout(() => reject(new Error(`Handler timed out after ${ms}ms`)), ms)
|
|
79
|
+
)
|
|
80
|
+
]);
|
|
81
|
+
var readBody = (req, maxSize) => new Promise((resolve, reject) => {
|
|
82
|
+
const chunks = [];
|
|
83
|
+
let size = 0;
|
|
84
|
+
req.on("data", (chunk) => {
|
|
85
|
+
size += chunk.length;
|
|
86
|
+
if (size > maxSize) {
|
|
87
|
+
req.destroy();
|
|
88
|
+
reject(new Error("Request body too large"));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
chunks.push(chunk);
|
|
92
|
+
});
|
|
93
|
+
req.on("end", () => resolve(Buffer.concat(chunks).toString()));
|
|
94
|
+
req.on("error", reject);
|
|
95
|
+
});
|
|
96
|
+
var buildPromptArgsSchema = (def) => {
|
|
97
|
+
if (!def.arguments?.length) return void 0;
|
|
98
|
+
const shape = {};
|
|
99
|
+
for (const arg of def.arguments) {
|
|
100
|
+
shape[arg.name] = arg.required ? z.string() : z.string().optional();
|
|
101
|
+
}
|
|
102
|
+
return shape;
|
|
103
|
+
};
|
|
104
|
+
var startConnectorServer = async (connector, options) => {
|
|
105
|
+
const mcpServerModule = await import("@modelcontextprotocol/sdk/server/mcp.js").catch(() => {
|
|
106
|
+
throw new Error(
|
|
107
|
+
"@modelcontextprotocol/sdk is required for startConnectorServer. Install it: pnpm add @modelcontextprotocol/sdk"
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
const transportModule = await import("@modelcontextprotocol/sdk/server/streamableHttp.js").catch(
|
|
111
|
+
() => {
|
|
112
|
+
throw new Error(
|
|
113
|
+
"@modelcontextprotocol/sdk is required for startConnectorServer. Install it: pnpm add @modelcontextprotocol/sdk"
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
const { McpServer } = mcpServerModule;
|
|
118
|
+
const { StreamableHTTPServerTransport } = transportModule;
|
|
119
|
+
const timeoutMs = options?.handlerTimeoutMs ?? DEFAULT_HANDLER_TIMEOUT_MS;
|
|
120
|
+
const mcpServer = new McpServer(
|
|
121
|
+
{ name: connector.name, version: "0.0.0" },
|
|
122
|
+
{ capabilities: { tools: {}, resources: {}, prompts: {} } }
|
|
123
|
+
);
|
|
124
|
+
const tools = connector.tools ?? {};
|
|
125
|
+
const toolEntries = Object.entries(tools);
|
|
126
|
+
if (toolEntries.length === 0) {
|
|
127
|
+
console.warn(
|
|
128
|
+
`[connector:${connector.name}] No tools defined \u2014 server will start with zero tools`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
for (const [name, def] of toolEntries) {
|
|
132
|
+
mcpServer.registerTool(
|
|
133
|
+
name,
|
|
134
|
+
{
|
|
135
|
+
description: def.description,
|
|
136
|
+
inputSchema: def.input,
|
|
137
|
+
...def.annotations ? { annotations: def.annotations } : {}
|
|
138
|
+
},
|
|
139
|
+
async (args) => {
|
|
140
|
+
try {
|
|
141
|
+
const result = await withTimeout(Promise.resolve(def.handler(args)), timeoutMs);
|
|
142
|
+
const wrapped = wrapToolResult(result);
|
|
143
|
+
return {
|
|
144
|
+
content: wrapped.content.map((c) => ({
|
|
145
|
+
type: "text",
|
|
146
|
+
text: String("text" in c ? c.text : "")
|
|
147
|
+
})),
|
|
148
|
+
...wrapped.isError === true ? { isError: true } : {}
|
|
149
|
+
};
|
|
150
|
+
} catch (error) {
|
|
151
|
+
const wrapped = wrapToolError(error);
|
|
152
|
+
return {
|
|
153
|
+
content: wrapped.content.map((c) => ({
|
|
154
|
+
type: "text",
|
|
155
|
+
text: String("text" in c ? c.text : "")
|
|
156
|
+
})),
|
|
157
|
+
isError: true
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const resources = connector.resources ?? {};
|
|
164
|
+
for (const [name, def] of Object.entries(resources)) {
|
|
165
|
+
mcpServer.registerResource(
|
|
166
|
+
name,
|
|
167
|
+
def.uri,
|
|
168
|
+
{
|
|
169
|
+
description: def.description,
|
|
170
|
+
...def.mimeType ? { mimeType: def.mimeType } : {}
|
|
171
|
+
},
|
|
172
|
+
async (_uri, extra) => {
|
|
173
|
+
try {
|
|
174
|
+
const result = await withTimeout(
|
|
175
|
+
Promise.resolve(def.read({ signal: extra.signal })),
|
|
176
|
+
timeoutMs
|
|
177
|
+
);
|
|
178
|
+
return { contents: [...result.contents] };
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (error instanceof Error) {
|
|
181
|
+
console.error(`[connector:${connector.name}] Resource read error:`, error.message);
|
|
182
|
+
}
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
const prompts = connector.prompts ?? {};
|
|
189
|
+
for (const [name, def] of Object.entries(prompts)) {
|
|
190
|
+
const argsSchema = buildPromptArgsSchema(def);
|
|
191
|
+
mcpServer.registerPrompt(
|
|
192
|
+
name,
|
|
193
|
+
{
|
|
194
|
+
description: def.description,
|
|
195
|
+
...argsSchema ? { argsSchema } : {}
|
|
196
|
+
},
|
|
197
|
+
async (args, extra) => {
|
|
198
|
+
try {
|
|
199
|
+
const cleanArgs = {};
|
|
200
|
+
for (const [k, v] of Object.entries(args)) {
|
|
201
|
+
if (v !== void 0) cleanArgs[k] = v;
|
|
202
|
+
}
|
|
203
|
+
const result = await withTimeout(
|
|
204
|
+
Promise.resolve(def.get(cleanArgs, { signal: extra.signal })),
|
|
205
|
+
timeoutMs
|
|
206
|
+
);
|
|
207
|
+
return { messages: [...result.messages] };
|
|
208
|
+
} catch (error) {
|
|
209
|
+
if (error instanceof Error) {
|
|
210
|
+
console.error(`[connector:${connector.name}] Prompt get error:`, error.message);
|
|
211
|
+
}
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
const transport = new StreamableHTTPServerTransport({
|
|
218
|
+
sessionIdGenerator: () => randomUUID()
|
|
219
|
+
});
|
|
220
|
+
const host = options?.host ?? "127.0.0.1";
|
|
221
|
+
const port = options?.port ?? 0;
|
|
222
|
+
const httpServer = createServer(async (req, res) => {
|
|
223
|
+
if (req.url === "/health" && req.method === "GET") {
|
|
224
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
225
|
+
res.end(JSON.stringify({ status: "ok" }));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (req.url === "/mcp" && (req.method === "POST" || req.method === "GET" || req.method === "DELETE")) {
|
|
229
|
+
if (req.method === "POST") {
|
|
230
|
+
const contentLength = parseInt(req.headers["content-length"] ?? "0", 10);
|
|
231
|
+
if (contentLength > MAX_BODY_SIZE) {
|
|
232
|
+
req.resume();
|
|
233
|
+
res.writeHead(413, { "Content-Type": "application/json" });
|
|
234
|
+
res.end(JSON.stringify({ error: "Request body too large" }));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
const body = await readBody(req, MAX_BODY_SIZE);
|
|
239
|
+
const parsed = JSON.parse(body);
|
|
240
|
+
await transport.handleRequest(req, res, parsed);
|
|
241
|
+
} catch (err) {
|
|
242
|
+
if (!res.headersSent) {
|
|
243
|
+
const isTooLarge = err instanceof Error && err.message === "Request body too large";
|
|
244
|
+
res.writeHead(isTooLarge ? 413 : 400, { "Content-Type": "application/json" });
|
|
245
|
+
res.end(
|
|
246
|
+
JSON.stringify({
|
|
247
|
+
error: isTooLarge ? "Request body too large" : "Invalid request body"
|
|
248
|
+
})
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
await transport.handleRequest(req, res);
|
|
256
|
+
} catch {
|
|
257
|
+
if (!res.headersSent) {
|
|
258
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
259
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
res.writeHead(404);
|
|
265
|
+
res.end("Not found");
|
|
266
|
+
});
|
|
267
|
+
await mcpServer.connect(transport);
|
|
268
|
+
await new Promise((resolve) => {
|
|
269
|
+
httpServer.listen(port, host, () => resolve());
|
|
270
|
+
});
|
|
271
|
+
const addr = httpServer.address();
|
|
272
|
+
if (!addr || typeof addr === "string") {
|
|
273
|
+
throw new Error("Failed to get server address");
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
port: addr.port,
|
|
277
|
+
close: async () => {
|
|
278
|
+
await mcpServer.close();
|
|
279
|
+
await new Promise((resolve, reject) => {
|
|
280
|
+
httpServer.close((err) => err ? reject(err) : resolve());
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export {
|
|
287
|
+
SecurityError,
|
|
288
|
+
ConnectorError,
|
|
289
|
+
wrapToolResult,
|
|
290
|
+
wrapToolError,
|
|
291
|
+
mcpResult,
|
|
292
|
+
startConnectorServer
|
|
293
|
+
};
|
|
294
|
+
//# sourceMappingURL=chunk-HGJSK6MW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agents/errors.ts","../src/agents/connector-wrap.ts","../src/agents/connector-server.ts"],"sourcesContent":["// Copyright (c) Optima Engineering LLC\n// SPDX-License-Identifier: BUSL-1.1\n\nexport class SecurityError extends Error {\n readonly code = \"SECURITY_VIOLATION\";\n\n constructor(message: string) {\n super(message);\n this.name = \"SecurityError\";\n }\n}\n\nexport class ConnectorError extends Error {\n readonly code = \"CONNECTOR_ERROR\";\n\n constructor(message: string) {\n super(message);\n this.name = \"ConnectorError\";\n }\n}\n","// Copyright (c) Optima Engineering LLC\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { ConnectorError } from \"./errors\";\nimport type { McpContent } from \"./types/connector\";\n\nconst MAX_TOOL_RESULT_SIZE = 10 * 1024 * 1024; // 10MB\n\ninterface ToolResultContent {\n readonly type: string;\n [key: string]: unknown;\n}\n\ninterface ToolResult {\n readonly content: ReadonlyArray<ToolResultContent>;\n readonly isError?: boolean;\n}\n\nconst isMcpContent = (val: unknown): val is McpContent =>\n typeof val === \"object\" &&\n val !== null &&\n \"__mcpPassThrough\" in val &&\n (val as McpContent).__mcpPassThrough === true;\n\n/** Wrap a handler return value into MCP CallToolResult format */\nexport const wrapToolResult = (value: unknown): ToolResult => {\n if (value === null || value === undefined) {\n return { content: [] };\n }\n\n if (typeof value === \"string\") {\n return { content: [{ type: \"text\", text: value }] };\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return { content: [{ type: \"text\", text: String(value) }] };\n }\n\n if (isMcpContent(value)) {\n const result: ToolResult = { content: value.content };\n if (value.isError) {\n return { ...result, isError: true };\n }\n return result;\n }\n\n const json = JSON.stringify(value, null, 2);\n if (json.length > MAX_TOOL_RESULT_SIZE) {\n return {\n content: [{ type: \"text\", text: `[Result truncated: ${json.length} bytes]` }],\n isError: true,\n };\n }\n return { content: [{ type: \"text\", text: json }] };\n};\n\n/** Wrap a thrown error into MCP CallToolResult format with isError: true */\nexport const wrapToolError = (error: unknown): ToolResult => {\n if (error instanceof ConnectorError) {\n return {\n content: [{ type: \"text\", text: error.message }],\n isError: true,\n };\n }\n\n if (error instanceof Error) {\n console.error(\"[connector] Internal handler error:\", error.message, error.stack);\n } else {\n console.error(\"[connector] Internal handler error:\", String(error));\n }\n\n return {\n content: [{ type: \"text\", text: \"Internal handler error\" }],\n isError: true,\n };\n};\n\n/** Create an explicit MCP content pass-through result */\nexport const mcpResult = (content: McpContent[\"content\"], isError?: boolean): McpContent => ({\n __mcpPassThrough: true as const,\n content,\n isError,\n});\n","// Copyright (c) Optima Engineering LLC\n// SPDX-License-Identifier: BUSL-1.1\n\nimport { randomUUID } from \"node:crypto\";\nimport { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport type { AddressInfo } from \"node:net\";\n\nimport * as z from \"zod\";\nimport { wrapToolError, wrapToolResult } from \"./connector-wrap\";\nimport type { ConnectorPromptDef, PlatformConnector } from \"./types/connector\";\n\nconst DEFAULT_HANDLER_TIMEOUT_MS = 30_000;\nconst MAX_BODY_SIZE = 10 * 1024 * 1024; // 10MB\n\nexport interface ConnectorServerOptions {\n readonly port?: number;\n readonly host?: string;\n readonly handlerTimeoutMs?: number;\n}\n\nexport interface ConnectorServerHandle {\n readonly port: number;\n readonly close: () => Promise<void>;\n}\n\nconst withTimeout = <T>(promise: Promise<T>, ms: number): Promise<T> =>\n Promise.race([\n promise,\n new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error(`Handler timed out after ${ms}ms`)), ms),\n ),\n ]);\n\nconst readBody = (req: IncomingMessage, maxSize: number): Promise<string> =>\n new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let size = 0;\n req.on(\"data\", (chunk: Buffer) => {\n size += chunk.length;\n if (size > maxSize) {\n req.destroy();\n reject(new Error(\"Request body too large\"));\n return;\n }\n chunks.push(chunk);\n });\n req.on(\"end\", () => resolve(Buffer.concat(chunks).toString()));\n req.on(\"error\", reject);\n });\n\n/** Convert ConnectorPromptDef.arguments array to a raw shape for MCP SDK */\nconst buildPromptArgsSchema = (\n def: ConnectorPromptDef,\n): Record<string, z.ZodString | z.ZodOptional<z.ZodString>> | undefined => {\n if (!def.arguments?.length) return undefined;\n const shape: Record<string, z.ZodString | z.ZodOptional<z.ZodString>> = {};\n for (const arg of def.arguments) {\n shape[arg.name] = arg.required ? z.string() : z.string().optional();\n }\n return shape;\n};\n\nexport const startConnectorServer = async (\n connector: PlatformConnector,\n options?: ConnectorServerOptions,\n): Promise<ConnectorServerHandle> => {\n const mcpServerModule = await import(\"@modelcontextprotocol/sdk/server/mcp.js\").catch(() => {\n throw new Error(\n \"@modelcontextprotocol/sdk is required for startConnectorServer. \" +\n \"Install it: pnpm add @modelcontextprotocol/sdk\",\n );\n });\n const transportModule = await import(\"@modelcontextprotocol/sdk/server/streamableHttp.js\").catch(\n () => {\n throw new Error(\n \"@modelcontextprotocol/sdk is required for startConnectorServer. \" +\n \"Install it: pnpm add @modelcontextprotocol/sdk\",\n );\n },\n );\n\n const { McpServer } = mcpServerModule;\n const { StreamableHTTPServerTransport } = transportModule;\n\n const timeoutMs = options?.handlerTimeoutMs ?? DEFAULT_HANDLER_TIMEOUT_MS;\n\n const mcpServer = new McpServer(\n { name: connector.name, version: \"0.0.0\" },\n { capabilities: { tools: {}, resources: {}, prompts: {} } },\n );\n\n const tools = connector.tools ?? {};\n const toolEntries = Object.entries(tools);\n\n if (toolEntries.length === 0) {\n console.warn(\n `[connector:${connector.name}] No tools defined — server will start with zero tools`,\n );\n }\n\n for (const [name, def] of toolEntries) {\n mcpServer.registerTool(\n name,\n {\n description: def.description,\n inputSchema: def.input,\n ...(def.annotations ? { annotations: def.annotations } : {}),\n },\n async (args: unknown) => {\n try {\n // args is already validated by the MCP SDK against the Zod schema\n const result = await withTimeout(Promise.resolve(def.handler(args)), timeoutMs);\n const wrapped = wrapToolResult(result);\n return {\n content: wrapped.content.map((c) => ({\n type: \"text\" as const,\n text: String(\"text\" in c ? c.text : \"\"),\n })),\n ...(wrapped.isError === true ? { isError: true as const } : {}),\n };\n } catch (error: unknown) {\n const wrapped = wrapToolError(error);\n return {\n content: wrapped.content.map((c) => ({\n type: \"text\" as const,\n text: String(\"text\" in c ? c.text : \"\"),\n })),\n isError: true as const,\n };\n }\n },\n );\n }\n\n const resources = connector.resources ?? {};\n for (const [name, def] of Object.entries(resources)) {\n mcpServer.registerResource(\n name,\n def.uri,\n {\n description: def.description,\n ...(def.mimeType ? { mimeType: def.mimeType } : {}),\n },\n async (_uri: URL, extra: { signal: AbortSignal }) => {\n try {\n const result = await withTimeout(\n Promise.resolve(def.read({ signal: extra.signal })),\n timeoutMs,\n );\n return { contents: [...result.contents] };\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`[connector:${connector.name}] Resource read error:`, error.message);\n }\n throw error;\n }\n },\n );\n }\n\n const prompts = connector.prompts ?? {};\n for (const [name, def] of Object.entries(prompts)) {\n const argsSchema = buildPromptArgsSchema(def);\n mcpServer.registerPrompt(\n name,\n {\n description: def.description,\n ...(argsSchema ? { argsSchema } : {}),\n },\n async (args: Record<string, string | undefined>, extra: { signal: AbortSignal }) => {\n try {\n const cleanArgs: Record<string, string> = {};\n for (const [k, v] of Object.entries(args)) {\n if (v !== undefined) cleanArgs[k] = v;\n }\n const result = await withTimeout(\n Promise.resolve(def.get(cleanArgs, { signal: extra.signal })),\n timeoutMs,\n );\n return { messages: [...result.messages] };\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`[connector:${connector.name}] Prompt get error:`, error.message);\n }\n throw error;\n }\n },\n );\n }\n\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => randomUUID(),\n });\n\n const host = options?.host ?? \"127.0.0.1\";\n const port = options?.port ?? 0;\n\n const httpServer = createServer(async (req: IncomingMessage, res: ServerResponse) => {\n if (req.url === \"/health\" && req.method === \"GET\") {\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ status: \"ok\" }));\n return;\n }\n\n if (\n req.url === \"/mcp\" &&\n (req.method === \"POST\" || req.method === \"GET\" || req.method === \"DELETE\")\n ) {\n if (req.method === \"POST\") {\n // Check Content-Length before reading body (fast reject for oversized payloads)\n const contentLength = parseInt(req.headers[\"content-length\"] ?? \"0\", 10);\n if (contentLength > MAX_BODY_SIZE) {\n req.resume(); // drain the request body to prevent EPIPE\n res.writeHead(413, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ error: \"Request body too large\" }));\n return;\n }\n\n try {\n const body = await readBody(req, MAX_BODY_SIZE);\n const parsed: unknown = JSON.parse(body);\n await transport.handleRequest(req, res, parsed);\n } catch (err: unknown) {\n if (!res.headersSent) {\n const isTooLarge = err instanceof Error && err.message === \"Request body too large\";\n res.writeHead(isTooLarge ? 413 : 400, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n error: isTooLarge ? \"Request body too large\" : \"Invalid request body\",\n }),\n );\n }\n }\n return;\n }\n\n // GET (SSE) and DELETE (session end)\n try {\n await transport.handleRequest(req, res);\n } catch {\n if (!res.headersSent) {\n res.writeHead(500, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ error: \"Internal server error\" }));\n }\n }\n return;\n }\n\n res.writeHead(404);\n res.end(\"Not found\");\n });\n\n // Connect MCP server to transport AFTER tool registration\n await mcpServer.connect(transport);\n\n await new Promise<void>((resolve) => {\n httpServer.listen(port, host, () => resolve());\n });\n\n const addr = httpServer.address();\n if (!addr || typeof addr === \"string\") {\n throw new Error(\"Failed to get server address\");\n }\n\n return {\n port: (addr as AddressInfo).port,\n close: async () => {\n await mcpServer.close();\n await new Promise<void>((resolve, reject) => {\n httpServer.close((err) => (err ? reject(err) : resolve()));\n });\n },\n };\n};\n"],"mappings":";AAGO,IAAM,gBAAN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