ft-scout 9.0.7 → 9.0.8
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/.firebase/hosting.d2Vi.cache +8 -8
- package/AUTONOMOUS_FEATURES.md +1 -1
- package/README.md +113 -16
- package/bin/src/commands/agent.js +2 -2
- package/bin/src/commands/agent.js.map +1 -1
- package/bin/src/commands/audit.js +1 -1
- package/bin/src/commands/audit.js.map +1 -1
- package/bin/src/commands/dashboard.js +1 -1
- package/bin/src/commands/dashboard.js.map +1 -1
- package/bin/src/commands/mcp.d.ts.map +1 -0
- package/bin/src/commands/mcp.js +393 -0
- package/bin/src/commands/mcp.js.map +1 -0
- package/bin/src/commands/owners.js +1 -1
- package/bin/src/commands/owners.js.map +1 -1
- package/bin/src/discovery/messages.js +2 -2
- package/bin/src/discovery/messages.js.map +1 -1
- package/bin/src/discovery/signals.js +3 -3
- package/bin/src/discovery/signals.js.map +1 -1
- package/bin/src/engine/agentEngine.d.ts.map +1 -1
- package/bin/src/engine/agentEngine.js +53 -11
- package/bin/src/engine/agentEngine.js.map +1 -1
- package/bin/src/engine/runtime/agentRuntime.d.ts.map +1 -1
- package/bin/src/engine/runtime/agentRuntime.js +40 -3
- package/bin/src/engine/runtime/agentRuntime.js.map +1 -1
- package/bin/src/engine/toolRegistry.d.ts.map +1 -1
- package/bin/src/engine/toolRegistry.js +13 -0
- package/bin/src/engine/toolRegistry.js.map +1 -1
- package/bin/src/engine/verifier.js +2 -2
- package/bin/src/engine/verifier.js.map +1 -1
- package/bin/src/index.js +85 -7
- package/bin/src/index.js.map +1 -1
- package/bin/src/mcp/client.d.ts.map +1 -0
- package/bin/src/mcp/client.js +127 -0
- package/bin/src/mcp/client.js.map +1 -0
- package/bin/src/mcp/discovery.d.ts.map +1 -0
- package/bin/src/mcp/discovery.js +91 -0
- package/bin/src/mcp/discovery.js.map +1 -0
- package/bin/src/mcp/health.d.ts.map +1 -0
- package/bin/src/mcp/health.js +44 -0
- package/bin/src/mcp/health.js.map +1 -0
- package/bin/src/mcp/index.d.ts.map +1 -0
- package/bin/src/mcp/index.js +15 -0
- package/bin/src/mcp/index.js.map +1 -0
- package/bin/src/mcp/manager.d.ts.map +1 -0
- package/bin/src/mcp/manager.js +535 -0
- package/bin/src/mcp/manager.js.map +1 -0
- package/bin/src/mcp/permissions.d.ts.map +1 -0
- package/bin/src/mcp/permissions.js +50 -0
- package/bin/src/mcp/permissions.js.map +1 -0
- package/bin/src/mcp/persistence.d.ts.map +1 -0
- package/bin/src/mcp/persistence.js +156 -0
- package/bin/src/mcp/persistence.js.map +1 -0
- package/bin/src/mcp/recovery.d.ts.map +1 -0
- package/bin/src/mcp/recovery.js +75 -0
- package/bin/src/mcp/recovery.js.map +1 -0
- package/bin/src/mcp/telemetry.d.ts.map +1 -0
- package/bin/src/mcp/telemetry.js +82 -0
- package/bin/src/mcp/telemetry.js.map +1 -0
- package/bin/src/mcp/toolRouter.d.ts.map +1 -0
- package/bin/src/mcp/toolRouter.js +127 -0
- package/bin/src/mcp/toolRouter.js.map +1 -0
- package/bin/src/mcp/transport.d.ts.map +1 -0
- package/bin/src/mcp/transport.js +328 -0
- package/bin/src/mcp/transport.js.map +1 -0
- package/bin/src/mcp/types.d.ts.map +1 -0
- package/bin/src/mcp/types.js +6 -0
- package/bin/src/mcp/types.js.map +1 -0
- package/bin/src/server/server.d.ts.map +1 -1
- package/bin/src/server/server.js +207 -0
- package/bin/src/server/server.js.map +1 -1
- package/bin/src/utils/branding.js +1 -1
- package/bin/src/utils/email.js +4 -4
- package/package.json +1 -1
- package/web/app.js +1255 -59
- package/web/styles.css +1474 -15
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scout MCP Ecosystem - Transports
|
|
3
|
+
* Implements Streamable HTTP and stdio local process transports for MCP JSON-RPC 2.0.
|
|
4
|
+
*/
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
/**
|
|
7
|
+
* Streamable HTTP Transport
|
|
8
|
+
* Communicates with remote or local HTTP MCP servers using JSON-RPC 2.0 over HTTP.
|
|
9
|
+
*/
|
|
10
|
+
export class HttpMcpTransport {
|
|
11
|
+
endpoint;
|
|
12
|
+
headers;
|
|
13
|
+
connected = false;
|
|
14
|
+
requestId = 1;
|
|
15
|
+
notificationListeners = [];
|
|
16
|
+
constructor(endpoint, headers = {}) {
|
|
17
|
+
this.endpoint = endpoint.trim().replace(/\/+$/, '');
|
|
18
|
+
this.headers = {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
'Accept': 'application/json, text/event-stream',
|
|
21
|
+
...headers,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
getTransportType() {
|
|
25
|
+
return 'http';
|
|
26
|
+
}
|
|
27
|
+
isConnected() {
|
|
28
|
+
return this.connected;
|
|
29
|
+
}
|
|
30
|
+
onNotification(listener) {
|
|
31
|
+
this.notificationListeners.push(listener);
|
|
32
|
+
}
|
|
33
|
+
async connect() {
|
|
34
|
+
// Ping or check reachability
|
|
35
|
+
try {
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timeout = setTimeout(() => controller.abort(), 10000);
|
|
38
|
+
const res = await fetch(this.endpoint, {
|
|
39
|
+
method: 'GET',
|
|
40
|
+
headers: this.headers,
|
|
41
|
+
signal: controller.signal,
|
|
42
|
+
}).catch(() => null);
|
|
43
|
+
clearTimeout(timeout);
|
|
44
|
+
// Accept standard HTTP status codes (200, 404/405 for GET on POST endpoint is fine for connect check)
|
|
45
|
+
if (res && res.status >= 500) {
|
|
46
|
+
throw new Error(`MCP HTTP Server returned status ${res.status} ${res.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
this.connected = true;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
this.connected = false;
|
|
52
|
+
throw new Error(`Failed to connect to MCP HTTP endpoint at ${this.endpoint}: ${err?.message || String(err)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async disconnect() {
|
|
56
|
+
this.connected = false;
|
|
57
|
+
}
|
|
58
|
+
async sendRequest(method, params, timeoutMs = 30000) {
|
|
59
|
+
const id = this.requestId++;
|
|
60
|
+
const requestPayload = {
|
|
61
|
+
jsonrpc: '2.0',
|
|
62
|
+
id,
|
|
63
|
+
method,
|
|
64
|
+
...(params !== undefined ? { params } : {}),
|
|
65
|
+
};
|
|
66
|
+
const controller = new AbortController();
|
|
67
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(this.endpoint, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: this.headers,
|
|
72
|
+
body: JSON.stringify(requestPayload),
|
|
73
|
+
signal: controller.signal,
|
|
74
|
+
});
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
const text = await response.text().catch(() => '');
|
|
78
|
+
throw new Error(`HTTP ${response.status} ${response.statusText}: ${text || 'Empty response'}`);
|
|
79
|
+
}
|
|
80
|
+
const contentType = response.headers.get('content-type') || '';
|
|
81
|
+
let data;
|
|
82
|
+
if (contentType.includes('text/event-stream')) {
|
|
83
|
+
// Parse SSE response
|
|
84
|
+
const text = await response.text();
|
|
85
|
+
const lines = text.split('\n');
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
if (line.startsWith('data:')) {
|
|
88
|
+
const jsonStr = line.slice(5).trim();
|
|
89
|
+
if (jsonStr) {
|
|
90
|
+
try {
|
|
91
|
+
data = JSON.parse(jsonStr);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
catch { }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (!data) {
|
|
99
|
+
throw new Error(`Invalid SSE response from MCP server: ${text.slice(0, 200)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
data = await response.json();
|
|
104
|
+
}
|
|
105
|
+
if (data.error) {
|
|
106
|
+
throw new Error(data.error.message || `MCP Error code ${data.error.code}`);
|
|
107
|
+
}
|
|
108
|
+
return data.result;
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
if (err.name === 'AbortError') {
|
|
113
|
+
throw new Error(`MCP Request timed out after ${timeoutMs}ms for method "${method}"`);
|
|
114
|
+
}
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async sendNotification(method, params) {
|
|
119
|
+
const notificationPayload = {
|
|
120
|
+
jsonrpc: '2.0',
|
|
121
|
+
method,
|
|
122
|
+
...(params !== undefined ? { params } : {}),
|
|
123
|
+
};
|
|
124
|
+
try {
|
|
125
|
+
await fetch(this.endpoint, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: this.headers,
|
|
128
|
+
body: JSON.stringify(notificationPayload),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Notifications do not wait for responses
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* stdio Local Process Transport
|
|
138
|
+
* Spawns a local MCP server child process communicating over stdin/stdout with newline-delimited JSON-RPC 2.0.
|
|
139
|
+
*/
|
|
140
|
+
export class StdioMcpTransport {
|
|
141
|
+
command;
|
|
142
|
+
args;
|
|
143
|
+
env;
|
|
144
|
+
process = null;
|
|
145
|
+
connected = false;
|
|
146
|
+
requestId = 1;
|
|
147
|
+
pendingRequests = new Map();
|
|
148
|
+
notificationListeners = [];
|
|
149
|
+
stdoutBuffer = '';
|
|
150
|
+
stderrBuffer = '';
|
|
151
|
+
constructor(command, args = [], env = {}) {
|
|
152
|
+
this.command = command;
|
|
153
|
+
this.args = args;
|
|
154
|
+
this.env = env;
|
|
155
|
+
}
|
|
156
|
+
getTransportType() {
|
|
157
|
+
return 'stdio';
|
|
158
|
+
}
|
|
159
|
+
isConnected() {
|
|
160
|
+
return this.connected && this.process !== null && !this.process.killed;
|
|
161
|
+
}
|
|
162
|
+
onNotification(listener) {
|
|
163
|
+
this.notificationListeners.push(listener);
|
|
164
|
+
}
|
|
165
|
+
getStderrDiagnostics() {
|
|
166
|
+
return this.stderrBuffer.slice(-2000);
|
|
167
|
+
}
|
|
168
|
+
async connect() {
|
|
169
|
+
return new Promise((resolve, reject) => {
|
|
170
|
+
try {
|
|
171
|
+
const fullEnv = {
|
|
172
|
+
...process.env,
|
|
173
|
+
...this.env,
|
|
174
|
+
};
|
|
175
|
+
this.process = spawn(this.command, this.args, {
|
|
176
|
+
env: fullEnv,
|
|
177
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
178
|
+
shell: process.platform === 'win32',
|
|
179
|
+
});
|
|
180
|
+
let spawnErrorOccurred = false;
|
|
181
|
+
this.process.on('error', (err) => {
|
|
182
|
+
spawnErrorOccurred = true;
|
|
183
|
+
this.connected = false;
|
|
184
|
+
reject(new Error(`Failed to spawn MCP process "${this.command}": ${err.message}`));
|
|
185
|
+
});
|
|
186
|
+
this.process.stdout?.on('data', (chunk) => {
|
|
187
|
+
this.handleStdoutData(chunk.toString('utf-8'));
|
|
188
|
+
});
|
|
189
|
+
this.process.stderr?.on('data', (chunk) => {
|
|
190
|
+
this.stderrBuffer += chunk.toString('utf-8');
|
|
191
|
+
if (this.stderrBuffer.length > 10000) {
|
|
192
|
+
this.stderrBuffer = this.stderrBuffer.slice(-5000);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
this.process.on('exit', (code, signal) => {
|
|
196
|
+
this.connected = false;
|
|
197
|
+
for (const [id, req] of this.pendingRequests.entries()) {
|
|
198
|
+
clearTimeout(req.timer);
|
|
199
|
+
req.reject(new Error(`MCP process exited with code ${code ?? signal}`));
|
|
200
|
+
this.pendingRequests.delete(id);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
// Short settle delay to ensure process didn't immediately crash on start
|
|
204
|
+
setTimeout(() => {
|
|
205
|
+
if (!spawnErrorOccurred && this.process && !this.process.killed) {
|
|
206
|
+
this.connected = true;
|
|
207
|
+
resolve();
|
|
208
|
+
}
|
|
209
|
+
}, 100);
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
this.connected = false;
|
|
213
|
+
reject(err);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
async disconnect() {
|
|
218
|
+
this.connected = false;
|
|
219
|
+
if (this.process) {
|
|
220
|
+
for (const [id, req] of this.pendingRequests.entries()) {
|
|
221
|
+
clearTimeout(req.timer);
|
|
222
|
+
req.reject(new Error('MCP process disconnected'));
|
|
223
|
+
this.pendingRequests.delete(id);
|
|
224
|
+
}
|
|
225
|
+
try {
|
|
226
|
+
this.process.kill('SIGTERM');
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
try {
|
|
230
|
+
this.process.kill();
|
|
231
|
+
}
|
|
232
|
+
catch { }
|
|
233
|
+
}
|
|
234
|
+
this.process = null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
handleStdoutData(data) {
|
|
238
|
+
this.stdoutBuffer += data;
|
|
239
|
+
let newlineIndex;
|
|
240
|
+
while ((newlineIndex = this.stdoutBuffer.indexOf('\n')) !== -1) {
|
|
241
|
+
const line = this.stdoutBuffer.slice(0, newlineIndex).trim();
|
|
242
|
+
this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
|
|
243
|
+
if (line) {
|
|
244
|
+
this.parseJsonRpcLine(line);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
parseJsonRpcLine(line) {
|
|
249
|
+
try {
|
|
250
|
+
// Support Content-Length prefix if sent by some standard language servers
|
|
251
|
+
let payload = line;
|
|
252
|
+
if (line.startsWith('Content-Length:')) {
|
|
253
|
+
const headerEnd = line.indexOf('\r\n\r\n');
|
|
254
|
+
if (headerEnd !== -1) {
|
|
255
|
+
payload = line.slice(headerEnd + 4);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const parsed = JSON.parse(payload);
|
|
262
|
+
// Handle Response to pending request
|
|
263
|
+
if (parsed.id !== undefined && this.pendingRequests.has(parsed.id)) {
|
|
264
|
+
const pending = this.pendingRequests.get(parsed.id);
|
|
265
|
+
clearTimeout(pending.timer);
|
|
266
|
+
this.pendingRequests.delete(parsed.id);
|
|
267
|
+
if (parsed.error) {
|
|
268
|
+
pending.reject(new Error(parsed.error.message || `MCP Error code ${parsed.error.code}`));
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
pending.resolve(parsed.result);
|
|
272
|
+
}
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
// Handle Notification
|
|
276
|
+
if (parsed.method) {
|
|
277
|
+
for (const listener of this.notificationListeners) {
|
|
278
|
+
try {
|
|
279
|
+
listener(parsed.method, parsed.params);
|
|
280
|
+
}
|
|
281
|
+
catch { }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// Ignore non-JSON lines (e.g. startup banner text output by child process)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
sendRequest(method, params, timeoutMs = 30000) {
|
|
290
|
+
return new Promise((resolve, reject) => {
|
|
291
|
+
if (!this.isConnected() || !this.process?.stdin) {
|
|
292
|
+
return reject(new Error(`MCP stdio transport is not connected for "${this.command}"`));
|
|
293
|
+
}
|
|
294
|
+
const id = this.requestId++;
|
|
295
|
+
const payload = {
|
|
296
|
+
jsonrpc: '2.0',
|
|
297
|
+
id,
|
|
298
|
+
method,
|
|
299
|
+
...(params !== undefined ? { params } : {}),
|
|
300
|
+
};
|
|
301
|
+
const timer = setTimeout(() => {
|
|
302
|
+
this.pendingRequests.delete(id);
|
|
303
|
+
reject(new Error(`MCP stdio request timed out after ${timeoutMs}ms for method "${method}"`));
|
|
304
|
+
}, timeoutMs);
|
|
305
|
+
this.pendingRequests.set(id, { resolve, reject, timer });
|
|
306
|
+
const jsonStr = JSON.stringify(payload) + '\n';
|
|
307
|
+
this.process.stdin.write(jsonStr, 'utf-8', (err) => {
|
|
308
|
+
if (err) {
|
|
309
|
+
clearTimeout(timer);
|
|
310
|
+
this.pendingRequests.delete(id);
|
|
311
|
+
reject(new Error(`Failed to write to MCP process stdin: ${err.message}`));
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
async sendNotification(method, params) {
|
|
317
|
+
if (!this.isConnected() || !this.process?.stdin)
|
|
318
|
+
return;
|
|
319
|
+
const payload = {
|
|
320
|
+
jsonrpc: '2.0',
|
|
321
|
+
method,
|
|
322
|
+
...(params !== undefined ? { params } : {}),
|
|
323
|
+
};
|
|
324
|
+
const jsonStr = JSON.stringify(payload) + '\n';
|
|
325
|
+
this.process.stdin.write(jsonStr, 'utf-8');
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["transport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAazD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACjB,QAAQ,CAAS;IACjB,OAAO,CAAyB;IAChC,SAAS,GAAY,KAAK,CAAC;IAC3B,SAAS,GAAW,CAAC,CAAC;IACtB,qBAAqB,GAAiD,EAAE,CAAC;IAEjF,YAAY,QAAgB,EAAE,OAAO,GAA2B,EAAE;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG;YACX,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,qCAAqC;YAC/C,GAAG,OAAO;SACb,CAAC;IACN,CAA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AC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;CACL;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AA+ExB,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,MAAqB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAk8B/G"}
|
package/bin/src/server/server.js
CHANGED
|
@@ -13,6 +13,7 @@ import dotenv from 'dotenv';
|
|
|
13
13
|
import { TaskStateManager } from '../engine/agentState.js';
|
|
14
14
|
import { ApprovalManager } from '../engine/safety.js';
|
|
15
15
|
import { AgentExecutionLoop } from '../engine/agentEngine.js';
|
|
16
|
+
import { getMCPManager, MCPTelemetry } from '../mcp/index.js';
|
|
16
17
|
let activeAgentLoop = null;
|
|
17
18
|
const serverStateManager = new TaskStateManager(process.cwd());
|
|
18
19
|
const DEFAULT_PORT = 9120;
|
|
@@ -724,6 +725,212 @@ export function startDashboardServer(port = DEFAULT_PORT) {
|
|
|
724
725
|
});
|
|
725
726
|
return;
|
|
726
727
|
}
|
|
728
|
+
// ==========================================
|
|
729
|
+
// MCP ECOSYSTEM REST API
|
|
730
|
+
// ==========================================
|
|
731
|
+
// GET /api/mcp/servers - List all configured MCP servers
|
|
732
|
+
if (pathname === '/api/mcp/servers' && req.method === 'GET') {
|
|
733
|
+
try {
|
|
734
|
+
const manager = getMCPManager();
|
|
735
|
+
const servers = manager.listServers();
|
|
736
|
+
res.writeHead(200);
|
|
737
|
+
res.end(JSON.stringify({ success: true, servers }));
|
|
738
|
+
}
|
|
739
|
+
catch (err) {
|
|
740
|
+
res.writeHead(500);
|
|
741
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to list MCP servers' }));
|
|
742
|
+
}
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
// POST /api/mcp/servers - Add a new MCP server
|
|
746
|
+
if (pathname === '/api/mcp/servers' && req.method === 'POST') {
|
|
747
|
+
let body = '';
|
|
748
|
+
req.on('data', chunk => body += chunk);
|
|
749
|
+
req.on('end', async () => {
|
|
750
|
+
try {
|
|
751
|
+
const data = JSON.parse(body || '{}');
|
|
752
|
+
if (!data.name || !data.transport) {
|
|
753
|
+
res.writeHead(400);
|
|
754
|
+
res.end(JSON.stringify({ success: false, error: 'Name and transport (http|stdio) are required.' }));
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
const manager = getMCPManager();
|
|
758
|
+
const server = await manager.addServer({
|
|
759
|
+
name: data.name,
|
|
760
|
+
transport: data.transport,
|
|
761
|
+
endpoint: data.endpoint,
|
|
762
|
+
command: data.command,
|
|
763
|
+
args: data.args,
|
|
764
|
+
authType: data.authType || (data.token ? 'bearer' : 'none'),
|
|
765
|
+
authHeader: data.headerKey,
|
|
766
|
+
permissions: data.permissions,
|
|
767
|
+
}, data.token);
|
|
768
|
+
if (data.autoConnect) {
|
|
769
|
+
try {
|
|
770
|
+
await manager.connectServer(server.id);
|
|
771
|
+
}
|
|
772
|
+
catch {
|
|
773
|
+
// Log but return created server with its status
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
const updated = manager.getServer(server.id) || server;
|
|
777
|
+
res.writeHead(201);
|
|
778
|
+
res.end(JSON.stringify({ success: true, server: updated }));
|
|
779
|
+
}
|
|
780
|
+
catch (err) {
|
|
781
|
+
res.writeHead(400);
|
|
782
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to add MCP server' }));
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
// GET /api/mcp/health - Check health across all MCP servers
|
|
788
|
+
if (pathname === '/api/mcp/health' && req.method === 'GET') {
|
|
789
|
+
try {
|
|
790
|
+
const manager = getMCPManager();
|
|
791
|
+
const health = await manager.checkHealth();
|
|
792
|
+
res.writeHead(200);
|
|
793
|
+
res.end(JSON.stringify({ success: true, health }));
|
|
794
|
+
}
|
|
795
|
+
catch (err) {
|
|
796
|
+
res.writeHead(500);
|
|
797
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to check MCP health' }));
|
|
798
|
+
}
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
// GET /api/mcp/activity - Retrieve MCP activity audit trail
|
|
802
|
+
if (pathname === '/api/mcp/activity' && req.method === 'GET') {
|
|
803
|
+
try {
|
|
804
|
+
const limit = parseInt(parsedUrl.searchParams.get('limit') || '50', 10);
|
|
805
|
+
const activity = MCPTelemetry.loadActivity(limit);
|
|
806
|
+
res.writeHead(200);
|
|
807
|
+
res.end(JSON.stringify({ success: true, activity }));
|
|
808
|
+
}
|
|
809
|
+
catch (err) {
|
|
810
|
+
res.writeHead(500);
|
|
811
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to load MCP activity' }));
|
|
812
|
+
}
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
// Server-specific routes: /api/mcp/servers/:id...
|
|
816
|
+
const mcpServerMatch = pathname.match(/^\/api\/mcp\/servers\/([^/]+)(\/(.*))?$/);
|
|
817
|
+
if (mcpServerMatch) {
|
|
818
|
+
const serverId = decodeURIComponent(mcpServerMatch[1] || '');
|
|
819
|
+
const subPath = mcpServerMatch[3] || '';
|
|
820
|
+
const manager = getMCPManager();
|
|
821
|
+
// DELETE /api/mcp/servers/:id
|
|
822
|
+
if (req.method === 'DELETE' && !subPath) {
|
|
823
|
+
try {
|
|
824
|
+
const success = await manager.removeServer(serverId);
|
|
825
|
+
res.writeHead(200);
|
|
826
|
+
res.end(JSON.stringify({ success, message: success ? 'Server removed' : 'Server not found' }));
|
|
827
|
+
}
|
|
828
|
+
catch (err) {
|
|
829
|
+
res.writeHead(500);
|
|
830
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to remove server' }));
|
|
831
|
+
}
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
// GET /api/mcp/servers/:id
|
|
835
|
+
if (req.method === 'GET' && !subPath) {
|
|
836
|
+
const server = manager.getServer(serverId);
|
|
837
|
+
if (!server) {
|
|
838
|
+
res.writeHead(404);
|
|
839
|
+
res.end(JSON.stringify({ success: false, error: 'Server not found' }));
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
res.writeHead(200);
|
|
843
|
+
res.end(JSON.stringify({ success: true, server }));
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
// POST /api/mcp/servers/:id/connect
|
|
847
|
+
if (req.method === 'POST' && subPath === 'connect') {
|
|
848
|
+
try {
|
|
849
|
+
const server = await manager.connectServer(serverId);
|
|
850
|
+
res.writeHead(200);
|
|
851
|
+
res.end(JSON.stringify({ success: true, server }));
|
|
852
|
+
}
|
|
853
|
+
catch (err) {
|
|
854
|
+
res.writeHead(500);
|
|
855
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to connect server' }));
|
|
856
|
+
}
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
// POST /api/mcp/servers/:id/disconnect
|
|
860
|
+
if (req.method === 'POST' && subPath === 'disconnect') {
|
|
861
|
+
try {
|
|
862
|
+
const server = await manager.disconnectServer(serverId);
|
|
863
|
+
res.writeHead(200);
|
|
864
|
+
res.end(JSON.stringify({ success: true, server }));
|
|
865
|
+
}
|
|
866
|
+
catch (err) {
|
|
867
|
+
res.writeHead(500);
|
|
868
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to disconnect server' }));
|
|
869
|
+
}
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
// GET /api/mcp/servers/:id/tools
|
|
873
|
+
if (req.method === 'GET' && subPath === 'tools') {
|
|
874
|
+
const server = manager.getServer(serverId);
|
|
875
|
+
if (!server) {
|
|
876
|
+
res.writeHead(404);
|
|
877
|
+
res.end(JSON.stringify({ success: false, error: 'Server not found' }));
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
res.writeHead(200);
|
|
881
|
+
res.end(JSON.stringify({ success: true, tools: server.tools }));
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
// POST /api/mcp/servers/:id/tools/:toolName/toggle
|
|
885
|
+
const toggleMatch = subPath.match(/^tools\/([^/]+)\/toggle$/);
|
|
886
|
+
if (req.method === 'POST' && toggleMatch) {
|
|
887
|
+
const toolName = decodeURIComponent(toggleMatch[1] || '');
|
|
888
|
+
let body = '';
|
|
889
|
+
req.on('data', chunk => body += chunk);
|
|
890
|
+
req.on('end', () => {
|
|
891
|
+
try {
|
|
892
|
+
const data = JSON.parse(body || '{}');
|
|
893
|
+
const server = manager.toggleTool(serverId, toolName, data.enabled);
|
|
894
|
+
if (!server) {
|
|
895
|
+
res.writeHead(404);
|
|
896
|
+
res.end(JSON.stringify({ success: false, error: 'Server or tool not found' }));
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
res.writeHead(200);
|
|
900
|
+
res.end(JSON.stringify({ success: true, server }));
|
|
901
|
+
}
|
|
902
|
+
catch (err) {
|
|
903
|
+
res.writeHead(400);
|
|
904
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to toggle tool' }));
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
// POST /api/mcp/servers/:id/permissions
|
|
910
|
+
if (req.method === 'POST' && subPath === 'permissions') {
|
|
911
|
+
let body = '';
|
|
912
|
+
req.on('data', chunk => body += chunk);
|
|
913
|
+
req.on('end', () => {
|
|
914
|
+
try {
|
|
915
|
+
const data = JSON.parse(body || '{}');
|
|
916
|
+
const ok = manager.setServerPermissions(serverId, data.permissions || {});
|
|
917
|
+
if (!ok) {
|
|
918
|
+
res.writeHead(404);
|
|
919
|
+
res.end(JSON.stringify({ success: false, error: 'Server not found' }));
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
const server = manager.getServer(serverId);
|
|
923
|
+
res.writeHead(200);
|
|
924
|
+
res.end(JSON.stringify({ success: true, server }));
|
|
925
|
+
}
|
|
926
|
+
catch (err) {
|
|
927
|
+
res.writeHead(400);
|
|
928
|
+
res.end(JSON.stringify({ success: false, error: err.message || 'Failed to update permissions' }));
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
727
934
|
res.writeHead(404);
|
|
728
935
|
res.end(JSON.stringify({ error: 'API route not found' }));
|
|
729
936
|
return;
|