@zauso-ai/capstan-agent 1.0.0-beta.5 → 1.0.0-beta.7
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/a2a.d.ts.map +1 -1
- package/dist/a2a.js +42 -21
- package/dist/a2a.js.map +1 -1
- package/dist/commerce.d.ts +62 -0
- package/dist/commerce.d.ts.map +1 -0
- package/dist/commerce.js +39 -0
- package/dist/commerce.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/langchain.d.ts +52 -0
- package/dist/langchain.d.ts.map +1 -0
- package/dist/langchain.js +157 -0
- package/dist/langchain.js.map +1 -0
- package/dist/llm.d.ts +41 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +166 -0
- package/dist/llm.js.map +1 -0
- package/dist/mcp-client.d.ts +45 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +289 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/mcp.d.ts +23 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +85 -1
- package/dist/mcp.js.map +1 -1
- package/dist/registry.d.ts +21 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +48 -1
- package/dist/registry.js.map +1 -1
- package/dist/telemetry.d.ts +8 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +48 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/testing.d.ts +84 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +490 -0
- package/dist/testing.js.map +1 -0
- package/package.json +9 -2
package/dist/testing.js
ADDED
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import { createMcpServer, routeToToolName, inputSchemaToZodShape } from "./mcp.js";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// In-process MCP Test Harness
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
/**
|
|
6
|
+
* Test harness for validating MCP tool discovery and invocation.
|
|
7
|
+
* Uses the Capstan MCP server in-process (no network needed).
|
|
8
|
+
*/
|
|
9
|
+
export class McpTestHarness {
|
|
10
|
+
registry;
|
|
11
|
+
constructor(registry) {
|
|
12
|
+
this.registry = registry;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate that all registered routes with a `capability` field appear as
|
|
16
|
+
* MCP tools, and that every MCP tool maps back to a registered route.
|
|
17
|
+
*/
|
|
18
|
+
async validateToolDiscovery() {
|
|
19
|
+
const results = [];
|
|
20
|
+
const routes = this.registry.getRoutes();
|
|
21
|
+
const config = this.registry.getConfig();
|
|
22
|
+
// Build an MCP server with a no-op executor — we only need tool metadata.
|
|
23
|
+
const noopExecute = async () => ({});
|
|
24
|
+
const { getToolDefinitions } = createMcpServer(config, [...routes], noopExecute);
|
|
25
|
+
const tools = getToolDefinitions();
|
|
26
|
+
const toolNames = new Set(tools.map((t) => t.name));
|
|
27
|
+
// Check: every route with a capability should have a corresponding tool.
|
|
28
|
+
for (const route of routes) {
|
|
29
|
+
const expectedName = routeToToolName(route.method, route.path);
|
|
30
|
+
if (route.capability) {
|
|
31
|
+
results.push({
|
|
32
|
+
pass: toolNames.has(expectedName),
|
|
33
|
+
tool: expectedName,
|
|
34
|
+
check: "tool_exists_for_capability_route",
|
|
35
|
+
message: toolNames.has(expectedName)
|
|
36
|
+
? `Tool "${expectedName}" found for ${route.method} ${route.path}`
|
|
37
|
+
: `Missing tool "${expectedName}" for ${route.method} ${route.path} (capability: ${route.capability})`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Routes without capability still get tools — verify presence.
|
|
42
|
+
results.push({
|
|
43
|
+
pass: toolNames.has(expectedName),
|
|
44
|
+
tool: expectedName,
|
|
45
|
+
check: "tool_exists_for_route",
|
|
46
|
+
message: toolNames.has(expectedName)
|
|
47
|
+
? `Tool "${expectedName}" found for ${route.method} ${route.path}`
|
|
48
|
+
: `Missing tool "${expectedName}" for ${route.method} ${route.path}`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Check: every tool maps back to a known route.
|
|
53
|
+
const routeToolNames = new Set(routes.map((r) => routeToToolName(r.method, r.path)));
|
|
54
|
+
for (const tool of tools) {
|
|
55
|
+
if (!routeToolNames.has(tool.name)) {
|
|
56
|
+
results.push({
|
|
57
|
+
pass: false,
|
|
58
|
+
tool: tool.name,
|
|
59
|
+
check: "tool_has_backing_route",
|
|
60
|
+
message: `Tool "${tool.name}" has no matching registered route`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validate that MCP tool input schemas match the Zod shapes derived from
|
|
68
|
+
* each route's `inputSchema`.
|
|
69
|
+
*/
|
|
70
|
+
async validateToolSchemas() {
|
|
71
|
+
const results = [];
|
|
72
|
+
const routes = this.registry.getRoutes();
|
|
73
|
+
const config = this.registry.getConfig();
|
|
74
|
+
const noopExecute = async () => ({});
|
|
75
|
+
const { getToolDefinitions } = createMcpServer(config, [...routes], noopExecute);
|
|
76
|
+
const tools = getToolDefinitions();
|
|
77
|
+
const toolMap = new Map(tools.map((t) => [t.name, t]));
|
|
78
|
+
for (const route of routes) {
|
|
79
|
+
const toolName = routeToToolName(route.method, route.path);
|
|
80
|
+
const tool = toolMap.get(toolName);
|
|
81
|
+
if (!tool) {
|
|
82
|
+
results.push({
|
|
83
|
+
pass: false,
|
|
84
|
+
tool: toolName,
|
|
85
|
+
check: "schema_tool_exists",
|
|
86
|
+
message: `Cannot validate schema — tool "${toolName}" not found`,
|
|
87
|
+
});
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
// Tool must have a description.
|
|
91
|
+
results.push({
|
|
92
|
+
pass: typeof tool.description === "string" && tool.description.length > 0,
|
|
93
|
+
tool: toolName,
|
|
94
|
+
check: "has_description",
|
|
95
|
+
message: tool.description
|
|
96
|
+
? `Description: "${tool.description}"`
|
|
97
|
+
: "Tool is missing a description",
|
|
98
|
+
});
|
|
99
|
+
// Tool must have an inputSchema object.
|
|
100
|
+
results.push({
|
|
101
|
+
pass: tool.inputSchema != null && typeof tool.inputSchema === "object",
|
|
102
|
+
tool: toolName,
|
|
103
|
+
check: "has_input_schema",
|
|
104
|
+
message: tool.inputSchema
|
|
105
|
+
? "Input schema present"
|
|
106
|
+
: "Input schema missing",
|
|
107
|
+
});
|
|
108
|
+
// If the route defines input properties, verify the Zod shape covers them.
|
|
109
|
+
if (route.inputSchema) {
|
|
110
|
+
const routeProps = route.inputSchema["properties"];
|
|
111
|
+
if (routeProps) {
|
|
112
|
+
const zodShape = inputSchemaToZodShape(route.inputSchema);
|
|
113
|
+
const zodKeys = Object.keys(zodShape);
|
|
114
|
+
const routeKeys = Object.keys(routeProps);
|
|
115
|
+
// Every route input property should appear in the Zod shape.
|
|
116
|
+
for (const key of routeKeys) {
|
|
117
|
+
results.push({
|
|
118
|
+
pass: zodKeys.includes(key),
|
|
119
|
+
tool: toolName,
|
|
120
|
+
check: "schema_property_mapped",
|
|
121
|
+
message: zodKeys.includes(key)
|
|
122
|
+
? `Property "${key}" mapped to Zod schema`
|
|
123
|
+
: `Property "${key}" missing from Zod schema`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// Check required fields: route required fields should be non-optional
|
|
127
|
+
// in the Zod shape.
|
|
128
|
+
const routeRequired = route.inputSchema["required"] ?? [];
|
|
129
|
+
for (const key of routeRequired) {
|
|
130
|
+
const zodField = zodShape[key];
|
|
131
|
+
// A required field should exist and NOT be optional.
|
|
132
|
+
const isPresent = zodField != null;
|
|
133
|
+
const isOptional = zodField?.isOptional?.() ?? false;
|
|
134
|
+
results.push({
|
|
135
|
+
pass: isPresent && !isOptional,
|
|
136
|
+
tool: toolName,
|
|
137
|
+
check: "required_field_enforced",
|
|
138
|
+
message: isPresent && !isOptional
|
|
139
|
+
? `Required field "${key}" correctly enforced`
|
|
140
|
+
: `Required field "${key}" is ${isPresent ? "marked optional" : "missing"} in Zod schema`,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Call a tool with test input and validate the response format.
|
|
150
|
+
*
|
|
151
|
+
* The `executeRoute` callback simulates the actual route handler. The
|
|
152
|
+
* harness verifies that the MCP server wraps the response correctly
|
|
153
|
+
* (content array with text entries).
|
|
154
|
+
*/
|
|
155
|
+
async validateToolInvocation(toolName, input, executeRoute) {
|
|
156
|
+
const results = [];
|
|
157
|
+
const routes = this.registry.getRoutes();
|
|
158
|
+
const config = this.registry.getConfig();
|
|
159
|
+
// Find the route backing this tool.
|
|
160
|
+
const route = routes.find((r) => routeToToolName(r.method, r.path) === toolName);
|
|
161
|
+
if (!route) {
|
|
162
|
+
results.push({
|
|
163
|
+
pass: false,
|
|
164
|
+
tool: toolName,
|
|
165
|
+
check: "route_found",
|
|
166
|
+
message: `No route found for tool "${toolName}"`,
|
|
167
|
+
});
|
|
168
|
+
return results;
|
|
169
|
+
}
|
|
170
|
+
results.push({
|
|
171
|
+
pass: true,
|
|
172
|
+
tool: toolName,
|
|
173
|
+
check: "route_found",
|
|
174
|
+
message: `Route ${route.method} ${route.path} backs tool "${toolName}"`,
|
|
175
|
+
});
|
|
176
|
+
// Build a real MCP server with the provided executor.
|
|
177
|
+
const { getToolDefinitions } = createMcpServer(config, [...routes], executeRoute);
|
|
178
|
+
const tools = getToolDefinitions();
|
|
179
|
+
const toolDef = tools.find((t) => t.name === toolName);
|
|
180
|
+
if (!toolDef) {
|
|
181
|
+
results.push({
|
|
182
|
+
pass: false,
|
|
183
|
+
tool: toolName,
|
|
184
|
+
check: "tool_registered",
|
|
185
|
+
message: `Tool "${toolName}" not registered on MCP server`,
|
|
186
|
+
});
|
|
187
|
+
return results;
|
|
188
|
+
}
|
|
189
|
+
results.push({
|
|
190
|
+
pass: true,
|
|
191
|
+
tool: toolName,
|
|
192
|
+
check: "tool_registered",
|
|
193
|
+
message: `Tool "${toolName}" registered on MCP server`,
|
|
194
|
+
});
|
|
195
|
+
// Invoke the route directly (same way the MCP tool callback does).
|
|
196
|
+
try {
|
|
197
|
+
const routeInput = Object.keys(input).length > 0 ? input : undefined;
|
|
198
|
+
const rawResult = await executeRoute(route.method, route.path, routeInput);
|
|
199
|
+
// Simulate the MCP response wrapping.
|
|
200
|
+
const mcpResponse = {
|
|
201
|
+
content: [{ type: "text", text: JSON.stringify(rawResult) }],
|
|
202
|
+
};
|
|
203
|
+
// Validate: response should have a content array.
|
|
204
|
+
const hasContent = Array.isArray(mcpResponse.content);
|
|
205
|
+
results.push({
|
|
206
|
+
pass: hasContent,
|
|
207
|
+
tool: toolName,
|
|
208
|
+
check: "response_has_content_array",
|
|
209
|
+
message: hasContent
|
|
210
|
+
? "Response contains content array"
|
|
211
|
+
: "Response missing content array",
|
|
212
|
+
});
|
|
213
|
+
// Validate: content should have at least one entry.
|
|
214
|
+
const hasEntries = hasContent && mcpResponse.content.length > 0;
|
|
215
|
+
results.push({
|
|
216
|
+
pass: hasEntries,
|
|
217
|
+
tool: toolName,
|
|
218
|
+
check: "response_has_entries",
|
|
219
|
+
message: hasEntries
|
|
220
|
+
? `Response has ${mcpResponse.content.length} content entry/entries`
|
|
221
|
+
: "Response content array is empty",
|
|
222
|
+
});
|
|
223
|
+
// Validate: first entry should be a text type.
|
|
224
|
+
if (hasEntries) {
|
|
225
|
+
const first = mcpResponse.content[0];
|
|
226
|
+
results.push({
|
|
227
|
+
pass: first.type === "text",
|
|
228
|
+
tool: toolName,
|
|
229
|
+
check: "response_entry_is_text",
|
|
230
|
+
message: first.type === "text"
|
|
231
|
+
? "First content entry is text type"
|
|
232
|
+
: `First content entry has unexpected type: "${first.type}"`,
|
|
233
|
+
});
|
|
234
|
+
// Validate: text should be valid JSON.
|
|
235
|
+
let parsedOk = false;
|
|
236
|
+
try {
|
|
237
|
+
JSON.parse(first.text);
|
|
238
|
+
parsedOk = true;
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
// Not valid JSON.
|
|
242
|
+
}
|
|
243
|
+
results.push({
|
|
244
|
+
pass: parsedOk,
|
|
245
|
+
tool: toolName,
|
|
246
|
+
check: "response_text_is_json",
|
|
247
|
+
message: parsedOk
|
|
248
|
+
? "Response text is valid JSON"
|
|
249
|
+
: "Response text is not valid JSON",
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (err) {
|
|
254
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
255
|
+
results.push({
|
|
256
|
+
pass: false,
|
|
257
|
+
tool: toolName,
|
|
258
|
+
check: "invocation_succeeded",
|
|
259
|
+
message: `Tool invocation threw: ${errMsg}`,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return results;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Run all validations: discovery, schemas, and invocation for every tool.
|
|
266
|
+
*/
|
|
267
|
+
async runAll(executeRoute) {
|
|
268
|
+
const allResults = [];
|
|
269
|
+
const [discoveryResults, schemaResults] = await Promise.all([
|
|
270
|
+
this.validateToolDiscovery(),
|
|
271
|
+
this.validateToolSchemas(),
|
|
272
|
+
]);
|
|
273
|
+
allResults.push(...discoveryResults, ...schemaResults);
|
|
274
|
+
// Invoke each tool with empty input.
|
|
275
|
+
const routes = this.registry.getRoutes();
|
|
276
|
+
for (const route of routes) {
|
|
277
|
+
const toolName = routeToToolName(route.method, route.path);
|
|
278
|
+
const invocationResults = await this.validateToolInvocation(toolName, {}, executeRoute);
|
|
279
|
+
allResults.push(...invocationResults);
|
|
280
|
+
}
|
|
281
|
+
const passed = allResults.filter((r) => r.pass).length;
|
|
282
|
+
const failed = allResults.filter((r) => !r.pass).length;
|
|
283
|
+
return { results: allResults, passed, failed };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* HTTP-based test client for testing the Streamable HTTP MCP endpoint.
|
|
288
|
+
*
|
|
289
|
+
* Sends JSON-RPC 2.0 POST requests to a running MCP HTTP endpoint and
|
|
290
|
+
* manages session lifecycle via the `Mcp-Session-Id` header.
|
|
291
|
+
*/
|
|
292
|
+
export class McpHttpTestClient {
|
|
293
|
+
baseUrl;
|
|
294
|
+
sessionId;
|
|
295
|
+
nextId = 1;
|
|
296
|
+
constructor(baseUrl) {
|
|
297
|
+
this.baseUrl = baseUrl;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Send a JSON-RPC 2.0 request to the MCP endpoint.
|
|
301
|
+
*/
|
|
302
|
+
async sendRequest(method, params) {
|
|
303
|
+
const id = this.nextId++;
|
|
304
|
+
const body = {
|
|
305
|
+
jsonrpc: "2.0",
|
|
306
|
+
id,
|
|
307
|
+
method,
|
|
308
|
+
...(params !== undefined ? { params } : {}),
|
|
309
|
+
};
|
|
310
|
+
const headers = {
|
|
311
|
+
"Content-Type": "application/json",
|
|
312
|
+
Accept: "application/json, text/event-stream",
|
|
313
|
+
};
|
|
314
|
+
if (this.sessionId) {
|
|
315
|
+
headers["mcp-session-id"] = this.sessionId;
|
|
316
|
+
}
|
|
317
|
+
let response;
|
|
318
|
+
try {
|
|
319
|
+
response = await fetch(this.baseUrl, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers,
|
|
322
|
+
body: JSON.stringify(body),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
327
|
+
throw new Error(`MCP HTTP request failed: ${errMsg}`);
|
|
328
|
+
}
|
|
329
|
+
// Capture session ID from response header if present.
|
|
330
|
+
const newSessionId = response.headers.get("mcp-session-id");
|
|
331
|
+
if (newSessionId) {
|
|
332
|
+
this.sessionId = newSessionId;
|
|
333
|
+
}
|
|
334
|
+
if (!response.ok) {
|
|
335
|
+
const text = await response.text().catch(() => "");
|
|
336
|
+
throw new Error(`MCP HTTP error ${response.status}: ${text}`);
|
|
337
|
+
}
|
|
338
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
339
|
+
// Handle SSE responses by extracting the JSON-RPC message from the stream.
|
|
340
|
+
if (contentType.includes("text/event-stream")) {
|
|
341
|
+
const text = await response.text();
|
|
342
|
+
const jsonRpcResult = extractJsonRpcFromSse(text, id);
|
|
343
|
+
if (jsonRpcResult) {
|
|
344
|
+
return jsonRpcResult;
|
|
345
|
+
}
|
|
346
|
+
throw new Error("No matching JSON-RPC response found in SSE stream");
|
|
347
|
+
}
|
|
348
|
+
// Standard JSON response.
|
|
349
|
+
const json = (await response.json());
|
|
350
|
+
// The MCP SDK may return a single response or an array.
|
|
351
|
+
if (Array.isArray(json)) {
|
|
352
|
+
const match = json.find((r) => r.id === id);
|
|
353
|
+
if (match)
|
|
354
|
+
return match;
|
|
355
|
+
if (json.length > 0)
|
|
356
|
+
return json[0];
|
|
357
|
+
throw new Error("Empty JSON-RPC response array");
|
|
358
|
+
}
|
|
359
|
+
return json;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Send an initialize request to establish a session.
|
|
363
|
+
*/
|
|
364
|
+
async initialize() {
|
|
365
|
+
const response = await this.sendRequest("initialize", {
|
|
366
|
+
protocolVersion: "2025-03-26",
|
|
367
|
+
capabilities: {},
|
|
368
|
+
clientInfo: {
|
|
369
|
+
name: "capstan-test-client",
|
|
370
|
+
version: "1.0.0",
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
if (response.error) {
|
|
374
|
+
throw new Error(`MCP initialize error: ${response.error.message}`);
|
|
375
|
+
}
|
|
376
|
+
const result = response.result;
|
|
377
|
+
// Send the initialized notification (no response expected).
|
|
378
|
+
// Fire-and-forget; some servers may not require it.
|
|
379
|
+
try {
|
|
380
|
+
const headers = {
|
|
381
|
+
"Content-Type": "application/json",
|
|
382
|
+
Accept: "application/json, text/event-stream",
|
|
383
|
+
};
|
|
384
|
+
if (this.sessionId) {
|
|
385
|
+
headers["mcp-session-id"] = this.sessionId;
|
|
386
|
+
}
|
|
387
|
+
await fetch(this.baseUrl, {
|
|
388
|
+
method: "POST",
|
|
389
|
+
headers,
|
|
390
|
+
body: JSON.stringify({
|
|
391
|
+
jsonrpc: "2.0",
|
|
392
|
+
method: "notifications/initialized",
|
|
393
|
+
}),
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
catch {
|
|
397
|
+
// Notification delivery is best-effort.
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
serverInfo: result?.["serverInfo"] ?? null,
|
|
401
|
+
capabilities: result?.["capabilities"] ?? null,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* List all available MCP tools.
|
|
406
|
+
*/
|
|
407
|
+
async listTools() {
|
|
408
|
+
const response = await this.sendRequest("tools/list", {});
|
|
409
|
+
if (response.error) {
|
|
410
|
+
throw new Error(`MCP tools/list error: ${response.error.message}`);
|
|
411
|
+
}
|
|
412
|
+
const result = response.result;
|
|
413
|
+
const tools = result?.["tools"];
|
|
414
|
+
if (!Array.isArray(tools)) {
|
|
415
|
+
return [];
|
|
416
|
+
}
|
|
417
|
+
return tools.map((t) => {
|
|
418
|
+
const entry = { name: t["name"] };
|
|
419
|
+
const desc = t["description"];
|
|
420
|
+
if (typeof desc === "string") {
|
|
421
|
+
entry.description = desc;
|
|
422
|
+
}
|
|
423
|
+
const schema = t["inputSchema"];
|
|
424
|
+
if (schema !== undefined) {
|
|
425
|
+
entry.inputSchema = schema;
|
|
426
|
+
}
|
|
427
|
+
return entry;
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Call a specific MCP tool by name.
|
|
432
|
+
*/
|
|
433
|
+
async callTool(name, args) {
|
|
434
|
+
const params = { name };
|
|
435
|
+
if (args !== undefined) {
|
|
436
|
+
params["arguments"] = args;
|
|
437
|
+
}
|
|
438
|
+
const response = await this.sendRequest("tools/call", params);
|
|
439
|
+
if (response.error) {
|
|
440
|
+
throw new Error(`MCP tools/call error: ${response.error.message}`);
|
|
441
|
+
}
|
|
442
|
+
return response.result;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Close the current session by sending an HTTP DELETE.
|
|
446
|
+
*/
|
|
447
|
+
async close() {
|
|
448
|
+
if (!this.sessionId)
|
|
449
|
+
return;
|
|
450
|
+
try {
|
|
451
|
+
await fetch(this.baseUrl, {
|
|
452
|
+
method: "DELETE",
|
|
453
|
+
headers: {
|
|
454
|
+
"mcp-session-id": this.sessionId,
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
catch {
|
|
459
|
+
// Best-effort cleanup.
|
|
460
|
+
}
|
|
461
|
+
this.sessionId = undefined;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// ---------------------------------------------------------------------------
|
|
465
|
+
// Helpers
|
|
466
|
+
// ---------------------------------------------------------------------------
|
|
467
|
+
/**
|
|
468
|
+
* Extract a JSON-RPC response from an SSE text stream.
|
|
469
|
+
*/
|
|
470
|
+
function extractJsonRpcFromSse(sseText, requestId) {
|
|
471
|
+
const lines = sseText.split("\n");
|
|
472
|
+
for (const line of lines) {
|
|
473
|
+
if (line.startsWith("data: ")) {
|
|
474
|
+
const data = line.slice("data: ".length).trim();
|
|
475
|
+
if (!data || data === "[DONE]")
|
|
476
|
+
continue;
|
|
477
|
+
try {
|
|
478
|
+
const parsed = JSON.parse(data);
|
|
479
|
+
if (parsed.id === requestId) {
|
|
480
|
+
return parsed;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
catch {
|
|
484
|
+
// Not valid JSON, skip.
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
490
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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;QAAC,MAAM,CAAC;YACP,uBAAuB;QACzB,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;GAEG;AACH,SAAS,qBAAqB,CAC5B,OAAe,EACf,SAA0B;IAE1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,QAAQ;gBAAE,SAAS;YACzC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAoB,CAAC;gBACnD,IAAI,MAAM,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;oBAC5B,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauso-ai/capstan-agent",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,11 +12,18 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc -p tsconfig.json",
|
|
15
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
15
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
16
|
+
"clean": "rm -rf dist"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
19
20
|
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@opentelemetry/api": "^1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependenciesMeta": {
|
|
25
|
+
"@opentelemetry/api": { "optional": true }
|
|
26
|
+
},
|
|
20
27
|
"description": "Multi-protocol agent surface for Capstan — MCP server, A2A adapter, OpenAPI, manifest",
|
|
21
28
|
"files": [
|
|
22
29
|
"dist"
|