bhived-mcp 1.1.5
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 +21 -0
- package/README.md +396 -0
- package/dist/agentsMd.d.ts +38 -0
- package/dist/agentsMd.d.ts.map +1 -0
- package/dist/agentsMd.js +392 -0
- package/dist/agentsMd.js.map +1 -0
- package/dist/childMcp/delivery.d.ts +73 -0
- package/dist/childMcp/delivery.d.ts.map +1 -0
- package/dist/childMcp/delivery.js +130 -0
- package/dist/childMcp/delivery.js.map +1 -0
- package/dist/childMcp/manager.d.ts +111 -0
- package/dist/childMcp/manager.d.ts.map +1 -0
- package/dist/childMcp/manager.js +454 -0
- package/dist/childMcp/manager.js.map +1 -0
- package/dist/client/restClient.d.ts +36 -0
- package/dist/client/restClient.d.ts.map +1 -0
- package/dist/client/restClient.js +154 -0
- package/dist/client/restClient.js.map +1 -0
- package/dist/client/types.d.ts +220 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +8 -0
- package/dist/client/types.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -0
- package/dist/formatters/inspectFormatter.d.ts +13 -0
- package/dist/formatters/inspectFormatter.d.ts.map +1 -0
- package/dist/formatters/inspectFormatter.js +68 -0
- package/dist/formatters/inspectFormatter.js.map +1 -0
- package/dist/formatters/queryFormatter.d.ts +18 -0
- package/dist/formatters/queryFormatter.d.ts.map +1 -0
- package/dist/formatters/queryFormatter.js +250 -0
- package/dist/formatters/queryFormatter.js.map +1 -0
- package/dist/formatters/writeFormatter.d.ts +16 -0
- package/dist/formatters/writeFormatter.d.ts.map +1 -0
- package/dist/formatters/writeFormatter.js +56 -0
- package/dist/formatters/writeFormatter.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +387 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/learnAndShare.d.ts +8 -0
- package/dist/prompts/learnAndShare.d.ts.map +1 -0
- package/dist/prompts/learnAndShare.js +77 -0
- package/dist/prompts/learnAndShare.js.map +1 -0
- package/dist/prompts/reviewMemory.d.ts +8 -0
- package/dist/prompts/reviewMemory.d.ts.map +1 -0
- package/dist/prompts/reviewMemory.js +61 -0
- package/dist/prompts/reviewMemory.js.map +1 -0
- package/dist/registries/childMcpRegistry.d.ts +65 -0
- package/dist/registries/childMcpRegistry.d.ts.map +1 -0
- package/dist/registries/childMcpRegistry.js +74 -0
- package/dist/registries/childMcpRegistry.js.map +1 -0
- package/dist/registries/index.d.ts +12 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +9 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/resourceRegistry.d.ts +48 -0
- package/dist/registries/resourceRegistry.d.ts.map +1 -0
- package/dist/registries/resourceRegistry.js +91 -0
- package/dist/registries/resourceRegistry.js.map +1 -0
- package/dist/registries/skillRegistry.d.ts +48 -0
- package/dist/registries/skillRegistry.d.ts.map +1 -0
- package/dist/registries/skillRegistry.js +47 -0
- package/dist/registries/skillRegistry.js.map +1 -0
- package/dist/resources/guide.d.ts +7 -0
- package/dist/resources/guide.d.ts.map +1 -0
- package/dist/resources/guide.js +77 -0
- package/dist/resources/guide.js.map +1 -0
- package/dist/resources/status.d.ts +7 -0
- package/dist/resources/status.d.ts.map +1 -0
- package/dist/resources/status.js +38 -0
- package/dist/resources/status.js.map +1 -0
- package/dist/tools/initiateMcp.d.ts +10 -0
- package/dist/tools/initiateMcp.d.ts.map +1 -0
- package/dist/tools/initiateMcp.js +224 -0
- package/dist/tools/initiateMcp.js.map +1 -0
- package/dist/tools/initiateSkill.d.ts +13 -0
- package/dist/tools/initiateSkill.d.ts.map +1 -0
- package/dist/tools/initiateSkill.js +277 -0
- package/dist/tools/initiateSkill.js.map +1 -0
- package/dist/tools/inspect.d.ts +8 -0
- package/dist/tools/inspect.d.ts.map +1 -0
- package/dist/tools/inspect.js +110 -0
- package/dist/tools/inspect.js.map +1 -0
- package/dist/tools/listActive.d.ts +9 -0
- package/dist/tools/listActive.d.ts.map +1 -0
- package/dist/tools/listActive.js +177 -0
- package/dist/tools/listActive.js.map +1 -0
- package/dist/tools/query.d.ts +15 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +98 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/readResource.d.ts +9 -0
- package/dist/tools/readResource.d.ts.map +1 -0
- package/dist/tools/readResource.js +110 -0
- package/dist/tools/readResource.js.map +1 -0
- package/dist/tools/runScript.d.ts +17 -0
- package/dist/tools/runScript.d.ts.map +1 -0
- package/dist/tools/runScript.js +320 -0
- package/dist/tools/runScript.js.map +1 -0
- package/dist/tools/stopMcp.d.ts +8 -0
- package/dist/tools/stopMcp.d.ts.map +1 -0
- package/dist/tools/stopMcp.js +91 -0
- package/dist/tools/stopMcp.js.map +1 -0
- package/dist/tools/useTool.d.ts +10 -0
- package/dist/tools/useTool.d.ts.map +1 -0
- package/dist/tools/useTool.js +127 -0
- package/dist/tools/useTool.js.map +1 -0
- package/dist/tools/write.d.ts +9 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +224 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Child MCP Manager
|
|
3
|
+
*
|
|
4
|
+
* Spawns child MCP processes, connects via stdio transport,
|
|
5
|
+
* discovers their tools, and manages their full lifecycle.
|
|
6
|
+
*
|
|
7
|
+
* This is the core engine for the Evolving Hub — it bridges
|
|
8
|
+
* between the HiveMind MCP server and any number of child
|
|
9
|
+
* MCP servers running as subprocesses.
|
|
10
|
+
*/
|
|
11
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
12
|
+
import { type ChildMcpTool } from "../registries/childMcpRegistry.js";
|
|
13
|
+
import type { McpConfig, McpPayload } from "../client/types.js";
|
|
14
|
+
export interface SpawnResult {
|
|
15
|
+
/** Name of the spawned MCP */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Tools discovered from the child */
|
|
18
|
+
tools: ChildMcpTool[];
|
|
19
|
+
/** The MCP Client instance */
|
|
20
|
+
client: Client;
|
|
21
|
+
}
|
|
22
|
+
export interface SpawnOptions {
|
|
23
|
+
/** Where this child came from: "standalone" or "skill:{name}" */
|
|
24
|
+
source: `skill:${string}` | "standalone";
|
|
25
|
+
/** Memory ID from the backend (for tracking) */
|
|
26
|
+
memory_id: string;
|
|
27
|
+
/** Connection timeout in milliseconds (default: 15000) */
|
|
28
|
+
connectTimeout?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare class ChildMcpManager {
|
|
31
|
+
private healthInterval;
|
|
32
|
+
/**
|
|
33
|
+
* Spawn a child MCP process, connect to it, and discover its tools.
|
|
34
|
+
*
|
|
35
|
+
* Flow:
|
|
36
|
+
* 1. Create StdioClientTransport (which spawns the child process)
|
|
37
|
+
* 2. Create MCP Client and connect via the transport
|
|
38
|
+
* 3. client.listTools() to discover available tools
|
|
39
|
+
* 4. Register in ChildMcpRegistry
|
|
40
|
+
* 5. Set up crash handler
|
|
41
|
+
* 6. Return discovered tools
|
|
42
|
+
*/
|
|
43
|
+
spawn(mcpConfig: McpConfig | McpPayload, options: SpawnOptions): Promise<SpawnResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Stop a child MCP process gracefully.
|
|
46
|
+
*
|
|
47
|
+
* Flow:
|
|
48
|
+
* 1. Close the MCP client (sends SIGTERM via transport)
|
|
49
|
+
* 2. Wait up to 5s for process to exit
|
|
50
|
+
* 3. SIGKILL if still alive
|
|
51
|
+
* 4. Remove from registry
|
|
52
|
+
*/
|
|
53
|
+
stop(mcpName: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Forward a tool call to a child MCP.
|
|
56
|
+
*/
|
|
57
|
+
callTool(mcpName: string, toolName: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Start a periodic health monitor that pings each child MCP.
|
|
60
|
+
* On failure, marks the child as crashed and clears its tools.
|
|
61
|
+
*/
|
|
62
|
+
startHealthMonitor(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Stop the health monitor.
|
|
65
|
+
*/
|
|
66
|
+
stopHealthMonitor(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Gracefully cleanup all child MCP processes.
|
|
69
|
+
* Called during process exit / SIGINT / SIGTERM.
|
|
70
|
+
*/
|
|
71
|
+
cleanupAll(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Stop all child MCPs that belong to a specific skill.
|
|
74
|
+
*/
|
|
75
|
+
stopBySkill(skillName: string): Promise<string[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Extract the child process from the StdioClientTransport.
|
|
78
|
+
*
|
|
79
|
+
* The SDK stores the child process as `_process` (private). After
|
|
80
|
+
* connection succeeds, the process is alive. On close/crash, the
|
|
81
|
+
* SDK sets `_process = undefined`, so we must extract it while
|
|
82
|
+
* the transport is connected.
|
|
83
|
+
*
|
|
84
|
+
* We also check for the `pid` getter (public API since SDK v1.x)
|
|
85
|
+
* to avoid relying solely on private internals.
|
|
86
|
+
*/
|
|
87
|
+
private extractChildProcess;
|
|
88
|
+
/**
|
|
89
|
+
* Set up a crash handler on the child process.
|
|
90
|
+
* When the process exits unexpectedly, mark it as crashed.
|
|
91
|
+
*/
|
|
92
|
+
private setupCrashHandler;
|
|
93
|
+
/**
|
|
94
|
+
* Validate that the command binary exists on the system.
|
|
95
|
+
* Throws with an actionable error message if not found.
|
|
96
|
+
*/
|
|
97
|
+
private validateCommand;
|
|
98
|
+
/**
|
|
99
|
+
* Build contextual error hints based on stderr output and the MCP config.
|
|
100
|
+
* Helps agents understand what went wrong and what to try.
|
|
101
|
+
*/
|
|
102
|
+
private buildErrorHints;
|
|
103
|
+
/**
|
|
104
|
+
* Race a promise against a timeout, properly cleaning up the timer.
|
|
105
|
+
* Unlike bare Promise.race with setTimeout, this avoids timer leaks.
|
|
106
|
+
*/
|
|
107
|
+
private raceWithTimeout;
|
|
108
|
+
}
|
|
109
|
+
/** Singleton ChildMcpManager instance */
|
|
110
|
+
export declare const childMcpManager: ChildMcpManager;
|
|
111
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/childMcp/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAGH,KAAK,YAAY,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhE,MAAM,WAAW,WAAW;IACxB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IACzB,iEAAiE;IACjE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAAC;IACzC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,qBAAa,eAAe;IACxB,OAAO,CAAC,cAAc,CAA+C;IAErE;;;;;;;;;;OAUG;IACG,KAAK,CACP,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,EAAE,YAAY,GACtB,OAAO,CAAC,WAAW,CAAC;IA0JvB;;;;;;;;OAQG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqC1C;;OAEG;IACG,QAAQ,CACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,OAAO,CAAC;IAiBnB;;;OAGG;IACH,kBAAkB,IAAI,IAAI;IAoC1B;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAQzB;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAmDjC;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA0BvD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IA4CvB;;;OAGG;YACW,eAAe;CAoBhC;AAED,yCAAyC;AACzC,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Child MCP Manager
|
|
3
|
+
*
|
|
4
|
+
* Spawns child MCP processes, connects via stdio transport,
|
|
5
|
+
* discovers their tools, and manages their full lifecycle.
|
|
6
|
+
*
|
|
7
|
+
* This is the core engine for the Evolving Hub — it bridges
|
|
8
|
+
* between the HiveMind MCP server and any number of child
|
|
9
|
+
* MCP servers running as subprocesses.
|
|
10
|
+
*/
|
|
11
|
+
import { spawn as nodeSpawn, execSync } from "node:child_process";
|
|
12
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
13
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
14
|
+
import { childMcpRegistry, } from "../registries/childMcpRegistry.js";
|
|
15
|
+
import { config } from "../config.js";
|
|
16
|
+
// ── Manager ──────────────────────────────────────────────────────
|
|
17
|
+
export class ChildMcpManager {
|
|
18
|
+
healthInterval = null;
|
|
19
|
+
/**
|
|
20
|
+
* Spawn a child MCP process, connect to it, and discover its tools.
|
|
21
|
+
*
|
|
22
|
+
* Flow:
|
|
23
|
+
* 1. Create StdioClientTransport (which spawns the child process)
|
|
24
|
+
* 2. Create MCP Client and connect via the transport
|
|
25
|
+
* 3. client.listTools() to discover available tools
|
|
26
|
+
* 4. Register in ChildMcpRegistry
|
|
27
|
+
* 5. Set up crash handler
|
|
28
|
+
* 6. Return discovered tools
|
|
29
|
+
*/
|
|
30
|
+
async spawn(mcpConfig, options) {
|
|
31
|
+
const name = mcpConfig.name;
|
|
32
|
+
// Package runner commands may need to download packages on first run — use longer timeout
|
|
33
|
+
const needsDownload = ["npx", "uvx", "pipx", "uv"].includes(mcpConfig.command);
|
|
34
|
+
const defaultTimeout = needsDownload ? 120000 : 30000;
|
|
35
|
+
const connectTimeout = options.connectTimeout ?? defaultTimeout;
|
|
36
|
+
// Check if already running
|
|
37
|
+
if (childMcpRegistry.has(name)) {
|
|
38
|
+
const existing = childMcpRegistry.get(name);
|
|
39
|
+
if (existing.status === "active") {
|
|
40
|
+
return {
|
|
41
|
+
name,
|
|
42
|
+
tools: existing.tools,
|
|
43
|
+
client: existing.client,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// If crashed, remove and re-spawn
|
|
47
|
+
childMcpRegistry.remove(name);
|
|
48
|
+
}
|
|
49
|
+
let transport;
|
|
50
|
+
let client;
|
|
51
|
+
// Collect stderr output from the child process for diagnostics
|
|
52
|
+
let stderrOutput = "";
|
|
53
|
+
try {
|
|
54
|
+
// 0. Pre-flight: verify the command binary exists on the system
|
|
55
|
+
this.validateCommand(mcpConfig.command);
|
|
56
|
+
// ── Debug: log the exact spawn command ──
|
|
57
|
+
const mcpEnvKeys = Object.keys(mcpConfig.env || {});
|
|
58
|
+
console.error(`[ChildMcpManager] Spawning '${name}':\n` +
|
|
59
|
+
` command: ${mcpConfig.command}\n` +
|
|
60
|
+
` args: ${JSON.stringify(mcpConfig.args)}\n` +
|
|
61
|
+
` mcp env keys: ${mcpEnvKeys.join(", ") || "(none)"}\n` +
|
|
62
|
+
` timeout: ${connectTimeout}ms (${needsDownload ? "extended for package download" : "standard"})`);
|
|
63
|
+
// 1. Create the stdio transport with stderr piped for diagnostics
|
|
64
|
+
// The SDK handles default env inheritance (PATH, APPDATA, etc.)
|
|
65
|
+
// automatically inside start(). We only pass MCP-specific env vars.
|
|
66
|
+
transport = new StdioClientTransport({
|
|
67
|
+
command: mcpConfig.command,
|
|
68
|
+
args: mcpConfig.args,
|
|
69
|
+
env: mcpConfig.env && Object.keys(mcpConfig.env).length > 0
|
|
70
|
+
? mcpConfig.env
|
|
71
|
+
: undefined, // Let SDK use its own defaults when no custom env needed
|
|
72
|
+
stderr: "pipe",
|
|
73
|
+
});
|
|
74
|
+
// ── Capture stderr from the child process for diagnostics ──
|
|
75
|
+
// The SDK's PassThrough stream is available immediately when stderr: 'pipe'
|
|
76
|
+
if (transport.stderr) {
|
|
77
|
+
transport.stderr.on("data", (chunk) => {
|
|
78
|
+
stderrOutput += chunk.toString();
|
|
79
|
+
// Cap at 4KB to avoid memory issues
|
|
80
|
+
if (stderrOutput.length > 4096) {
|
|
81
|
+
stderrOutput = stderrOutput.slice(-4096);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// 2. Create and connect the MCP client with a timeout
|
|
86
|
+
client = new Client({
|
|
87
|
+
name: `hivemind-${name}`,
|
|
88
|
+
version: "1.0.0",
|
|
89
|
+
});
|
|
90
|
+
// Race the connection against a cancellable timeout
|
|
91
|
+
await this.raceWithTimeout(client.connect(transport), connectTimeout, `Connection to '${name}' timed out after ${connectTimeout}ms`);
|
|
92
|
+
// 3. Discover tools
|
|
93
|
+
const { tools: rawTools } = await client.listTools();
|
|
94
|
+
const tools = rawTools.map((tool) => ({
|
|
95
|
+
name: tool.name,
|
|
96
|
+
description: tool.description ?? "",
|
|
97
|
+
inputSchema: tool.inputSchema ?? {},
|
|
98
|
+
}));
|
|
99
|
+
// 4. Get a reference to the underlying child process from transport
|
|
100
|
+
// The SDK stores it as `_process` after start() completes
|
|
101
|
+
const childProcess = this.extractChildProcess(transport, name);
|
|
102
|
+
// 5. Build the registry entry
|
|
103
|
+
const entry = {
|
|
104
|
+
process: childProcess,
|
|
105
|
+
client,
|
|
106
|
+
tools,
|
|
107
|
+
config: {
|
|
108
|
+
name: mcpConfig.name,
|
|
109
|
+
description: mcpConfig.description,
|
|
110
|
+
command: mcpConfig.command,
|
|
111
|
+
args: mcpConfig.args,
|
|
112
|
+
env: mcpConfig.env,
|
|
113
|
+
},
|
|
114
|
+
source: options.source,
|
|
115
|
+
memory_id: options.memory_id,
|
|
116
|
+
status: "active",
|
|
117
|
+
spawned_at: new Date(),
|
|
118
|
+
};
|
|
119
|
+
// 6. Register in the registry (enforces limits)
|
|
120
|
+
childMcpRegistry.add(name, entry);
|
|
121
|
+
// 7. Set up crash handler
|
|
122
|
+
this.setupCrashHandler(name, childProcess);
|
|
123
|
+
console.error(`[ChildMcpManager] Spawned '${name}' successfully (${tools.length} tools): ` +
|
|
124
|
+
`${tools.map((t) => t.name).join(", ")}`);
|
|
125
|
+
return { name, tools, client };
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// ── Enhanced error with contextual hints ──
|
|
129
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
130
|
+
console.error(`[ChildMcpManager] SPAWN FAILED for '${name}':\n` +
|
|
131
|
+
` error: ${errorMsg}\n` +
|
|
132
|
+
` command: ${mcpConfig.command}\n` +
|
|
133
|
+
` args: ${JSON.stringify(mcpConfig.args)}\n` +
|
|
134
|
+
` child stderr: ${stderrOutput || "(empty)"}`);
|
|
135
|
+
// Cleanup on failure
|
|
136
|
+
try {
|
|
137
|
+
if (client)
|
|
138
|
+
await client.close();
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// Best effort
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
if (transport)
|
|
145
|
+
await transport.close();
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// Best effort
|
|
149
|
+
}
|
|
150
|
+
// Build actionable error with stderr + contextual hints
|
|
151
|
+
const stderrHint = stderrOutput
|
|
152
|
+
? `\nChild process stderr:\n${stderrOutput.slice(0, 1500)}`
|
|
153
|
+
: "";
|
|
154
|
+
const contextHint = this.buildErrorHints(mcpConfig, stderrOutput, errorMsg);
|
|
155
|
+
throw new Error(`Failed to spawn MCP '${name}': ${errorMsg}${stderrHint}${contextHint}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Stop a child MCP process gracefully.
|
|
160
|
+
*
|
|
161
|
+
* Flow:
|
|
162
|
+
* 1. Close the MCP client (sends SIGTERM via transport)
|
|
163
|
+
* 2. Wait up to 5s for process to exit
|
|
164
|
+
* 3. SIGKILL if still alive
|
|
165
|
+
* 4. Remove from registry
|
|
166
|
+
*/
|
|
167
|
+
async stop(mcpName) {
|
|
168
|
+
const entry = childMcpRegistry.get(mcpName);
|
|
169
|
+
if (!entry) {
|
|
170
|
+
throw new Error(`No active MCP named '${mcpName}'`);
|
|
171
|
+
}
|
|
172
|
+
console.error(`[ChildMcpManager] Stopping '${mcpName}'...`);
|
|
173
|
+
try {
|
|
174
|
+
// client.close() will close the transport which sends SIGTERM
|
|
175
|
+
await this.raceWithTimeout(entry.client.close(), 5000, "Client close timed out");
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// If close fails, force kill
|
|
179
|
+
try {
|
|
180
|
+
entry.process.kill("SIGKILL");
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// Process may already be dead
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Ensure the process is dead
|
|
187
|
+
if (!entry.process.killed) {
|
|
188
|
+
try {
|
|
189
|
+
entry.process.kill("SIGKILL");
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
// Process may already be dead
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
childMcpRegistry.remove(mcpName);
|
|
196
|
+
console.error(`[ChildMcpManager] Stopped '${mcpName}'`);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Forward a tool call to a child MCP.
|
|
200
|
+
*/
|
|
201
|
+
async callTool(mcpName, toolName, params = {}) {
|
|
202
|
+
const entry = childMcpRegistry.get(mcpName);
|
|
203
|
+
if (!entry) {
|
|
204
|
+
throw new Error(`No active MCP named '${mcpName}'`);
|
|
205
|
+
}
|
|
206
|
+
if (entry.status === "crashed") {
|
|
207
|
+
throw new Error(`MCP '${mcpName}' has crashed and is not responding`);
|
|
208
|
+
}
|
|
209
|
+
const result = await entry.client.callTool({
|
|
210
|
+
name: toolName,
|
|
211
|
+
arguments: params,
|
|
212
|
+
});
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Start a periodic health monitor that pings each child MCP.
|
|
217
|
+
* On failure, marks the child as crashed and clears its tools.
|
|
218
|
+
*/
|
|
219
|
+
startHealthMonitor() {
|
|
220
|
+
if (this.healthInterval)
|
|
221
|
+
return; // Already running
|
|
222
|
+
const interval = config.childHealthInterval;
|
|
223
|
+
console.error(`[ChildMcpManager] Health monitor started (interval: ${interval}ms)`);
|
|
224
|
+
this.healthInterval = setInterval(async () => {
|
|
225
|
+
const entries = childMcpRegistry.list();
|
|
226
|
+
for (const entry of entries) {
|
|
227
|
+
if (entry.status === "crashed")
|
|
228
|
+
continue;
|
|
229
|
+
const name = childMcpRegistry.names().find((n) => childMcpRegistry.get(n) === entry);
|
|
230
|
+
if (!name)
|
|
231
|
+
continue;
|
|
232
|
+
try {
|
|
233
|
+
// Ping by listing tools — lightweight health check
|
|
234
|
+
await this.raceWithTimeout(entry.client.listTools(), 5000, "Health check timed out");
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
console.error(`[ChildMcpManager] Health check failed for '${name}' — deactivating automatically`);
|
|
238
|
+
childMcpRegistry.remove(name);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}, interval);
|
|
242
|
+
// Don't let the health monitor prevent process exit
|
|
243
|
+
if (this.healthInterval.unref) {
|
|
244
|
+
this.healthInterval.unref();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Stop the health monitor.
|
|
249
|
+
*/
|
|
250
|
+
stopHealthMonitor() {
|
|
251
|
+
if (this.healthInterval) {
|
|
252
|
+
clearInterval(this.healthInterval);
|
|
253
|
+
this.healthInterval = null;
|
|
254
|
+
console.error("[ChildMcpManager] Health monitor stopped");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Gracefully cleanup all child MCP processes.
|
|
259
|
+
* Called during process exit / SIGINT / SIGTERM.
|
|
260
|
+
*/
|
|
261
|
+
async cleanupAll() {
|
|
262
|
+
this.stopHealthMonitor();
|
|
263
|
+
const names = childMcpRegistry.names();
|
|
264
|
+
if (names.length === 0)
|
|
265
|
+
return;
|
|
266
|
+
console.error(`[ChildMcpManager] Cleaning up ${names.length} child MCP(s)...`);
|
|
267
|
+
const cleanupPromises = names.map(async (name) => {
|
|
268
|
+
try {
|
|
269
|
+
await this.stop(name);
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
console.error(`[ChildMcpManager] Error stopping '${name}': ${error instanceof Error ? error.message : String(error)}`);
|
|
273
|
+
// Force kill as last resort
|
|
274
|
+
const entry = childMcpRegistry.get(name);
|
|
275
|
+
if (entry?.process && !entry.process.killed) {
|
|
276
|
+
try {
|
|
277
|
+
entry.process.kill("SIGKILL");
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
// Already dead
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
childMcpRegistry.remove(name);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
// Wait for all cleanups with a global timeout
|
|
287
|
+
await this.raceWithTimeout(Promise.allSettled(cleanupPromises), 10000, "Cleanup timeout").catch(() => {
|
|
288
|
+
// On timeout, force kill everything remaining
|
|
289
|
+
for (const name of childMcpRegistry.names()) {
|
|
290
|
+
const entry = childMcpRegistry.get(name);
|
|
291
|
+
if (entry?.process && !entry.process.killed) {
|
|
292
|
+
try {
|
|
293
|
+
entry.process.kill("SIGKILL");
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// Already dead
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
childMcpRegistry.remove(name);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
console.error("[ChildMcpManager] All child MCPs cleaned up");
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Stop all child MCPs that belong to a specific skill.
|
|
306
|
+
*/
|
|
307
|
+
async stopBySkill(skillName) {
|
|
308
|
+
const entries = childMcpRegistry.listBySkill(skillName);
|
|
309
|
+
const stoppedNames = [];
|
|
310
|
+
for (const entry of entries) {
|
|
311
|
+
const name = childMcpRegistry.names().find((n) => childMcpRegistry.get(n) === entry);
|
|
312
|
+
if (name) {
|
|
313
|
+
try {
|
|
314
|
+
await this.stop(name);
|
|
315
|
+
stoppedNames.push(name);
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.error(`[ChildMcpManager] Error stopping skill-bundled MCP '${name}': ` +
|
|
319
|
+
`${error instanceof Error ? error.message : String(error)}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return stoppedNames;
|
|
324
|
+
}
|
|
325
|
+
// ── Private helpers ──────────────────────────────────────────
|
|
326
|
+
/**
|
|
327
|
+
* Extract the child process from the StdioClientTransport.
|
|
328
|
+
*
|
|
329
|
+
* The SDK stores the child process as `_process` (private). After
|
|
330
|
+
* connection succeeds, the process is alive. On close/crash, the
|
|
331
|
+
* SDK sets `_process = undefined`, so we must extract it while
|
|
332
|
+
* the transport is connected.
|
|
333
|
+
*
|
|
334
|
+
* We also check for the `pid` getter (public API since SDK v1.x)
|
|
335
|
+
* to avoid relying solely on private internals.
|
|
336
|
+
*/
|
|
337
|
+
extractChildProcess(transport, mcpName) {
|
|
338
|
+
// Approach 1: Try the internal `_process` property (SDK v1.x stores it here)
|
|
339
|
+
const transportAny = transport;
|
|
340
|
+
if (transportAny._process) {
|
|
341
|
+
return transportAny._process;
|
|
342
|
+
}
|
|
343
|
+
// Approach 2: If we have a PID from the public getter, we can't get the
|
|
344
|
+
// ChildProcess object from it, but at least we know it's running.
|
|
345
|
+
// Fall back to a sentinel with a warning.
|
|
346
|
+
const pid = transport.pid;
|
|
347
|
+
console.error(`[ChildMcpManager] Warning: Could not extract child process object for '${mcpName}'.` +
|
|
348
|
+
(pid ? ` PID is ${pid}.` : " PID unknown.") +
|
|
349
|
+
" Crash detection may not work — process lifecycle managed by SDK.");
|
|
350
|
+
// Create a sentinel process so the rest of the code doesn't break.
|
|
351
|
+
// Using a no-op command on Windows (cmd /c exit) or Unix (true)
|
|
352
|
+
const sentinel = process.platform === "win32"
|
|
353
|
+
? nodeSpawn("cmd", ["/c", "exit"], { stdio: "ignore" })
|
|
354
|
+
: nodeSpawn("true", [], { stdio: "ignore" });
|
|
355
|
+
return sentinel;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Set up a crash handler on the child process.
|
|
359
|
+
* When the process exits unexpectedly, mark it as crashed.
|
|
360
|
+
*/
|
|
361
|
+
setupCrashHandler(name, childProc) {
|
|
362
|
+
childProc.on("exit", (code, signal) => {
|
|
363
|
+
const entry = childMcpRegistry.get(name);
|
|
364
|
+
if (entry && entry.status === "active") {
|
|
365
|
+
console.error(`[ChildMcpManager] Child '${name}' exited unexpectedly ` +
|
|
366
|
+
`(code: ${code}, signal: ${signal}) — deactivating automatically`);
|
|
367
|
+
childMcpRegistry.remove(name);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
childProc.on("error", (err) => {
|
|
371
|
+
const entry = childMcpRegistry.get(name);
|
|
372
|
+
if (entry) {
|
|
373
|
+
console.error(`[ChildMcpManager] Child '${name}' error: ${err.message} — deactivating automatically`);
|
|
374
|
+
childMcpRegistry.remove(name);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Validate that the command binary exists on the system.
|
|
380
|
+
* Throws with an actionable error message if not found.
|
|
381
|
+
*/
|
|
382
|
+
validateCommand(command) {
|
|
383
|
+
// Skip validation for absolute paths (they either exist or spawn will fail clearly)
|
|
384
|
+
if (command.includes("/") || command.includes("\\"))
|
|
385
|
+
return;
|
|
386
|
+
try {
|
|
387
|
+
const whereCmd = process.platform === "win32" ? "where" : "which";
|
|
388
|
+
execSync(`${whereCmd} ${command}`, { stdio: "ignore" });
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
const installHints = {
|
|
392
|
+
uvx: "Install uv: https://docs.astral.sh/uv/getting-started/installation/",
|
|
393
|
+
npx: "npx comes with Node.js. Install Node.js: https://nodejs.org/",
|
|
394
|
+
pipx: "Install pipx: https://pipx.pypa.io/stable/installation/",
|
|
395
|
+
docker: "Install Docker: https://docs.docker.com/get-docker/",
|
|
396
|
+
};
|
|
397
|
+
const hint = installHints[command] ?? `Ensure '${command}' is installed and in your PATH.`;
|
|
398
|
+
throw new Error(`Command '${command}' not found on this system. ${hint}`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Build contextual error hints based on stderr output and the MCP config.
|
|
403
|
+
* Helps agents understand what went wrong and what to try.
|
|
404
|
+
*/
|
|
405
|
+
buildErrorHints(mcpConfig, stderr, errorMsg) {
|
|
406
|
+
const hints = [];
|
|
407
|
+
// Detect missing Python extras
|
|
408
|
+
if (stderr.includes("ModuleNotFoundError") || stderr.includes("No module named")) {
|
|
409
|
+
hints.push("The Python package appears to be missing required extras or dependencies. " +
|
|
410
|
+
"For packages installed via uvx/pip, try installing with extras " +
|
|
411
|
+
`(e.g., \`pip install "${mcpConfig.args?.[0] || mcpConfig.name}[all]"\`).`);
|
|
412
|
+
}
|
|
413
|
+
// Detect connection closed (process crashed immediately)
|
|
414
|
+
if (errorMsg.includes("Connection closed") || errorMsg.includes("-32000")) {
|
|
415
|
+
hints.push("The child process exited before completing the MCP handshake. " +
|
|
416
|
+
"This usually means the child crashed on startup.");
|
|
417
|
+
}
|
|
418
|
+
// Detect npm/node module issues
|
|
419
|
+
if (stderr.includes("Cannot find module") || stderr.includes("MODULE_NOT_FOUND")) {
|
|
420
|
+
hints.push("A Node.js module is missing. This can happen if the package wasn't fully installed. " +
|
|
421
|
+
"Try running the command manually to see the full error.");
|
|
422
|
+
}
|
|
423
|
+
// Detect timeout
|
|
424
|
+
if (errorMsg.includes("timed out")) {
|
|
425
|
+
hints.push("The connection timed out. If this is the first run and the command needs to " +
|
|
426
|
+
"download packages (uvx/npx), try again — the download may complete next time.");
|
|
427
|
+
}
|
|
428
|
+
if (hints.length === 0)
|
|
429
|
+
return "";
|
|
430
|
+
return "\n\n💡 Hints:\n" + hints.map((h) => `- ${h}`).join("\n");
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Race a promise against a timeout, properly cleaning up the timer.
|
|
434
|
+
* Unlike bare Promise.race with setTimeout, this avoids timer leaks.
|
|
435
|
+
*/
|
|
436
|
+
async raceWithTimeout(promise, ms, message) {
|
|
437
|
+
let timer;
|
|
438
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
439
|
+
timer = setTimeout(() => reject(new Error(message)), ms);
|
|
440
|
+
});
|
|
441
|
+
try {
|
|
442
|
+
const result = await Promise.race([promise, timeoutPromise]);
|
|
443
|
+
return result;
|
|
444
|
+
}
|
|
445
|
+
finally {
|
|
446
|
+
if (timer !== undefined) {
|
|
447
|
+
clearTimeout(timer);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/** Singleton ChildMcpManager instance */
|
|
453
|
+
export const childMcpManager = new ChildMcpManager();
|
|
454
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","s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ACP,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,YAAY,CAAC,KAAK,CAAC,CAAC;YACxB,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,yCAAyC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HiveMind REST Client
|
|
3
|
+
*
|
|
4
|
+
* Thin fetch-based client for the HiveMind FastAPI core.
|
|
5
|
+
* Uses native fetch (Node 18+) with AbortController timeouts
|
|
6
|
+
* and single-retry for transient failures.
|
|
7
|
+
*/
|
|
8
|
+
import type { QueryParams, QueryResult, WriteParams, WriteResult, MemoryDetail, HealthStatus, MemoryListParams, MemoryListResult, ActivationResponse, CapabilityReportParams, AdminCapabilityReadResponse } from "./types.js";
|
|
9
|
+
export declare class HiveMindRestClient {
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
private readonly timeout;
|
|
12
|
+
private readonly apiKey;
|
|
13
|
+
constructor(baseUrl?: string, timeout?: number, apiKey?: string);
|
|
14
|
+
query(params: QueryParams): Promise<QueryResult>;
|
|
15
|
+
writeMemory(params: WriteParams): Promise<WriteResult>;
|
|
16
|
+
getMemory(memoryId: string): Promise<MemoryDetail>;
|
|
17
|
+
getHealth(): Promise<HealthStatus>;
|
|
18
|
+
listMemories(params?: MemoryListParams): Promise<MemoryListResult>;
|
|
19
|
+
activateCapability(memoryId: string, agentId: string): Promise<ActivationResponse>;
|
|
20
|
+
reportCapability(memoryId: string, params: CapabilityReportParams): Promise<{
|
|
21
|
+
ok: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
getSkill(memoryId: string): Promise<AdminCapabilityReadResponse>;
|
|
24
|
+
getMcp(memoryId: string): Promise<AdminCapabilityReadResponse>;
|
|
25
|
+
private encodePathSegments;
|
|
26
|
+
private buildHeaders;
|
|
27
|
+
private post;
|
|
28
|
+
private get;
|
|
29
|
+
private handleResponse;
|
|
30
|
+
private requestWithRetry;
|
|
31
|
+
private isRetryableError;
|
|
32
|
+
private normalizeError;
|
|
33
|
+
}
|
|
34
|
+
/** Singleton REST client instance */
|
|
35
|
+
export declare const restClient: HiveMindRestClient;
|
|
36
|
+
//# sourceMappingURL=restClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restClient.d.ts","sourceRoot":"","sources":["../../src/client/restClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC9B,MAAM,YAAY,CAAC;AAEpB,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;gBAEhC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAQzD,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAIhD,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAItD,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlD,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAIlC,YAAY,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAalE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOlF,gBAAgB,CAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,sBAAsB,GAC/B,O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