Skip to content

Commit 7f200b4

Browse files
committed
Verify toolkit session isolation across resources and methods
1 parent 69cfc5d commit 7f200b4

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎apps/host-cloudflare/src/worker.e2e.node.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,31 @@ describe("cloudflare host e2e (workerd/miniflare)", () => {
371371
method: "tools/list",
372372
});
373373
expect(reusedOnDefault.status).toBe(403);
374+
375+
const reusedOnOtherToolkit = await rpc(`${toolkitPath}-other`, sessionId, {
376+
jsonrpc: "2.0",
377+
id: 4,
378+
method: "tools/list",
379+
});
380+
expect(reusedOnOtherToolkit.status).toBe(403);
381+
for (const method of ["GET", "DELETE"]) {
382+
const response = await worker.fetch("/mcp", {
383+
method,
384+
headers: { accept, "mcp-session-id": sessionId! },
385+
});
386+
expect(response.status).toBe(403);
387+
}
388+
const stillUsable = await rpc(toolkitPath, sessionId, {
389+
jsonrpc: "2.0",
390+
id: 5,
391+
method: "tools/list",
392+
});
393+
expect(stillUsable.status).toBe(200);
394+
const deleted = await worker.fetch(toolkitPath, {
395+
method: "DELETE",
396+
headers: { accept, "mcp-session-id": sessionId! },
397+
});
398+
expect(deleted.status).toBe(204);
374399
}, 60_000);
375400

376401
it("serves streamable HTTP GET only for initialized sessions", async () => {

0 commit comments

Comments
 (0)