@modelcontextprotocol/sdk 1.1.0 → 1.2.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/dist/cjs/cli.d.ts.map +1 -0
- package/dist/cjs/cli.js +134 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/client/index.d.ts.map +1 -0
- package/dist/cjs/client/index.js +210 -0
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/client/sse.d.ts.map +1 -0
- package/dist/cjs/client/sse.js +99 -0
- package/dist/cjs/client/sse.js.map +1 -0
- package/dist/cjs/client/stdio.d.ts.map +1 -0
- package/dist/cjs/client/stdio.js +156 -0
- package/dist/cjs/client/stdio.js.map +1 -0
- package/dist/cjs/client/websocket.d.ts.map +1 -0
- package/dist/cjs/client/websocket.js +65 -0
- package/dist/cjs/client/websocket.js.map +1 -0
- package/dist/cjs/inMemory.d.ts.map +1 -0
- package/dist/cjs/inMemory.js +51 -0
- package/dist/cjs/inMemory.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/{server → cjs/server}/index.d.ts +5 -0
- package/dist/cjs/server/index.d.ts.map +1 -0
- package/dist/cjs/server/index.js +188 -0
- package/dist/cjs/server/index.js.map +1 -0
- package/dist/cjs/server/sse.d.ts.map +1 -0
- package/dist/cjs/server/sse.js +123 -0
- package/dist/cjs/server/sse.js.map +1 -0
- package/dist/cjs/server/stdio.d.ts.map +1 -0
- package/dist/cjs/server/stdio.js +85 -0
- package/dist/cjs/server/stdio.js.map +1 -0
- package/dist/cjs/shared/protocol.d.ts.map +1 -0
- package/dist/cjs/shared/protocol.js +301 -0
- package/dist/cjs/shared/protocol.js.map +1 -0
- package/dist/cjs/shared/stdio.d.ts.map +1 -0
- package/dist/cjs/shared/stdio.js +37 -0
- package/dist/cjs/shared/stdio.js.map +1 -0
- package/dist/cjs/shared/transport.d.ts.map +1 -0
- package/dist/cjs/shared/transport.js +3 -0
- package/dist/{shared → cjs/shared}/transport.js.map +1 -1
- package/dist/{types.d.ts → cjs/types.d.ts} +84 -78
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +1002 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/cli.d.ts +2 -0
- package/dist/esm/cli.d.ts.map +1 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/client/index.d.ts +773 -0
- package/dist/esm/client/index.d.ts.map +1 -0
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/client/sse.d.ts +27 -0
- package/dist/esm/client/sse.d.ts.map +1 -0
- package/dist/esm/client/sse.js.map +1 -0
- package/dist/esm/client/stdio.d.ts +63 -0
- package/dist/esm/client/stdio.d.ts.map +1 -0
- package/dist/esm/client/stdio.js.map +1 -0
- package/dist/esm/client/websocket.d.ts +17 -0
- package/dist/esm/client/websocket.d.ts.map +1 -0
- package/dist/esm/client/websocket.js.map +1 -0
- package/dist/esm/inMemory.d.ts +20 -0
- package/dist/esm/inMemory.d.ts.map +1 -0
- package/dist/esm/inMemory.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/server/index.d.ts +117 -0
- package/dist/esm/server/index.d.ts.map +1 -0
- package/dist/{server → esm/server}/index.js +2 -0
- package/dist/esm/server/index.js.map +1 -0
- package/dist/esm/server/sse.d.ts +46 -0
- package/dist/esm/server/sse.d.ts.map +1 -0
- package/dist/esm/server/sse.js.map +1 -0
- package/dist/esm/server/stdio.d.ts +28 -0
- package/dist/esm/server/stdio.d.ts.map +1 -0
- package/dist/{server → esm/server}/stdio.js +9 -0
- package/dist/esm/server/stdio.js.map +1 -0
- package/dist/esm/shared/protocol.d.ts +157 -0
- package/dist/esm/shared/protocol.d.ts.map +1 -0
- package/dist/esm/shared/protocol.js.map +1 -0
- package/dist/esm/shared/stdio.d.ts +13 -0
- package/dist/esm/shared/stdio.d.ts.map +1 -0
- package/dist/esm/shared/stdio.js.map +1 -0
- package/dist/esm/shared/transport.d.ts +39 -0
- package/dist/esm/shared/transport.d.ts.map +1 -0
- package/dist/esm/shared/transport.js.map +1 -0
- package/dist/esm/types.d.ts +26431 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +10 -5
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/sse.d.ts.map +0 -1
- package/dist/client/sse.js.map +0 -1
- package/dist/client/stdio.d.ts.map +0 -1
- package/dist/client/stdio.js.map +0 -1
- package/dist/client/websocket.d.ts.map +0 -1
- package/dist/client/websocket.js.map +0 -1
- package/dist/inMemory.d.ts.map +0 -1
- package/dist/inMemory.js.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/sse.d.ts.map +0 -1
- package/dist/server/sse.js.map +0 -1
- package/dist/server/stdio.d.ts.map +0 -1
- package/dist/server/stdio.js.map +0 -1
- package/dist/shared/protocol.d.ts.map +0 -1
- package/dist/shared/protocol.js.map +0 -1
- package/dist/shared/stdio.d.ts.map +0 -1
- package/dist/shared/stdio.js.map +0 -1
- package/dist/shared/transport.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{cli.d.ts → cjs/cli.d.ts} +0 -0
- /package/dist/{client → cjs/client}/index.d.ts +0 -0
- /package/dist/{client → cjs/client}/sse.d.ts +0 -0
- /package/dist/{client → cjs/client}/stdio.d.ts +0 -0
- /package/dist/{client → cjs/client}/websocket.d.ts +0 -0
- /package/dist/{inMemory.d.ts → cjs/inMemory.d.ts} +0 -0
- /package/dist/{server → cjs/server}/sse.d.ts +0 -0
- /package/dist/{server → cjs/server}/stdio.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/protocol.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/stdio.d.ts +0 -0
- /package/dist/{shared → cjs/shared}/transport.d.ts +0 -0
- /package/dist/{cli.js → esm/cli.js} +0 -0
- /package/dist/{client → esm/client}/index.js +0 -0
- /package/dist/{client → esm/client}/sse.js +0 -0
- /package/dist/{client → esm/client}/stdio.js +0 -0
- /package/dist/{client → esm/client}/websocket.js +0 -0
- /package/dist/{inMemory.js → esm/inMemory.js} +0 -0
- /package/dist/{server → esm/server}/sse.js +0 -0
- /package/dist/{shared → esm/shared}/protocol.js +0 -0
- /package/dist/{shared → esm/shared}/stdio.js +0 -0
- /package/dist/{shared → esm/shared}/transport.js +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Protocol = exports.DEFAULT_REQUEST_TIMEOUT_MSEC = void 0;
|
|
4
|
+
const types_js_1 = require("../types.js");
|
|
5
|
+
/**
|
|
6
|
+
* The default request timeout, in miliseconds.
|
|
7
|
+
*/
|
|
8
|
+
exports.DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
9
|
+
/**
|
|
10
|
+
* Implements MCP protocol framing on top of a pluggable transport, including
|
|
11
|
+
* features like request/response linking, notifications, and progress.
|
|
12
|
+
*/
|
|
13
|
+
class Protocol {
|
|
14
|
+
constructor(_options) {
|
|
15
|
+
this._options = _options;
|
|
16
|
+
this._requestMessageId = 0;
|
|
17
|
+
this._requestHandlers = new Map();
|
|
18
|
+
this._requestHandlerAbortControllers = new Map();
|
|
19
|
+
this._notificationHandlers = new Map();
|
|
20
|
+
this._responseHandlers = new Map();
|
|
21
|
+
this._progressHandlers = new Map();
|
|
22
|
+
this.setNotificationHandler(types_js_1.CancelledNotificationSchema, (notification) => {
|
|
23
|
+
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
24
|
+
controller === null || controller === void 0 ? void 0 : controller.abort(notification.params.reason);
|
|
25
|
+
});
|
|
26
|
+
this.setNotificationHandler(types_js_1.ProgressNotificationSchema, (notification) => {
|
|
27
|
+
this._onprogress(notification);
|
|
28
|
+
});
|
|
29
|
+
this.setRequestHandler(types_js_1.PingRequestSchema,
|
|
30
|
+
// Automatic pong by default.
|
|
31
|
+
(_request) => ({}));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Attaches to the given transport, starts it, and starts listening for messages.
|
|
35
|
+
*
|
|
36
|
+
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
37
|
+
*/
|
|
38
|
+
async connect(transport) {
|
|
39
|
+
this._transport = transport;
|
|
40
|
+
this._transport.onclose = () => {
|
|
41
|
+
this._onclose();
|
|
42
|
+
};
|
|
43
|
+
this._transport.onerror = (error) => {
|
|
44
|
+
this._onerror(error);
|
|
45
|
+
};
|
|
46
|
+
this._transport.onmessage = (message) => {
|
|
47
|
+
if (!("method" in message)) {
|
|
48
|
+
this._onresponse(message);
|
|
49
|
+
}
|
|
50
|
+
else if ("id" in message) {
|
|
51
|
+
this._onrequest(message);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this._onnotification(message);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
await this._transport.start();
|
|
58
|
+
}
|
|
59
|
+
_onclose() {
|
|
60
|
+
var _a;
|
|
61
|
+
const responseHandlers = this._responseHandlers;
|
|
62
|
+
this._responseHandlers = new Map();
|
|
63
|
+
this._progressHandlers.clear();
|
|
64
|
+
this._transport = undefined;
|
|
65
|
+
(_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
66
|
+
const error = new types_js_1.McpError(types_js_1.ErrorCode.ConnectionClosed, "Connection closed");
|
|
67
|
+
for (const handler of responseHandlers.values()) {
|
|
68
|
+
handler(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_onerror(error) {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
74
|
+
}
|
|
75
|
+
_onnotification(notification) {
|
|
76
|
+
var _a;
|
|
77
|
+
const handler = (_a = this._notificationHandlers.get(notification.method)) !== null && _a !== void 0 ? _a : this.fallbackNotificationHandler;
|
|
78
|
+
// Ignore notifications not being subscribed to.
|
|
79
|
+
if (handler === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
83
|
+
Promise.resolve()
|
|
84
|
+
.then(() => handler(notification))
|
|
85
|
+
.catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));
|
|
86
|
+
}
|
|
87
|
+
_onrequest(request) {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
const handler = (_a = this._requestHandlers.get(request.method)) !== null && _a !== void 0 ? _a : this.fallbackRequestHandler;
|
|
90
|
+
if (handler === undefined) {
|
|
91
|
+
(_b = this._transport) === null || _b === void 0 ? void 0 : _b.send({
|
|
92
|
+
jsonrpc: "2.0",
|
|
93
|
+
id: request.id,
|
|
94
|
+
error: {
|
|
95
|
+
code: types_js_1.ErrorCode.MethodNotFound,
|
|
96
|
+
message: "Method not found",
|
|
97
|
+
},
|
|
98
|
+
}).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const abortController = new AbortController();
|
|
102
|
+
this._requestHandlerAbortControllers.set(request.id, abortController);
|
|
103
|
+
// Starting with Promise.resolve() puts any synchronous errors into the monad as well.
|
|
104
|
+
Promise.resolve()
|
|
105
|
+
.then(() => handler(request, { signal: abortController.signal }))
|
|
106
|
+
.then((result) => {
|
|
107
|
+
var _a;
|
|
108
|
+
if (abortController.signal.aborted) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
112
|
+
result,
|
|
113
|
+
jsonrpc: "2.0",
|
|
114
|
+
id: request.id,
|
|
115
|
+
});
|
|
116
|
+
}, (error) => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
if (abortController.signal.aborted) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
return (_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
122
|
+
jsonrpc: "2.0",
|
|
123
|
+
id: request.id,
|
|
124
|
+
error: {
|
|
125
|
+
code: Number.isSafeInteger(error["code"])
|
|
126
|
+
? error["code"]
|
|
127
|
+
: types_js_1.ErrorCode.InternalError,
|
|
128
|
+
message: (_b = error.message) !== null && _b !== void 0 ? _b : "Internal error",
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => this._onerror(new Error(`Failed to send response: ${error}`)))
|
|
133
|
+
.finally(() => {
|
|
134
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
_onprogress(notification) {
|
|
138
|
+
const { progressToken, ...params } = notification.params;
|
|
139
|
+
const handler = this._progressHandlers.get(Number(progressToken));
|
|
140
|
+
if (handler === undefined) {
|
|
141
|
+
this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
handler(params);
|
|
145
|
+
}
|
|
146
|
+
_onresponse(response) {
|
|
147
|
+
const messageId = response.id;
|
|
148
|
+
const handler = this._responseHandlers.get(Number(messageId));
|
|
149
|
+
if (handler === undefined) {
|
|
150
|
+
this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
this._responseHandlers.delete(Number(messageId));
|
|
154
|
+
this._progressHandlers.delete(Number(messageId));
|
|
155
|
+
if ("result" in response) {
|
|
156
|
+
handler(response);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const error = new types_js_1.McpError(response.error.code, response.error.message, response.error.data);
|
|
160
|
+
handler(error);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
get transport() {
|
|
164
|
+
return this._transport;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Closes the connection.
|
|
168
|
+
*/
|
|
169
|
+
async close() {
|
|
170
|
+
var _a;
|
|
171
|
+
await ((_a = this._transport) === null || _a === void 0 ? void 0 : _a.close());
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Sends a request and wait for a response.
|
|
175
|
+
*
|
|
176
|
+
* Do not use this method to emit notifications! Use notification() instead.
|
|
177
|
+
*/
|
|
178
|
+
request(request, resultSchema, options) {
|
|
179
|
+
return new Promise((resolve, reject) => {
|
|
180
|
+
var _a, _b, _c, _d;
|
|
181
|
+
if (!this._transport) {
|
|
182
|
+
reject(new Error("Not connected"));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (((_a = this._options) === null || _a === void 0 ? void 0 : _a.enforceStrictCapabilities) === true) {
|
|
186
|
+
this.assertCapabilityForMethod(request.method);
|
|
187
|
+
}
|
|
188
|
+
(_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.throwIfAborted();
|
|
189
|
+
const messageId = this._requestMessageId++;
|
|
190
|
+
const jsonrpcRequest = {
|
|
191
|
+
...request,
|
|
192
|
+
jsonrpc: "2.0",
|
|
193
|
+
id: messageId,
|
|
194
|
+
};
|
|
195
|
+
if (options === null || options === void 0 ? void 0 : options.onprogress) {
|
|
196
|
+
this._progressHandlers.set(messageId, options.onprogress);
|
|
197
|
+
jsonrpcRequest.params = {
|
|
198
|
+
...request.params,
|
|
199
|
+
_meta: { progressToken: messageId },
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
let timeoutId = undefined;
|
|
203
|
+
this._responseHandlers.set(messageId, (response) => {
|
|
204
|
+
var _a;
|
|
205
|
+
if (timeoutId !== undefined) {
|
|
206
|
+
clearTimeout(timeoutId);
|
|
207
|
+
}
|
|
208
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (response instanceof Error) {
|
|
212
|
+
return reject(response);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const result = resultSchema.parse(response.result);
|
|
216
|
+
resolve(result);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
reject(error);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const cancel = (reason) => {
|
|
223
|
+
var _a;
|
|
224
|
+
this._responseHandlers.delete(messageId);
|
|
225
|
+
this._progressHandlers.delete(messageId);
|
|
226
|
+
(_a = this._transport) === null || _a === void 0 ? void 0 : _a.send({
|
|
227
|
+
jsonrpc: "2.0",
|
|
228
|
+
method: "notifications/cancelled",
|
|
229
|
+
params: {
|
|
230
|
+
requestId: messageId,
|
|
231
|
+
reason: String(reason),
|
|
232
|
+
},
|
|
233
|
+
}).catch((error) => this._onerror(new Error(`Failed to send cancellation: ${error}`)));
|
|
234
|
+
reject(reason);
|
|
235
|
+
};
|
|
236
|
+
(_c = options === null || options === void 0 ? void 0 : options.signal) === null || _c === void 0 ? void 0 : _c.addEventListener("abort", () => {
|
|
237
|
+
var _a;
|
|
238
|
+
if (timeoutId !== undefined) {
|
|
239
|
+
clearTimeout(timeoutId);
|
|
240
|
+
}
|
|
241
|
+
cancel((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.reason);
|
|
242
|
+
});
|
|
243
|
+
const timeout = (_d = options === null || options === void 0 ? void 0 : options.timeout) !== null && _d !== void 0 ? _d : exports.DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
244
|
+
timeoutId = setTimeout(() => cancel(new types_js_1.McpError(types_js_1.ErrorCode.RequestTimeout, "Request timed out", {
|
|
245
|
+
timeout,
|
|
246
|
+
})), timeout);
|
|
247
|
+
this._transport.send(jsonrpcRequest).catch((error) => {
|
|
248
|
+
if (timeoutId !== undefined) {
|
|
249
|
+
clearTimeout(timeoutId);
|
|
250
|
+
}
|
|
251
|
+
reject(error);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Emits a notification, which is a one-way message that does not expect a response.
|
|
257
|
+
*/
|
|
258
|
+
async notification(notification) {
|
|
259
|
+
if (!this._transport) {
|
|
260
|
+
throw new Error("Not connected");
|
|
261
|
+
}
|
|
262
|
+
this.assertNotificationCapability(notification.method);
|
|
263
|
+
const jsonrpcNotification = {
|
|
264
|
+
...notification,
|
|
265
|
+
jsonrpc: "2.0",
|
|
266
|
+
};
|
|
267
|
+
await this._transport.send(jsonrpcNotification);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Registers a handler to invoke when this protocol object receives a request with the given method.
|
|
271
|
+
*
|
|
272
|
+
* Note that this will replace any previous request handler for the same method.
|
|
273
|
+
*/
|
|
274
|
+
setRequestHandler(requestSchema, handler) {
|
|
275
|
+
const method = requestSchema.shape.method.value;
|
|
276
|
+
this.assertRequestHandlerCapability(method);
|
|
277
|
+
this._requestHandlers.set(method, (request, extra) => Promise.resolve(handler(requestSchema.parse(request), extra)));
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Removes the request handler for the given method.
|
|
281
|
+
*/
|
|
282
|
+
removeRequestHandler(method) {
|
|
283
|
+
this._requestHandlers.delete(method);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
|
287
|
+
*
|
|
288
|
+
* Note that this will replace any previous notification handler for the same method.
|
|
289
|
+
*/
|
|
290
|
+
setNotificationHandler(notificationSchema, handler) {
|
|
291
|
+
this._notificationHandlers.set(notificationSchema.shape.method.value, (notification) => Promise.resolve(handler(notificationSchema.parse(notification))));
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Removes the notification handler for the given method.
|
|
295
|
+
*/
|
|
296
|
+
removeNotificationHandler(method) {
|
|
297
|
+
this._notificationHandlers.delete(method);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
exports.Protocol = Protocol;
|
|
301
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/shared/protocol.ts"],"names":[],"mappings":";;;AACA,0CAgBqB;AAsBrB;;GAEG;AACU,QAAA,4BAA4B,GAAG,KAAK,CAAC;AAkClD;;;GAGG;AACH,MAAsB,QAAQ;IAkD5B,YAAoB,QAA0B;QAA1B,aAAQ,GAAR,QAAQ,CAAkB;QA5CtC,sBAAiB,GAAG,CAAC,CAAC;QACtB,qBAAgB,GAMpB,IAAI,GAAG,EAAE,CAAC;QACN,oCAA+B,GACrC,IAAI,GAAG,EAAE,CAAC;QACJ,0BAAqB,GAGzB,IAAI,GAAG,EAAE,CAAC;QACN,sBAAiB,GAGrB,IAAI,GAAG,EAAE,CAAC;QACN,sBAAiB,GAAkC,IAAI,GAAG,EAAE,CAAC;QA2BnE,IAAI,CAAC,sBAAsB,CAAC,sCAA2B,EAAE,CAAC,YAAY,EAAE,EAAE;YACxE,MAAM,UAAU,GAAG,IAAI,CAAC,+BAA+B,CAAC,GAAG,CACzD,YAAY,CAAC,MAAM,CAAC,SAAS,CAC9B,CAAC;YACF,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,sBAAsB,CAAC,qCAA0B,EAAE,CAAC,YAAY,EAAE,EAAE;YACvE,IAAI,CAAC,WAAW,CAAC,YAA+C,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,CACpB,4BAAiB;QACjB,6BAA6B;QAC7B,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,CAAgB,CAClC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,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cAAc,GAAG,IAAI;IAepC,KAAK,IAAI,IAAI;CAGd;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAE/D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadBuffer = void 0;
|
|
4
|
+
exports.deserializeMessage = deserializeMessage;
|
|
5
|
+
exports.serializeMessage = serializeMessage;
|
|
6
|
+
const types_js_1 = require("../types.js");
|
|
7
|
+
/**
|
|
8
|
+
* Buffers a continuous stdio stream into discrete JSON-RPC messages.
|
|
9
|
+
*/
|
|
10
|
+
class ReadBuffer {
|
|
11
|
+
append(chunk) {
|
|
12
|
+
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
13
|
+
}
|
|
14
|
+
readMessage() {
|
|
15
|
+
if (!this._buffer) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const index = this._buffer.indexOf("\n");
|
|
19
|
+
if (index === -1) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const line = this._buffer.toString("utf8", 0, index);
|
|
23
|
+
this._buffer = this._buffer.subarray(index + 1);
|
|
24
|
+
return deserializeMessage(line);
|
|
25
|
+
}
|
|
26
|
+
clear() {
|
|
27
|
+
this._buffer = undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ReadBuffer = ReadBuffer;
|
|
31
|
+
function deserializeMessage(line) {
|
|
32
|
+
return types_js_1.JSONRPCMessageSchema.parse(JSON.parse(line));
|
|
33
|
+
}
|
|
34
|
+
function serializeMessage(message) {
|
|
35
|
+
return JSON.stringify(message) + "\n";
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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transport.d.ts","sourceRoot":"","sources":["../../../src/shared/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/shared/transport.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z, ZodTypeAny } from "zod";
|
|
2
2
|
export declare const LATEST_PROTOCOL_VERSION = "2024-11-05";
|
|
3
3
|
export declare const SUPPORTED_PROTOCOL_VERSIONS: string[];
|
|
4
4
|
export declare const JSONRPC_VERSION = "2.0";
|
|
@@ -26345,81 +26345,87 @@ export declare class McpError extends Error {
|
|
|
26345
26345
|
readonly data?: unknown;
|
|
26346
26346
|
constructor(code: number, message: string, data?: unknown);
|
|
26347
26347
|
}
|
|
26348
|
-
|
|
26349
|
-
|
|
26350
|
-
|
|
26351
|
-
|
|
26352
|
-
|
|
26353
|
-
export type
|
|
26354
|
-
export type
|
|
26355
|
-
export type
|
|
26356
|
-
export type
|
|
26357
|
-
export type
|
|
26358
|
-
export type
|
|
26359
|
-
export type
|
|
26360
|
-
export type
|
|
26361
|
-
export type
|
|
26362
|
-
export type
|
|
26363
|
-
export type
|
|
26364
|
-
export type
|
|
26365
|
-
export type
|
|
26366
|
-
export type
|
|
26367
|
-
export type
|
|
26368
|
-
export type
|
|
26369
|
-
export type
|
|
26370
|
-
export type
|
|
26371
|
-
export type
|
|
26372
|
-
export type
|
|
26373
|
-
export type
|
|
26374
|
-
export type
|
|
26375
|
-
export type
|
|
26376
|
-
export type
|
|
26377
|
-
export type
|
|
26378
|
-
export type
|
|
26379
|
-
export type
|
|
26380
|
-
export type
|
|
26381
|
-
export type
|
|
26382
|
-
export type
|
|
26383
|
-
export type
|
|
26384
|
-
export type
|
|
26385
|
-
export type
|
|
26386
|
-
export type
|
|
26387
|
-
export type
|
|
26388
|
-
export type
|
|
26389
|
-
export type
|
|
26390
|
-
export type
|
|
26391
|
-
export type
|
|
26392
|
-
export type
|
|
26393
|
-
export type
|
|
26394
|
-
export type
|
|
26395
|
-
export type
|
|
26396
|
-
export type
|
|
26397
|
-
export type
|
|
26398
|
-
export type
|
|
26399
|
-
export type
|
|
26400
|
-
export type
|
|
26401
|
-
export type
|
|
26402
|
-
export type
|
|
26403
|
-
export type
|
|
26404
|
-
export type
|
|
26405
|
-
export type
|
|
26406
|
-
export type
|
|
26407
|
-
export type
|
|
26408
|
-
export type
|
|
26409
|
-
export type
|
|
26410
|
-
export type
|
|
26411
|
-
export type
|
|
26412
|
-
export type
|
|
26413
|
-
export type
|
|
26414
|
-
export type
|
|
26415
|
-
export type
|
|
26416
|
-
export type
|
|
26417
|
-
export type
|
|
26418
|
-
export type
|
|
26419
|
-
export type
|
|
26420
|
-
export type
|
|
26421
|
-
export type
|
|
26422
|
-
export type
|
|
26423
|
-
export type
|
|
26424
|
-
export type
|
|
26348
|
+
type Primitive = string | number | boolean | bigint | null | undefined;
|
|
26349
|
+
type Flatten<T> = T extends Primitive ? T : T extends Array<infer U> ? Array<Flatten<U>> : T extends Set<infer U> ? Set<Flatten<U>> : T extends Map<infer K, infer V> ? Map<Flatten<K>, Flatten<V>> : T extends object ? {
|
|
26350
|
+
[K in keyof T]: Flatten<T[K]>;
|
|
26351
|
+
} : T;
|
|
26352
|
+
type Infer<Schema extends ZodTypeAny> = Flatten<z.infer<Schema>>;
|
|
26353
|
+
export type ProgressToken = Infer<typeof ProgressTokenSchema>;
|
|
26354
|
+
export type Cursor = Infer<typeof CursorSchema>;
|
|
26355
|
+
export type Request = Infer<typeof RequestSchema>;
|
|
26356
|
+
export type Notification = Infer<typeof NotificationSchema>;
|
|
26357
|
+
export type Result = Infer<typeof ResultSchema>;
|
|
26358
|
+
export type RequestId = Infer<typeof RequestIdSchema>;
|
|
26359
|
+
export type JSONRPCRequest = Infer<typeof JSONRPCRequestSchema>;
|
|
26360
|
+
export type JSONRPCNotification = Infer<typeof JSONRPCNotificationSchema>;
|
|
26361
|
+
export type JSONRPCResponse = Infer<typeof JSONRPCResponseSchema>;
|
|
26362
|
+
export type JSONRPCError = Infer<typeof JSONRPCErrorSchema>;
|
|
26363
|
+
export type JSONRPCMessage = Infer<typeof JSONRPCMessageSchema>;
|
|
26364
|
+
export type EmptyResult = Infer<typeof EmptyResultSchema>;
|
|
26365
|
+
export type CancelledNotification = Infer<typeof CancelledNotificationSchema>;
|
|
26366
|
+
export type Implementation = Infer<typeof ImplementationSchema>;
|
|
26367
|
+
export type ClientCapabilities = Infer<typeof ClientCapabilitiesSchema>;
|
|
26368
|
+
export type InitializeRequest = Infer<typeof InitializeRequestSchema>;
|
|
26369
|
+
export type ServerCapabilities = Infer<typeof ServerCapabilitiesSchema>;
|
|
26370
|
+
export type InitializeResult = Infer<typeof InitializeResultSchema>;
|
|
26371
|
+
export type InitializedNotification = Infer<typeof InitializedNotificationSchema>;
|
|
26372
|
+
export type PingRequest = Infer<typeof PingRequestSchema>;
|
|
26373
|
+
export type Progress = Infer<typeof ProgressSchema>;
|
|
26374
|
+
export type ProgressNotification = Infer<typeof ProgressNotificationSchema>;
|
|
26375
|
+
export type PaginatedRequest = Infer<typeof PaginatedRequestSchema>;
|
|
26376
|
+
export type PaginatedResult = Infer<typeof PaginatedResultSchema>;
|
|
26377
|
+
export type ResourceContents = Infer<typeof ResourceContentsSchema>;
|
|
26378
|
+
export type TextResourceContents = Infer<typeof TextResourceContentsSchema>;
|
|
26379
|
+
export type BlobResourceContents = Infer<typeof BlobResourceContentsSchema>;
|
|
26380
|
+
export type Resource = Infer<typeof ResourceSchema>;
|
|
26381
|
+
export type ResourceTemplate = Infer<typeof ResourceTemplateSchema>;
|
|
26382
|
+
export type ListResourcesRequest = Infer<typeof ListResourcesRequestSchema>;
|
|
26383
|
+
export type ListResourcesResult = Infer<typeof ListResourcesResultSchema>;
|
|
26384
|
+
export type ListResourceTemplatesRequest = Infer<typeof ListResourceTemplatesRequestSchema>;
|
|
26385
|
+
export type ListResourceTemplatesResult = Infer<typeof ListResourceTemplatesResultSchema>;
|
|
26386
|
+
export type ReadResourceRequest = Infer<typeof ReadResourceRequestSchema>;
|
|
26387
|
+
export type ReadResourceResult = Infer<typeof ReadResourceResultSchema>;
|
|
26388
|
+
export type ResourceListChangedNotification = Infer<typeof ResourceListChangedNotificationSchema>;
|
|
26389
|
+
export type SubscribeRequest = Infer<typeof SubscribeRequestSchema>;
|
|
26390
|
+
export type UnsubscribeRequest = Infer<typeof UnsubscribeRequestSchema>;
|
|
26391
|
+
export type ResourceUpdatedNotification = Infer<typeof ResourceUpdatedNotificationSchema>;
|
|
26392
|
+
export type PromptArgument = Infer<typeof PromptArgumentSchema>;
|
|
26393
|
+
export type Prompt = Infer<typeof PromptSchema>;
|
|
26394
|
+
export type ListPromptsRequest = Infer<typeof ListPromptsRequestSchema>;
|
|
26395
|
+
export type ListPromptsResult = Infer<typeof ListPromptsResultSchema>;
|
|
26396
|
+
export type GetPromptRequest = Infer<typeof GetPromptRequestSchema>;
|
|
26397
|
+
export type TextContent = Infer<typeof TextContentSchema>;
|
|
26398
|
+
export type ImageContent = Infer<typeof ImageContentSchema>;
|
|
26399
|
+
export type EmbeddedResource = Infer<typeof EmbeddedResourceSchema>;
|
|
26400
|
+
export type PromptMessage = Infer<typeof PromptMessageSchema>;
|
|
26401
|
+
export type GetPromptResult = Infer<typeof GetPromptResultSchema>;
|
|
26402
|
+
export type PromptListChangedNotification = Infer<typeof PromptListChangedNotificationSchema>;
|
|
26403
|
+
export type Tool = Infer<typeof ToolSchema>;
|
|
26404
|
+
export type ListToolsRequest = Infer<typeof ListToolsRequestSchema>;
|
|
26405
|
+
export type ListToolsResult = Infer<typeof ListToolsResultSchema>;
|
|
26406
|
+
export type CallToolResult = Infer<typeof CallToolResultSchema>;
|
|
26407
|
+
export type CompatibilityCallToolResult = Infer<typeof CompatibilityCallToolResultSchema>;
|
|
26408
|
+
export type CallToolRequest = Infer<typeof CallToolRequestSchema>;
|
|
26409
|
+
export type ToolListChangedNotification = Infer<typeof ToolListChangedNotificationSchema>;
|
|
26410
|
+
export type LoggingLevel = Infer<typeof LoggingLevelSchema>;
|
|
26411
|
+
export type SetLevelRequest = Infer<typeof SetLevelRequestSchema>;
|
|
26412
|
+
export type LoggingMessageNotification = Infer<typeof LoggingMessageNotificationSchema>;
|
|
26413
|
+
export type SamplingMessage = Infer<typeof SamplingMessageSchema>;
|
|
26414
|
+
export type CreateMessageRequest = Infer<typeof CreateMessageRequestSchema>;
|
|
26415
|
+
export type CreateMessageResult = Infer<typeof CreateMessageResultSchema>;
|
|
26416
|
+
export type ResourceReference = Infer<typeof ResourceReferenceSchema>;
|
|
26417
|
+
export type PromptReference = Infer<typeof PromptReferenceSchema>;
|
|
26418
|
+
export type CompleteRequest = Infer<typeof CompleteRequestSchema>;
|
|
26419
|
+
export type CompleteResult = Infer<typeof CompleteResultSchema>;
|
|
26420
|
+
export type Root = Infer<typeof RootSchema>;
|
|
26421
|
+
export type ListRootsRequest = Infer<typeof ListRootsRequestSchema>;
|
|
26422
|
+
export type ListRootsResult = Infer<typeof ListRootsResultSchema>;
|
|
26423
|
+
export type RootsListChangedNotification = Infer<typeof RootsListChangedNotificationSchema>;
|
|
26424
|
+
export type ClientRequest = Infer<typeof ClientRequestSchema>;
|
|
26425
|
+
export type ClientNotification = Infer<typeof ClientNotificationSchema>;
|
|
26426
|
+
export type ClientResult = Infer<typeof ClientResultSchema>;
|
|
26427
|
+
export type ServerRequest = Infer<typeof ServerRequestSchema>;
|
|
26428
|
+
export type ServerNotification = Infer<typeof ServerNotificationSchema>;
|
|
26429
|
+
export type ServerResult = Infer<typeof ServerResultSchema>;
|
|
26430
|
+
export {};
|
|
26425
26431
|
//# sourceMappingURL=types.d.ts.map
|