@yumdee/mcp-studio-core 0.1.0
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 +23 -0
- package/dist/__tests__/core.test.d.ts +2 -0
- package/dist/__tests__/core.test.d.ts.map +1 -0
- package/dist/__tests__/core.test.js +80 -0
- package/dist/__tests__/core.test.js.map +1 -0
- package/dist/__tests__/stdio.test.d.ts +2 -0
- package/dist/__tests__/stdio.test.d.ts.map +1 -0
- package/dist/__tests__/stdio.test.js +37 -0
- package/dist/__tests__/stdio.test.js.map +1 -0
- package/dist/client/index.d.ts +97 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +570 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +687 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +155 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/storage/index.d.ts +78 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +199 -0
- package/dist/storage/index.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Client Implementation
|
|
3
|
+
*
|
|
4
|
+
* Abstract interface and concrete implementations for MCP clients.
|
|
5
|
+
* Handles the JSON-RPC protocol, lifecycle, and session recording.
|
|
6
|
+
*/
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import { spawn } from "child_process";
|
|
10
|
+
import { randomUUID } from "crypto";
|
|
11
|
+
function resolveArgPath(arg) {
|
|
12
|
+
if (arg.endsWith(".js") || arg.endsWith(".ts") || arg.endsWith(".json")) {
|
|
13
|
+
if (fs.existsSync(arg))
|
|
14
|
+
return arg;
|
|
15
|
+
const cleaned = arg.replace(/^(\.\.[\/\\])+/, "");
|
|
16
|
+
if (fs.existsSync(cleaned))
|
|
17
|
+
return path.resolve(cleaned);
|
|
18
|
+
const fromCwd = path.resolve(process.cwd(), cleaned);
|
|
19
|
+
if (fs.existsSync(fromCwd))
|
|
20
|
+
return fromCwd;
|
|
21
|
+
// Check inside packages or root
|
|
22
|
+
const fromParent = path.resolve(process.cwd(), "..", cleaned);
|
|
23
|
+
if (fs.existsSync(fromParent))
|
|
24
|
+
return fromParent;
|
|
25
|
+
}
|
|
26
|
+
return arg;
|
|
27
|
+
}
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Stdio Implementation
|
|
30
|
+
// ============================================================================
|
|
31
|
+
export class StdioMcpClient {
|
|
32
|
+
constructor(command, args = [], env) {
|
|
33
|
+
this.connected = false;
|
|
34
|
+
this.nextId = 1;
|
|
35
|
+
this.startTimeMs = 0;
|
|
36
|
+
this.sessionId = randomUUID();
|
|
37
|
+
this.startedAt = new Date().toISOString();
|
|
38
|
+
this.events = [];
|
|
39
|
+
this.serverInfo = {
|
|
40
|
+
name: "unknown",
|
|
41
|
+
version: "0.0.0",
|
|
42
|
+
transport: "stdio",
|
|
43
|
+
};
|
|
44
|
+
this.capabilities = {};
|
|
45
|
+
this.tools = [];
|
|
46
|
+
this.resources = [];
|
|
47
|
+
this.prompts = [];
|
|
48
|
+
this.notificationListeners = new Set();
|
|
49
|
+
this.pendingRequests = new Map();
|
|
50
|
+
this.buffer = "";
|
|
51
|
+
this.command = command;
|
|
52
|
+
this.args = args;
|
|
53
|
+
this.env = env;
|
|
54
|
+
}
|
|
55
|
+
async connect() {
|
|
56
|
+
if (this.connected)
|
|
57
|
+
return this.serverInfo;
|
|
58
|
+
this.sessionId = randomUUID();
|
|
59
|
+
this.startedAt = new Date().toISOString();
|
|
60
|
+
this.startTimeMs = Date.now();
|
|
61
|
+
this.events = [];
|
|
62
|
+
this.endedAt = undefined;
|
|
63
|
+
// Split command if args were embedded
|
|
64
|
+
let cmd = this.command;
|
|
65
|
+
let cmdArgs = [...this.args];
|
|
66
|
+
if (cmdArgs.length === 0 && cmd.includes(" ")) {
|
|
67
|
+
const parts = cmd.split(" ");
|
|
68
|
+
cmd = parts[0];
|
|
69
|
+
cmdArgs = parts.slice(1);
|
|
70
|
+
}
|
|
71
|
+
cmdArgs = cmdArgs.map(resolveArgPath);
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
try {
|
|
74
|
+
let lastStderrText = "";
|
|
75
|
+
const isWindows = process.platform === "win32";
|
|
76
|
+
this.process = spawn(cmd, cmdArgs, {
|
|
77
|
+
env: { ...process.env, ...this.env },
|
|
78
|
+
shell: isWindows,
|
|
79
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
80
|
+
});
|
|
81
|
+
this.process.stdout?.on("data", (data) => {
|
|
82
|
+
this.handleStdout(data.toString());
|
|
83
|
+
});
|
|
84
|
+
this.process.stderr?.on("data", (data) => {
|
|
85
|
+
const text = data.toString().trim();
|
|
86
|
+
if (text) {
|
|
87
|
+
lastStderrText = text;
|
|
88
|
+
const errEvent = {
|
|
89
|
+
type: "error",
|
|
90
|
+
timestamp: new Date().toISOString(),
|
|
91
|
+
code: "STDERR",
|
|
92
|
+
message: text,
|
|
93
|
+
};
|
|
94
|
+
this.events.push(errEvent);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
this.process.on("error", (err) => {
|
|
98
|
+
const errEvent = {
|
|
99
|
+
type: "error",
|
|
100
|
+
timestamp: new Date().toISOString(),
|
|
101
|
+
code: "PROCESS_ERROR",
|
|
102
|
+
message: err.message,
|
|
103
|
+
};
|
|
104
|
+
this.events.push(errEvent);
|
|
105
|
+
if (!this.connected) {
|
|
106
|
+
reject(err);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this.process.on("close", (code) => {
|
|
110
|
+
this.connected = false;
|
|
111
|
+
this.endedAt = new Date().toISOString();
|
|
112
|
+
const detail = lastStderrText ? `: ${lastStderrText}` : "";
|
|
113
|
+
for (const [id, req] of this.pendingRequests.entries()) {
|
|
114
|
+
req.reject(new Error(`Process terminated with code ${code}${detail}`));
|
|
115
|
+
this.pendingRequests.delete(id);
|
|
116
|
+
}
|
|
117
|
+
if (!this.connected) {
|
|
118
|
+
reject(new Error(`Process terminated with code ${code}${detail}`));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
// Perform handshake
|
|
122
|
+
this.performHandshake()
|
|
123
|
+
.then((info) => {
|
|
124
|
+
this.connected = true;
|
|
125
|
+
resolve(info);
|
|
126
|
+
})
|
|
127
|
+
.catch((err) => {
|
|
128
|
+
this.disconnect().finally(() => reject(err));
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
reject(err);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async performHandshake() {
|
|
137
|
+
const handshakeResult = await this.call("initialize", {
|
|
138
|
+
protocolVersion: "2024-11-05",
|
|
139
|
+
capabilities: {},
|
|
140
|
+
clientInfo: {
|
|
141
|
+
name: "yumdee-mcp-studio",
|
|
142
|
+
version: "0.1.0",
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
const sInfo = handshakeResult?.serverInfo || { name: "unknown", version: "0.1.0" };
|
|
146
|
+
this.serverInfo = {
|
|
147
|
+
name: sInfo.name,
|
|
148
|
+
version: sInfo.version,
|
|
149
|
+
transport: "stdio",
|
|
150
|
+
command: `${this.command} ${this.args.join(" ")}`.trim(),
|
|
151
|
+
};
|
|
152
|
+
this.capabilities = handshakeResult?.capabilities || {};
|
|
153
|
+
// Send initialized notification as per MCP spec
|
|
154
|
+
await this.notify("notifications/initialized", {});
|
|
155
|
+
// Introspect tools, resources, prompts
|
|
156
|
+
try {
|
|
157
|
+
const toolsRes = await this.call("tools/list", {});
|
|
158
|
+
if (toolsRes && Array.isArray(toolsRes.tools)) {
|
|
159
|
+
this.tools = toolsRes.tools;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// Server may not support tools/list
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
const resRes = await this.call("resources/list", {});
|
|
167
|
+
if (resRes && Array.isArray(resRes.resources)) {
|
|
168
|
+
this.resources = resRes.resources;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// Server may not support resources/list
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const promptsRes = await this.call("prompts/list", {});
|
|
176
|
+
if (promptsRes && Array.isArray(promptsRes.prompts)) {
|
|
177
|
+
this.prompts = promptsRes.prompts;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// Server may not support prompts/list
|
|
182
|
+
}
|
|
183
|
+
return this.serverInfo;
|
|
184
|
+
}
|
|
185
|
+
handleStdout(data) {
|
|
186
|
+
this.buffer += data;
|
|
187
|
+
const lines = this.buffer.split("\n");
|
|
188
|
+
this.buffer = lines.pop() || "";
|
|
189
|
+
for (const line of lines) {
|
|
190
|
+
const trimmed = line.trim();
|
|
191
|
+
if (!trimmed)
|
|
192
|
+
continue;
|
|
193
|
+
try {
|
|
194
|
+
const msg = JSON.parse(trimmed);
|
|
195
|
+
const receivedAtMs = Date.now() - this.startTimeMs;
|
|
196
|
+
// Is it a response?
|
|
197
|
+
if (msg.id !== undefined && (msg.result !== undefined || msg.error !== undefined)) {
|
|
198
|
+
const req = this.pendingRequests.get(Number(msg.id));
|
|
199
|
+
const sentAtMs = req ? req.sentAtMs : receivedAtMs;
|
|
200
|
+
const latencyMs = Math.max(0, receivedAtMs - sentAtMs);
|
|
201
|
+
const responseEvent = {
|
|
202
|
+
type: "response",
|
|
203
|
+
timestamp: new Date().toISOString(),
|
|
204
|
+
id: Number(msg.id),
|
|
205
|
+
result: msg.result,
|
|
206
|
+
error: msg.error,
|
|
207
|
+
receivedAtMs,
|
|
208
|
+
latencyMs,
|
|
209
|
+
};
|
|
210
|
+
this.events.push(responseEvent);
|
|
211
|
+
if (req) {
|
|
212
|
+
this.pendingRequests.delete(Number(msg.id));
|
|
213
|
+
if (msg.error) {
|
|
214
|
+
req.reject(new Error(msg.error.message || `RPC Error ${msg.error.code}`));
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
req.resolve(msg.result);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else if (msg.method) {
|
|
222
|
+
// Server-to-client notification or request
|
|
223
|
+
const notifEvent = {
|
|
224
|
+
type: "notification",
|
|
225
|
+
timestamp: new Date().toISOString(),
|
|
226
|
+
method: msg.method,
|
|
227
|
+
params: msg.params,
|
|
228
|
+
sentAtMs: receivedAtMs,
|
|
229
|
+
direction: "server->client",
|
|
230
|
+
};
|
|
231
|
+
this.events.push(notifEvent);
|
|
232
|
+
for (const listener of this.notificationListeners) {
|
|
233
|
+
try {
|
|
234
|
+
listener(msg.method, msg.params);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
console.error("Error in notification listener:", err);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
const errEvent = {
|
|
244
|
+
type: "error",
|
|
245
|
+
timestamp: new Date().toISOString(),
|
|
246
|
+
code: "PARSE_ERROR",
|
|
247
|
+
message: `Failed to parse message: ${trimmed}`,
|
|
248
|
+
payload: { raw: trimmed },
|
|
249
|
+
};
|
|
250
|
+
this.events.push(errEvent);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async disconnect() {
|
|
255
|
+
this.connected = false;
|
|
256
|
+
this.endedAt = new Date().toISOString();
|
|
257
|
+
if (this.process) {
|
|
258
|
+
this.process.kill();
|
|
259
|
+
this.process = undefined;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
isConnected() {
|
|
263
|
+
return this.connected;
|
|
264
|
+
}
|
|
265
|
+
call(method, params) {
|
|
266
|
+
return new Promise((resolve, reject) => {
|
|
267
|
+
if (!this.process || !this.process.stdin) {
|
|
268
|
+
return reject(new Error("Client is not running"));
|
|
269
|
+
}
|
|
270
|
+
const id = this.nextId++;
|
|
271
|
+
const sentAtMs = Date.now() - this.startTimeMs;
|
|
272
|
+
const reqEvent = {
|
|
273
|
+
type: "request",
|
|
274
|
+
timestamp: new Date().toISOString(),
|
|
275
|
+
id,
|
|
276
|
+
method,
|
|
277
|
+
params,
|
|
278
|
+
sentAtMs,
|
|
279
|
+
};
|
|
280
|
+
this.events.push(reqEvent);
|
|
281
|
+
this.pendingRequests.set(id, {
|
|
282
|
+
sentAtMs,
|
|
283
|
+
method,
|
|
284
|
+
resolve,
|
|
285
|
+
reject,
|
|
286
|
+
});
|
|
287
|
+
const message = {
|
|
288
|
+
jsonrpc: "2.0",
|
|
289
|
+
id,
|
|
290
|
+
method,
|
|
291
|
+
params: params ?? {},
|
|
292
|
+
};
|
|
293
|
+
try {
|
|
294
|
+
this.process.stdin.write(JSON.stringify(message) + "\n");
|
|
295
|
+
}
|
|
296
|
+
catch (err) {
|
|
297
|
+
this.pendingRequests.delete(id);
|
|
298
|
+
reject(err);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async notify(method, params) {
|
|
303
|
+
if (!this.process || !this.process.stdin) {
|
|
304
|
+
throw new Error("Client is not running");
|
|
305
|
+
}
|
|
306
|
+
const sentAtMs = Date.now() - this.startTimeMs;
|
|
307
|
+
const notifEvent = {
|
|
308
|
+
type: "notification",
|
|
309
|
+
timestamp: new Date().toISOString(),
|
|
310
|
+
method,
|
|
311
|
+
params,
|
|
312
|
+
sentAtMs,
|
|
313
|
+
direction: "client->server",
|
|
314
|
+
};
|
|
315
|
+
this.events.push(notifEvent);
|
|
316
|
+
const message = {
|
|
317
|
+
jsonrpc: "2.0",
|
|
318
|
+
method,
|
|
319
|
+
params: params ?? {},
|
|
320
|
+
};
|
|
321
|
+
this.process.stdin.write(JSON.stringify(message) + "\n");
|
|
322
|
+
}
|
|
323
|
+
onNotification(callback) {
|
|
324
|
+
this.notificationListeners.add(callback);
|
|
325
|
+
return () => {
|
|
326
|
+
this.notificationListeners.delete(callback);
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
getServerInfo() {
|
|
330
|
+
return this.serverInfo;
|
|
331
|
+
}
|
|
332
|
+
getCapabilities() {
|
|
333
|
+
return this.capabilities;
|
|
334
|
+
}
|
|
335
|
+
getTools() {
|
|
336
|
+
return this.tools;
|
|
337
|
+
}
|
|
338
|
+
getResources() {
|
|
339
|
+
return this.resources;
|
|
340
|
+
}
|
|
341
|
+
getPrompts() {
|
|
342
|
+
return this.prompts;
|
|
343
|
+
}
|
|
344
|
+
getSession() {
|
|
345
|
+
return {
|
|
346
|
+
id: this.sessionId,
|
|
347
|
+
serverInfo: this.serverInfo,
|
|
348
|
+
clientInfo: {
|
|
349
|
+
name: "yumdee-mcp-studio",
|
|
350
|
+
version: "0.1.0",
|
|
351
|
+
},
|
|
352
|
+
startedAt: this.startedAt,
|
|
353
|
+
endedAt: this.endedAt,
|
|
354
|
+
events: [...this.events],
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
getEvents() {
|
|
358
|
+
return [...this.events];
|
|
359
|
+
}
|
|
360
|
+
clearSession() {
|
|
361
|
+
this.sessionId = randomUUID();
|
|
362
|
+
this.startedAt = new Date().toISOString();
|
|
363
|
+
this.endedAt = undefined;
|
|
364
|
+
this.events = [];
|
|
365
|
+
this.startTimeMs = Date.now();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// ============================================================================
|
|
369
|
+
// HTTP / SSE Implementation
|
|
370
|
+
// ============================================================================
|
|
371
|
+
export class HttpMcpClient {
|
|
372
|
+
constructor(url, headers, transport = "http") {
|
|
373
|
+
this.connected = false;
|
|
374
|
+
this.nextId = 1;
|
|
375
|
+
this.startTimeMs = 0;
|
|
376
|
+
this.sessionId = randomUUID();
|
|
377
|
+
this.startedAt = new Date().toISOString();
|
|
378
|
+
this.events = [];
|
|
379
|
+
this.capabilities = {};
|
|
380
|
+
this.tools = [];
|
|
381
|
+
this.resources = [];
|
|
382
|
+
this.prompts = [];
|
|
383
|
+
this.notificationListeners = new Set();
|
|
384
|
+
this.url = url;
|
|
385
|
+
this.headers = headers || {};
|
|
386
|
+
this.serverInfo = {
|
|
387
|
+
name: "remote-server",
|
|
388
|
+
version: "0.1.0",
|
|
389
|
+
transport,
|
|
390
|
+
endpoint: url,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
async connect() {
|
|
394
|
+
this.sessionId = randomUUID();
|
|
395
|
+
this.startedAt = new Date().toISOString();
|
|
396
|
+
this.startTimeMs = Date.now();
|
|
397
|
+
this.events = [];
|
|
398
|
+
this.connected = true;
|
|
399
|
+
try {
|
|
400
|
+
const res = await this.call("initialize", {
|
|
401
|
+
protocolVersion: "2024-11-05",
|
|
402
|
+
capabilities: {},
|
|
403
|
+
clientInfo: {
|
|
404
|
+
name: "yumdee-mcp-studio",
|
|
405
|
+
version: "0.1.0",
|
|
406
|
+
},
|
|
407
|
+
});
|
|
408
|
+
if (res?.serverInfo) {
|
|
409
|
+
this.serverInfo = {
|
|
410
|
+
name: res.serverInfo.name,
|
|
411
|
+
version: res.serverInfo.version,
|
|
412
|
+
transport: this.serverInfo.transport,
|
|
413
|
+
endpoint: this.url,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
this.capabilities = res?.capabilities || {};
|
|
417
|
+
await this.notify("notifications/initialized", {});
|
|
418
|
+
try {
|
|
419
|
+
const toolsRes = await this.call("tools/list", {});
|
|
420
|
+
if (toolsRes?.tools)
|
|
421
|
+
this.tools = toolsRes.tools;
|
|
422
|
+
}
|
|
423
|
+
catch { }
|
|
424
|
+
return this.serverInfo;
|
|
425
|
+
}
|
|
426
|
+
catch (err) {
|
|
427
|
+
this.connected = false;
|
|
428
|
+
throw err;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
async disconnect() {
|
|
432
|
+
this.connected = false;
|
|
433
|
+
this.endedAt = new Date().toISOString();
|
|
434
|
+
}
|
|
435
|
+
isConnected() {
|
|
436
|
+
return this.connected;
|
|
437
|
+
}
|
|
438
|
+
async call(method, params) {
|
|
439
|
+
const id = this.nextId++;
|
|
440
|
+
const sentAtMs = Date.now() - this.startTimeMs;
|
|
441
|
+
this.events.push({
|
|
442
|
+
type: "request",
|
|
443
|
+
timestamp: new Date().toISOString(),
|
|
444
|
+
id,
|
|
445
|
+
method,
|
|
446
|
+
params,
|
|
447
|
+
sentAtMs,
|
|
448
|
+
});
|
|
449
|
+
const payload = {
|
|
450
|
+
jsonrpc: "2.0",
|
|
451
|
+
id,
|
|
452
|
+
method,
|
|
453
|
+
params: params ?? {},
|
|
454
|
+
};
|
|
455
|
+
const res = await fetch(this.url, {
|
|
456
|
+
method: "POST",
|
|
457
|
+
headers: {
|
|
458
|
+
"Content-Type": "application/json",
|
|
459
|
+
...this.headers,
|
|
460
|
+
},
|
|
461
|
+
body: JSON.stringify(payload),
|
|
462
|
+
});
|
|
463
|
+
const receivedAtMs = Date.now() - this.startTimeMs;
|
|
464
|
+
const latencyMs = Math.max(0, receivedAtMs - sentAtMs);
|
|
465
|
+
if (!res.ok) {
|
|
466
|
+
const errEvent = {
|
|
467
|
+
type: "error",
|
|
468
|
+
timestamp: new Date().toISOString(),
|
|
469
|
+
code: `HTTP_${res.status}`,
|
|
470
|
+
message: `HTTP request failed: ${res.statusText}`,
|
|
471
|
+
};
|
|
472
|
+
this.events.push(errEvent);
|
|
473
|
+
throw new Error(`HTTP error ${res.status}: ${res.statusText}`);
|
|
474
|
+
}
|
|
475
|
+
const data = await res.json();
|
|
476
|
+
this.events.push({
|
|
477
|
+
type: "response",
|
|
478
|
+
timestamp: new Date().toISOString(),
|
|
479
|
+
id,
|
|
480
|
+
result: data.result,
|
|
481
|
+
error: data.error,
|
|
482
|
+
receivedAtMs,
|
|
483
|
+
latencyMs,
|
|
484
|
+
});
|
|
485
|
+
if (data.error) {
|
|
486
|
+
throw new Error(data.error.message || `RPC Error ${data.error.code}`);
|
|
487
|
+
}
|
|
488
|
+
return data.result;
|
|
489
|
+
}
|
|
490
|
+
async notify(method, params) {
|
|
491
|
+
const sentAtMs = Date.now() - this.startTimeMs;
|
|
492
|
+
this.events.push({
|
|
493
|
+
type: "notification",
|
|
494
|
+
timestamp: new Date().toISOString(),
|
|
495
|
+
method,
|
|
496
|
+
params,
|
|
497
|
+
sentAtMs,
|
|
498
|
+
direction: "client->server",
|
|
499
|
+
});
|
|
500
|
+
await fetch(this.url, {
|
|
501
|
+
method: "POST",
|
|
502
|
+
headers: {
|
|
503
|
+
"Content-Type": "application/json",
|
|
504
|
+
...this.headers,
|
|
505
|
+
},
|
|
506
|
+
body: JSON.stringify({
|
|
507
|
+
jsonrpc: "2.0",
|
|
508
|
+
method,
|
|
509
|
+
params: params ?? {},
|
|
510
|
+
}),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
onNotification(callback) {
|
|
514
|
+
this.notificationListeners.add(callback);
|
|
515
|
+
return () => {
|
|
516
|
+
this.notificationListeners.delete(callback);
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
getServerInfo() {
|
|
520
|
+
return this.serverInfo;
|
|
521
|
+
}
|
|
522
|
+
getCapabilities() {
|
|
523
|
+
return this.capabilities;
|
|
524
|
+
}
|
|
525
|
+
getTools() {
|
|
526
|
+
return this.tools;
|
|
527
|
+
}
|
|
528
|
+
getResources() {
|
|
529
|
+
return this.resources;
|
|
530
|
+
}
|
|
531
|
+
getPrompts() {
|
|
532
|
+
return this.prompts;
|
|
533
|
+
}
|
|
534
|
+
getSession() {
|
|
535
|
+
return {
|
|
536
|
+
id: this.sessionId,
|
|
537
|
+
serverInfo: this.serverInfo,
|
|
538
|
+
clientInfo: {
|
|
539
|
+
name: "yumdee-mcp-studio",
|
|
540
|
+
version: "0.1.0",
|
|
541
|
+
},
|
|
542
|
+
startedAt: this.startedAt,
|
|
543
|
+
endedAt: this.endedAt,
|
|
544
|
+
events: [...this.events],
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
getEvents() {
|
|
548
|
+
return [...this.events];
|
|
549
|
+
}
|
|
550
|
+
clearSession() {
|
|
551
|
+
this.sessionId = randomUUID();
|
|
552
|
+
this.startedAt = new Date().toISOString();
|
|
553
|
+
this.endedAt = undefined;
|
|
554
|
+
this.events = [];
|
|
555
|
+
this.startTimeMs = Date.now();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
// ============================================================================
|
|
559
|
+
// Factory Functions
|
|
560
|
+
// ============================================================================
|
|
561
|
+
export function createStdioClient(command, args, env) {
|
|
562
|
+
return new StdioMcpClient(command, args, env);
|
|
563
|
+
}
|
|
564
|
+
export function createSseClient(url, headers) {
|
|
565
|
+
return new HttpMcpClient(url, headers, "sse");
|
|
566
|
+
}
|
|
567
|
+
export function createHttpClient(url, headers) {
|
|
568
|
+
return new HttpMcpClient(url, headers, "http");
|
|
569
|
+
}
|
|
570
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxE,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QACnC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO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gBACV,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,OAAO;aACjB;YACD,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;SACzB,CAAC;IACJ,CAAC;IAED,SAAS;QACP,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC;CACF;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAM,UAAU,iBAAiB,CAC/B,OAAe,EACf,IAAe,EACf,GAA4B;IAE5B,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,OAAgC;IAEhC,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,OAAgC;IAEhC,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./schemas/index.js";
|
|
2
|
+
export * from "./client/index.js";
|
|
3
|
+
export * from "./storage/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* yumdee-Mcp-studio core package
|
|
6
|
+
*
|
|
7
|
+
* Provides:
|
|
8
|
+
* - Session recording schema (McpSession, McpEvent)
|
|
9
|
+
* - MCP client abstraction (McpClient interface)
|
|
10
|
+
* - Storage abstraction (SessionStorage interface)
|
|
11
|
+
*
|
|
12
|
+
* Used by: inspector, agent-kit, bench
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC;;;;;;;;;GASG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Re-export all public APIs from core
|
|
2
|
+
export * from "./schemas/index.js";
|
|
3
|
+
export * from "./client/index.js";
|
|
4
|
+
export * from "./storage/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* yumdee-Mcp-studio core package
|
|
7
|
+
*
|
|
8
|
+
* Provides:
|
|
9
|
+
* - Session recording schema (McpSession, McpEvent)
|
|
10
|
+
* - MCP client abstraction (McpClient interface)
|
|
11
|
+
* - Storage abstraction (SessionStorage interface)
|
|
12
|
+
*
|
|
13
|
+
* Used by: inspector, agent-kit, bench
|
|
14
|
+
*/
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC;;;;;;;;;GASG"}
|