@@ -3,7 +3,6 @@ import { Data, Effect, Schema } from "effect";
33
44import {
55 FORWARD_TOKEN_TTL_SECONDS,
6- PASSTHROUGH_MOVED_MESSAGE,
76 TOOLKIT_NOT_FOUND_MESSAGE,
87 buildV2Url,
98 forwardHeaders,
@@ -123,6 +122,7 @@ describe("v2 URL", () => {
123122
124123 it("drops every other v1 parameter", () => {
125124 expect(url("?search_tools=true&artifacts=false&mode=codemode&x=1")).toBe(`${ORIGIN}/mcp`);
125+ expect(url("?mode=passthrough")).toBe(`${ORIGIN}/mcp`);
126126 });
127127
128128 it("adds the connection for a toolkit URL", () => {
@@ -299,7 +299,7 @@ describe("forwardToV2", () => {
299299 expect(seen).toHaveLength(0);
300300 });
301301
302- it("refuses passthrough mode without calling v2", async () => {
302+ it("forwards a passthrough- mode request to v2 without the mode ", async () => {
303303 const { env, seen } = makeEnv(() => new Response("ok"));
304304 const response = await forwardToV2(
305305 new Request("https://executor.sh/mcp?mode=passthrough", { method: "POST", body: "{}" }),
@@ -308,11 +308,27 @@ describe("forwardToV2", () => {
308308 env,
309309 makeDeps(),
310310 );
311- expect(response.status).toBe(400);
312- expect(((await response.json()) as { error: { message: string } }).error.message).toBe(
313- PASSTHROUGH_MOVED_MESSAGE,
311+ expect(response.status).toBe(200);
312+ expect(seen).toHaveLength(1);
313+ expect(seen[0]?.url).toBe(`${ORIGIN}/mcp`);
314+ });
315+
316+ it("forwards a passthrough-mode toolkit request to its connection", async () => {
317+ const { env, seen } = makeEnv(() => new Response("ok"));
318+ const response = await forwardToV2(
319+ new Request("https://executor.sh/mcp/toolkits/deploy?mode=passthrough", {
320+ method: "POST",
321+ body: "{}",
322+ }),
323+ principal,
324+ moved,
325+ env,
326+ makeDeps({ deploy: "tk_row_example" }),
327+ );
328+ expect(response.status).toBe(200);
329+ expect(seen[0]?.url).toBe(
330+ `${ORIGIN}/mcp?connection=v1-59b67fa9ffe6d72010b3b9fa56f5bdb38199f2e1`,
314331 );
315- expect(seen).toHaveLength(0);
316332 });
317333
318334 it("answers a retryable 503 when v2 answers 401", async () => {
0 commit comments