cloakbrowser-mcp 1.0.2 → 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/README.md +22 -1
- package/dist/bridge/config.d.ts +2 -0
- package/dist/bridge/config.d.ts.map +1 -1
- package/dist/bridge/config.js +4 -0
- package/dist/bridge/config.js.map +1 -1
- package/dist/cli/options.d.ts +31 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +228 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli.js +22 -41
- package/dist/cli.js.map +1 -1
- package/dist/http/options.d.ts +20 -0
- package/dist/http/options.d.ts.map +1 -0
- package/dist/http/options.js +15 -0
- package/dist/http/options.js.map +1 -0
- package/dist/http/server.d.ts +19 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +315 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/sessionStore.d.ts +31 -0
- package/dist/http/sessionStore.d.ts.map +1 -0
- package/dist/http/sessionStore.js +60 -0
- package/dist/http/sessionStore.js.map +1 -0
- package/dist/http/status.d.ts +18 -0
- package/dist/http/status.d.ts.map +1 -0
- package/dist/http/status.js +20 -0
- package/dist/http/status.js.map +1 -0
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/package.json +9 -4
- package/server.json +99 -3
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { randomUUID, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
|
+
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { createBridgeServer } from '../server.js';
|
|
6
|
+
import { createSessionStore } from './sessionStore.js';
|
|
7
|
+
import { HttpStatus, JsonRpcErrorCode } from './status.js';
|
|
8
|
+
const mcpSessionIdHeader = 'mcp-session-id';
|
|
9
|
+
const jsonRpcContentType = 'application/json';
|
|
10
|
+
const allowedMethods = 'GET, POST, DELETE';
|
|
11
|
+
export async function startStreamableHttpBridge(options) {
|
|
12
|
+
const controller = new StreamableHttpBridgeController(options);
|
|
13
|
+
return controller.start();
|
|
14
|
+
}
|
|
15
|
+
export function isAuthorizedRequest(req, authToken) {
|
|
16
|
+
if (authToken === undefined)
|
|
17
|
+
return true;
|
|
18
|
+
const authorization = getSingleHeader(req, 'authorization');
|
|
19
|
+
if (!authorization)
|
|
20
|
+
return false;
|
|
21
|
+
const parts = authorization.trim().split(/\s+/);
|
|
22
|
+
if (parts.length !== 2)
|
|
23
|
+
return false;
|
|
24
|
+
const [scheme, token] = parts;
|
|
25
|
+
return scheme.toLowerCase() === 'bearer' && timingSafeStringEqual(token, authToken);
|
|
26
|
+
}
|
|
27
|
+
export function isEndpointRequest(req, endpoint, fallbackHost) {
|
|
28
|
+
const host = getSingleHeader(req, 'host') ?? formatHost(fallbackHost);
|
|
29
|
+
const url = new URL(req.url ?? '/', `http://${host}`);
|
|
30
|
+
return url.pathname === endpoint;
|
|
31
|
+
}
|
|
32
|
+
class StreamableHttpBridgeController {
|
|
33
|
+
#options;
|
|
34
|
+
#store;
|
|
35
|
+
#sessions = new Map();
|
|
36
|
+
#closing = new Map();
|
|
37
|
+
#httpServer;
|
|
38
|
+
#cleanupTimer;
|
|
39
|
+
#pendingSessionInitializations = 0;
|
|
40
|
+
constructor(options) {
|
|
41
|
+
this.#options = options;
|
|
42
|
+
this.#store = options.sessionStore ?? createSessionStore(options.sessionBackend);
|
|
43
|
+
this.#httpServer = createServer((req, res) => {
|
|
44
|
+
void this.#handleRequest(req, res);
|
|
45
|
+
});
|
|
46
|
+
this.#cleanupTimer = setInterval(() => {
|
|
47
|
+
void this.#closeExpiredSessions();
|
|
48
|
+
}, Math.min(options.sessionIdleTtlMs, 60_000));
|
|
49
|
+
this.#cleanupTimer.unref();
|
|
50
|
+
}
|
|
51
|
+
async start() {
|
|
52
|
+
await listenHttpServer(this.#httpServer, this.#options.port, this.#options.host);
|
|
53
|
+
const address = this.#httpServer.address();
|
|
54
|
+
if (typeof address === 'string' || address === null) {
|
|
55
|
+
throw new Error('HTTP server did not expose a TCP address');
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
address,
|
|
59
|
+
url: `http://${formatHost(address.address)}:${address.port}${this.#options.endpoint}`,
|
|
60
|
+
close: async () => {
|
|
61
|
+
clearInterval(this.#cleanupTimer);
|
|
62
|
+
await Promise.allSettled([...this.#sessions.keys()].map((id) => this.#closeSession(id)));
|
|
63
|
+
await closeHttpServer(this.#httpServer);
|
|
64
|
+
await this.#store.clear();
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async #handleRequest(req, res) {
|
|
69
|
+
try {
|
|
70
|
+
if (!isEndpointRequest(req, this.#options.endpoint, this.#options.host)) {
|
|
71
|
+
writeJsonRpcError(res, HttpStatus.NotFound, JsonRpcErrorCode.ServerError, 'Not found');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!isAuthorizedRequest(req, this.#options.authToken)) {
|
|
75
|
+
writeJsonRpcError(res, HttpStatus.Unauthorized, JsonRpcErrorCode.ServerError, 'Unauthorized', {
|
|
76
|
+
'WWW-Authenticate': 'Bearer',
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
await this.#closeExpiredSessions();
|
|
81
|
+
const method = req.method ?? '';
|
|
82
|
+
if (method !== 'GET' && method !== 'POST' && method !== 'DELETE') {
|
|
83
|
+
writeJsonRpcError(res, HttpStatus.MethodNotAllowed, JsonRpcErrorCode.ServerError, 'Method not allowed.', {
|
|
84
|
+
Allow: allowedMethods,
|
|
85
|
+
});
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (method === 'POST') {
|
|
89
|
+
await this.#handlePostRequest(req, res);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await this.#handleSessionRequest(req, res);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
if (!res.headersSent) {
|
|
96
|
+
writeJsonRpcError(res, HttpStatus.InternalServerError, JsonRpcErrorCode.InternalError, 'Internal server error');
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
res.end();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async #handlePostRequest(req, res) {
|
|
104
|
+
if (!hasJsonContentType(req)) {
|
|
105
|
+
writeJsonRpcError(res, HttpStatus.UnsupportedMediaType, JsonRpcErrorCode.ServerError, 'Unsupported Media Type: Content-Type must be application/json');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
let parsedBody;
|
|
109
|
+
try {
|
|
110
|
+
parsedBody = await readJsonBody(req, this.#options.bodyLimitBytes);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof RequestBodyTooLargeError) {
|
|
114
|
+
writeJsonRpcError(res, HttpStatus.PayloadTooLarge, JsonRpcErrorCode.ServerError, 'Request body too large');
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
writeJsonRpcError(res, HttpStatus.BadRequest, JsonRpcErrorCode.ParseError, 'Parse error: Invalid JSON');
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const sessionId = getSingleHeader(req, mcpSessionIdHeader);
|
|
122
|
+
if (sessionId) {
|
|
123
|
+
await this.#handleSessionRequest(req, res, parsedBody);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!containsInitializeRequest(parsedBody)) {
|
|
127
|
+
writeJsonRpcError(res, HttpStatus.BadRequest, JsonRpcErrorCode.ServerError, 'Bad Request: No valid session ID provided');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
await this.#handleInitializeRequest(req, res, parsedBody);
|
|
131
|
+
}
|
|
132
|
+
async #handleInitializeRequest(req, res, parsedBody) {
|
|
133
|
+
const now = Date.now();
|
|
134
|
+
if (this.#sessions.size + this.#pendingSessionInitializations >= this.#options.sessionMax) {
|
|
135
|
+
writeJsonRpcError(res, HttpStatus.ServiceUnavailable, JsonRpcErrorCode.ServerError, 'HTTP session limit reached');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.#pendingSessionInitializations += 1;
|
|
139
|
+
const sessionId = randomUUID();
|
|
140
|
+
const record = {
|
|
141
|
+
id: sessionId,
|
|
142
|
+
createdAt: now,
|
|
143
|
+
lastSeenAt: now,
|
|
144
|
+
expiresAt: now + this.#options.sessionIdleTtlMs,
|
|
145
|
+
status: 'active',
|
|
146
|
+
};
|
|
147
|
+
const transport = new StreamableHTTPServerTransport({
|
|
148
|
+
sessionIdGenerator: () => sessionId,
|
|
149
|
+
onsessioninitialized: async (initializedSessionId) => {
|
|
150
|
+
if (initializedSessionId !== sessionId) {
|
|
151
|
+
throw new Error(`Unexpected HTTP session ID "${initializedSessionId}"`);
|
|
152
|
+
}
|
|
153
|
+
await this.#store.create(record);
|
|
154
|
+
},
|
|
155
|
+
onsessionclosed: async (closedSessionId) => {
|
|
156
|
+
if (closedSessionId)
|
|
157
|
+
await this.#store.markClosed(closedSessionId, Date.now());
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
try {
|
|
161
|
+
const bridge = await createBridgeServer({
|
|
162
|
+
serverInfo: this.#options.serverInfo,
|
|
163
|
+
runtimeOptions: { browserIsolated: true },
|
|
164
|
+
});
|
|
165
|
+
this.#sessions.set(sessionId, { id: sessionId, bridge, transport });
|
|
166
|
+
await bridge.start(transport);
|
|
167
|
+
await transport.handleRequest(req, res, parsedBody);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
await this.#closeSession(sessionId);
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
this.#pendingSessionInitializations -= 1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async #handleSessionRequest(req, res, parsedBody) {
|
|
178
|
+
const sessionId = getSingleHeader(req, mcpSessionIdHeader);
|
|
179
|
+
if (!sessionId) {
|
|
180
|
+
writeJsonRpcError(res, HttpStatus.BadRequest, JsonRpcErrorCode.ServerError, 'Bad Request: Mcp-Session-Id header is required');
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const session = await this.#getActiveSession(sessionId);
|
|
184
|
+
if (!session) {
|
|
185
|
+
writeJsonRpcError(res, HttpStatus.NotFound, JsonRpcErrorCode.SessionNotFound, 'Session not found');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
await this.#store.touch(sessionId, Date.now(), this.#options.sessionIdleTtlMs);
|
|
189
|
+
await session.transport.handleRequest(req, res, parsedBody);
|
|
190
|
+
if (req.method === 'DELETE') {
|
|
191
|
+
await this.#closeSession(sessionId);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async #getActiveSession(sessionId) {
|
|
195
|
+
const record = await this.#store.get(sessionId);
|
|
196
|
+
const session = this.#sessions.get(sessionId);
|
|
197
|
+
const now = Date.now();
|
|
198
|
+
if (!record || record.status !== 'active' || record.expiresAt <= now || !session) {
|
|
199
|
+
if (record?.status === 'active' && record.expiresAt <= now)
|
|
200
|
+
await this.#closeSession(sessionId);
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
return session;
|
|
204
|
+
}
|
|
205
|
+
async #closeExpiredSessions() {
|
|
206
|
+
const expired = await this.#store.listExpired(Date.now());
|
|
207
|
+
await Promise.allSettled(expired.map((record) => this.#closeSession(record.id)));
|
|
208
|
+
}
|
|
209
|
+
async #closeSession(sessionId) {
|
|
210
|
+
const pending = this.#closing.get(sessionId);
|
|
211
|
+
if (pending)
|
|
212
|
+
return pending;
|
|
213
|
+
const closing = this.#disposeSession(sessionId).finally(() => {
|
|
214
|
+
this.#closing.delete(sessionId);
|
|
215
|
+
});
|
|
216
|
+
this.#closing.set(sessionId, closing);
|
|
217
|
+
return closing;
|
|
218
|
+
}
|
|
219
|
+
async #disposeSession(sessionId) {
|
|
220
|
+
const session = this.#sessions.get(sessionId);
|
|
221
|
+
this.#sessions.delete(sessionId);
|
|
222
|
+
await this.#store.markClosed(sessionId, Date.now());
|
|
223
|
+
if (!session)
|
|
224
|
+
return;
|
|
225
|
+
await session.bridge.dispose();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function hasJsonContentType(req) {
|
|
229
|
+
const contentType = getSingleHeader(req, 'content-type');
|
|
230
|
+
return contentType?.toLowerCase().includes(jsonRpcContentType) ?? false;
|
|
231
|
+
}
|
|
232
|
+
async function readJsonBody(req, limitBytes) {
|
|
233
|
+
const contentLength = getSingleHeader(req, 'content-length');
|
|
234
|
+
if (contentLength !== undefined && Number.parseInt(contentLength, 10) > limitBytes) {
|
|
235
|
+
throw new RequestBodyTooLargeError();
|
|
236
|
+
}
|
|
237
|
+
const chunks = [];
|
|
238
|
+
let size = 0;
|
|
239
|
+
for await (const chunk of req) {
|
|
240
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
241
|
+
size += buffer.byteLength;
|
|
242
|
+
if (size > limitBytes)
|
|
243
|
+
throw new RequestBodyTooLargeError();
|
|
244
|
+
chunks.push(buffer);
|
|
245
|
+
}
|
|
246
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
247
|
+
}
|
|
248
|
+
function containsInitializeRequest(value) {
|
|
249
|
+
const messages = Array.isArray(value) ? value : [value];
|
|
250
|
+
return messages.some((message) => isInitializeRequest(message));
|
|
251
|
+
}
|
|
252
|
+
function getSingleHeader(req, name) {
|
|
253
|
+
const value = req.headers[name];
|
|
254
|
+
if (Array.isArray(value))
|
|
255
|
+
return value[0];
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
function writeJsonRpcError(res, status, code, message, headers = {}, data) {
|
|
259
|
+
const error = { code, message };
|
|
260
|
+
if (data !== undefined)
|
|
261
|
+
error.data = data;
|
|
262
|
+
res.writeHead(status, {
|
|
263
|
+
'Content-Type': jsonRpcContentType,
|
|
264
|
+
...headers,
|
|
265
|
+
});
|
|
266
|
+
res.end(JSON.stringify({
|
|
267
|
+
jsonrpc: '2.0',
|
|
268
|
+
error,
|
|
269
|
+
id: null,
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
function formatHost(host) {
|
|
273
|
+
if (host.startsWith('[') && host.endsWith(']'))
|
|
274
|
+
return host;
|
|
275
|
+
return host.includes(':') ? `[${host}]` : host;
|
|
276
|
+
}
|
|
277
|
+
function timingSafeStringEqual(actual, expected) {
|
|
278
|
+
const actualBuffer = Buffer.from(actual);
|
|
279
|
+
const expectedBuffer = Buffer.from(expected);
|
|
280
|
+
return actualBuffer.length === expectedBuffer.length && timingSafeEqual(actualBuffer, expectedBuffer);
|
|
281
|
+
}
|
|
282
|
+
async function closeHttpServer(server) {
|
|
283
|
+
if (!server.listening)
|
|
284
|
+
return;
|
|
285
|
+
await new Promise((resolve, reject) => {
|
|
286
|
+
server.close((error) => {
|
|
287
|
+
if (error)
|
|
288
|
+
reject(error);
|
|
289
|
+
else
|
|
290
|
+
resolve();
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async function listenHttpServer(server, port, host) {
|
|
295
|
+
await new Promise((resolve, reject) => {
|
|
296
|
+
const cleanup = () => {
|
|
297
|
+
server.off('error', onError);
|
|
298
|
+
server.off('listening', onListening);
|
|
299
|
+
};
|
|
300
|
+
const onError = (error) => {
|
|
301
|
+
cleanup();
|
|
302
|
+
reject(error);
|
|
303
|
+
};
|
|
304
|
+
const onListening = () => {
|
|
305
|
+
cleanup();
|
|
306
|
+
resolve();
|
|
307
|
+
};
|
|
308
|
+
server.once('error', onError);
|
|
309
|
+
server.once('listening', onListening);
|
|
310
|
+
server.listen(port, host);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
class RequestBodyTooLargeError extends Error {
|
|
314
|
+
}
|
|
315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IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACvC,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,CAAC,KAAY,EAAQ,EAAE;YACrC,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,WAAW,GAAG,GAAS,EAAE;YAC7B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,wBAAyB,SAAQ,KAAK;CAAG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type HttpSessionStatus = 'active' | 'closed';
|
|
2
|
+
export interface HttpSessionRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
createdAt: number;
|
|
5
|
+
lastSeenAt: number;
|
|
6
|
+
expiresAt: number;
|
|
7
|
+
status: HttpSessionStatus;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionStore {
|
|
10
|
+
create(record: HttpSessionRecord): Promise<void>;
|
|
11
|
+
get(id: string): Promise<HttpSessionRecord | undefined>;
|
|
12
|
+
touch(id: string, now: number, idleTtlMs: number): Promise<HttpSessionRecord | undefined>;
|
|
13
|
+
markClosed(id: string, now: number): Promise<HttpSessionRecord | undefined>;
|
|
14
|
+
countActive(now: number): Promise<number>;
|
|
15
|
+
listExpired(now: number): Promise<HttpSessionRecord[]>;
|
|
16
|
+
list(): Promise<HttpSessionRecord[]>;
|
|
17
|
+
clear(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare class InMemorySessionStore implements SessionStore {
|
|
20
|
+
#private;
|
|
21
|
+
create(record: HttpSessionRecord): Promise<void>;
|
|
22
|
+
get(id: string): Promise<HttpSessionRecord | undefined>;
|
|
23
|
+
touch(id: string, now: number, idleTtlMs: number): Promise<HttpSessionRecord | undefined>;
|
|
24
|
+
markClosed(id: string, now: number): Promise<HttpSessionRecord | undefined>;
|
|
25
|
+
countActive(now: number): Promise<number>;
|
|
26
|
+
listExpired(now: number): Promise<HttpSessionRecord[]>;
|
|
27
|
+
list(): Promise<HttpSessionRecord[]>;
|
|
28
|
+
clear(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createSessionStore(backend: string): SessionStore;
|
|
31
|
+
//# sourceMappingURL=sessionStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStore.d.ts","sourceRoot":"","sources":["../../src/http/sessionStore.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAA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records.set(record.id, { ...record });
|
|
5
|
+
}
|
|
6
|
+
async get(id) {
|
|
7
|
+
const record = this.#records.get(id);
|
|
8
|
+
return record ? { ...record } : undefined;
|
|
9
|
+
}
|
|
10
|
+
async touch(id, now, idleTtlMs) {
|
|
11
|
+
const record = this.#records.get(id);
|
|
12
|
+
if (!record || record.status !== 'active')
|
|
13
|
+
return undefined;
|
|
14
|
+
const updated = {
|
|
15
|
+
...record,
|
|
16
|
+
lastSeenAt: now,
|
|
17
|
+
expiresAt: now + idleTtlMs,
|
|
18
|
+
};
|
|
19
|
+
this.#records.set(id, updated);
|
|
20
|
+
return { ...updated };
|
|
21
|
+
}
|
|
22
|
+
async markClosed(id, now) {
|
|
23
|
+
const record = this.#records.get(id);
|
|
24
|
+
if (!record)
|
|
25
|
+
return undefined;
|
|
26
|
+
const updated = {
|
|
27
|
+
...record,
|
|
28
|
+
lastSeenAt: now,
|
|
29
|
+
expiresAt: now,
|
|
30
|
+
status: 'closed',
|
|
31
|
+
};
|
|
32
|
+
this.#records.set(id, updated);
|
|
33
|
+
return { ...updated };
|
|
34
|
+
}
|
|
35
|
+
async countActive(now) {
|
|
36
|
+
let count = 0;
|
|
37
|
+
for (const record of this.#records.values()) {
|
|
38
|
+
if (record.status === 'active' && record.expiresAt > now)
|
|
39
|
+
count += 1;
|
|
40
|
+
}
|
|
41
|
+
return count;
|
|
42
|
+
}
|
|
43
|
+
async listExpired(now) {
|
|
44
|
+
return [...this.#records.values()]
|
|
45
|
+
.filter((record) => record.status === 'active' && record.expiresAt <= now)
|
|
46
|
+
.map((record) => ({ ...record }));
|
|
47
|
+
}
|
|
48
|
+
async list() {
|
|
49
|
+
return [...this.#records.values()].map((record) => ({ ...record }));
|
|
50
|
+
}
|
|
51
|
+
async clear() {
|
|
52
|
+
this.#records.clear();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function createSessionStore(backend) {
|
|
56
|
+
if (backend === 'memory')
|
|
57
|
+
return new InMemorySessionStore();
|
|
58
|
+
throw new Error(`Unsupported HTTP session backend "${backend}"`);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=sessionStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionStore.js","sourceRoot":"","sources":["../../src/http/sessionStore.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,oBAAoB;IACtB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEzD,KAAK,CAAC,MAAM,CAAC,MAAyB;QACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,EAAU,EAAE,GAAW,EAAE,SAAiB;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAC5D,MAAM,OAAO,GAAG;YACd,GAAG,MAAM;YACT,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,GAAG,GAAG,SAAS;SAC3B,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,GAAW;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,C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;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,oBAAoB,EAAE,CAAC;IAC5D,MAAM,IAAI,KAAK,CAAC,qCAAqC,OAAO,GAAG,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum HttpStatus {
|
|
2
|
+
Ok = 200,
|
|
3
|
+
BadRequest = 400,
|
|
4
|
+
Unauthorized = 401,
|
|
5
|
+
NotFound = 404,
|
|
6
|
+
MethodNotAllowed = 405,
|
|
7
|
+
PayloadTooLarge = 413,
|
|
8
|
+
UnsupportedMediaType = 415,
|
|
9
|
+
InternalServerError = 500,
|
|
10
|
+
ServiceUnavailable = 503
|
|
11
|
+
}
|
|
12
|
+
export declare enum JsonRpcErrorCode {
|
|
13
|
+
ServerError = -32000,
|
|
14
|
+
SessionNotFound = -32001,
|
|
15
|
+
InternalError = -32603,
|
|
16
|
+
ParseError = -32700
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/http/status.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,UAAU,MAAM;IAChB,YAAY,MAAM;IAClB,QAAQ,MAAM;IACd,gBAAgB,MAAM;IACtB,eAAe,MAAM;IACrB,oBAAoB,MAAM;IAC1B,mBAAmB,MAAM;IACzB,kBAAkB,MAAM;CACzB;AAED,oBAAY,gBAAgB;IAC1B,WAAW,SAAS;IACpB,eAAe,SAAS;IACxB,aAAa,SAAS;IACtB,UAAU,SAAS;CACpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var HttpStatus;
|
|
2
|
+
(function (HttpStatus) {
|
|
3
|
+
HttpStatus[HttpStatus["Ok"] = 200] = "Ok";
|
|
4
|
+
HttpStatus[HttpStatus["BadRequest"] = 400] = "BadRequest";
|
|
5
|
+
HttpStatus[HttpStatus["Unauthorized"] = 401] = "Unauthorized";
|
|
6
|
+
HttpStatus[HttpStatus["NotFound"] = 404] = "NotFound";
|
|
7
|
+
HttpStatus[HttpStatus["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
8
|
+
HttpStatus[HttpStatus["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
9
|
+
HttpStatus[HttpStatus["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
10
|
+
HttpStatus[HttpStatus["InternalServerError"] = 500] = "InternalServerError";
|
|
11
|
+
HttpStatus[HttpStatus["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
12
|
+
})(HttpStatus || (HttpStatus = {}));
|
|
13
|
+
export var JsonRpcErrorCode;
|
|
14
|
+
(function (JsonRpcErrorCode) {
|
|
15
|
+
JsonRpcErrorCode[JsonRpcErrorCode["ServerError"] = -32000] = "ServerError";
|
|
16
|
+
JsonRpcErrorCode[JsonRpcErrorCode["SessionNotFound"] = -32001] = "SessionNotFound";
|
|
17
|
+
JsonRpcErrorCode[JsonRpcErrorCode["InternalError"] = -32603] = "InternalError";
|
|
18
|
+
JsonRpcErrorCode[JsonRpcErrorCode["ParseError"] = -32700] = "ParseError";
|
|
19
|
+
})(JsonRpcErrorCode || (JsonRpcErrorCode = {}));
|
|
20
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/http/status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAUX;AAVD,WAAY,UAAU;IACpB,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,6DAAkB,CAAA;IAClB,qDAAc,CAAA;IACd,qEAAsB,CAAA;IACtB,mEAAqB,CAAA;IACrB,6EAA0B,CAAA;IAC1B,2EAAyB,CAAA;IACzB,yEAAwB,CAAA;AAC1B,CAAC,EAVW,UAAU,KAAV,UAAU,QAUrB;AAED,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,0EAAoB,CAAA;IACpB,kFAAwB,CAAA;IACxB,8EAAsB,CAAA;IACtB,wEAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B"}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
4
4
|
import { type Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import { type BridgeRuntime } from './bridge/config.js';
|
|
5
|
+
import { type BridgeRuntime, type PrepareBridgeRuntimeOptions } from './bridge/config.js';
|
|
6
6
|
export interface StartBridgeOptions {
|
|
7
7
|
serverInfo?: Partial<Implementation>;
|
|
8
|
+
runtimeOptions?: Pick<PrepareBridgeRuntimeOptions, 'browserIsolated'>;
|
|
8
9
|
}
|
|
9
10
|
export interface BridgeServerOptions extends StartBridgeOptions {
|
|
10
11
|
runtime?: BridgeRuntime;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,2BAA2B,EACjC,MAAM,oBAAoB,CAAC;AAK5B,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACrC,cAAc,CAAC,EAAE,IAAI,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC,CAIzF;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,CAwCjG"}
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
|
|
|
3
3
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
5
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import { prepareBridgeRuntime } from './bridge/config.js';
|
|
6
|
+
import { prepareBridgeRuntime, } from './bridge/config.js';
|
|
7
7
|
import { resolvePlaywrightMcpCliPath } from './bridge/paths.js';
|
|
8
8
|
import { callLocalTool, createLocalTools, isLocalTool } from './bridge/tools.js';
|
|
9
9
|
import { MCP_SERVER_INSTRUCTIONS, PROJECT_METADATA } from './project/metadata.js';
|
|
@@ -13,7 +13,7 @@ export async function startBridge(options = {}) {
|
|
|
13
13
|
return bridge;
|
|
14
14
|
}
|
|
15
15
|
export async function createBridgeServer(options = {}) {
|
|
16
|
-
const runtime = options.runtime ?? (await prepareBridgeRuntime());
|
|
16
|
+
const runtime = options.runtime ?? (await prepareBridgeRuntime(options.runtimeOptions));
|
|
17
17
|
const upstreamClient = options.upstreamClient ?? (await connectUpstream(runtime));
|
|
18
18
|
const localTools = createLocalTools();
|
|
19
19
|
const upstreamToolCache = new Map();
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EACL,qBAAqB,EAKrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EACL,qBAAqB,EAKrB,sBAAsB,GACvB,M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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloakbrowser-mcp",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Playwright MCP bridge that runs upstream browser tools with CloakBrowser.",
|
|
5
5
|
"mcpName": "io.github.swimmwatch/cloakbrowser-mcp",
|
|
6
6
|
"type": "module",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"format:check": "prettier --check .",
|
|
45
45
|
"docs:install": "python3 -m venv .venv-docs && .venv-docs/bin/pip install -r docs/requirements.txt",
|
|
46
46
|
"docs:assets": "node scripts/generate-brand-assets.mjs",
|
|
47
|
+
"docs:cli": "tsx scripts/generate-cli-docs.ts",
|
|
47
48
|
"docs:serve": ".venv-docs/bin/mkdocs serve",
|
|
48
49
|
"docs:build": ".venv-docs/bin/mkdocs build --strict",
|
|
49
50
|
"docs:seo:validate": "node scripts/validate-docs-seo.mjs",
|
|
@@ -61,12 +62,13 @@
|
|
|
61
62
|
"dependencies": {
|
|
62
63
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
63
64
|
"@playwright/mcp": "^0.0.75",
|
|
64
|
-
"cloakbrowser": "^0.3.30"
|
|
65
|
+
"cloakbrowser": "^0.3.30",
|
|
66
|
+
"commander": "^14.0.3"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
69
|
"@eslint/js": "^9.13.0",
|
|
68
70
|
"@types/node": "^20.14.0",
|
|
69
|
-
"@vitest/coverage-v8": "^2.
|
|
71
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
70
72
|
"ajv": "^8.17.1",
|
|
71
73
|
"ajv-formats": "^3.0.1",
|
|
72
74
|
"eslint": "^9.13.0",
|
|
@@ -75,7 +77,10 @@
|
|
|
75
77
|
"tsx": "^4.19.0",
|
|
76
78
|
"typescript": "^5.5.4",
|
|
77
79
|
"typescript-eslint": "^8.11.0",
|
|
78
|
-
"vitest": "^2.
|
|
80
|
+
"vitest": "^3.2.4"
|
|
81
|
+
},
|
|
82
|
+
"overrides": {
|
|
83
|
+
"vite": "6.4.2"
|
|
79
84
|
},
|
|
80
85
|
"keywords": [
|
|
81
86
|
"mcp",
|