fix(httpapi): return mcp server not found errors (#28817)

This commit is contained in:
Shoubhit Dash
2026-05-22 17:46:30 +05:30
committed by GitHub
parent 51da3483a9
commit 0beb4de3e8
8 changed files with 158 additions and 72 deletions

View File

@@ -192,4 +192,36 @@ describe("mcp HttpApi", () => {
},
},
)
it.instance(
"returns typed not found errors for missing MCP servers",
() =>
Effect.gen(function* () {
const tmp = yield* TestInstance
const handler = yield* handlerScoped
for (const input of [
{ method: "POST", route: "/mcp/missing/auth" },
{ method: "POST", route: "/mcp/missing/auth/authenticate" },
{ method: "POST", route: "/mcp/missing/auth/callback", body: JSON.stringify({ code: "code" }) },
{ method: "DELETE", route: "/mcp/missing/auth" },
{ method: "POST", route: "/mcp/missing/connect" },
{ method: "POST", route: "/mcp/missing/disconnect" },
]) {
const response = yield* request(handler, input.route, tmp.directory, {
method: input.method,
headers: input.body ? { "content-type": "application/json" } : undefined,
body: input.body,
})
expect(response.status).toBe(404)
expect(yield* json(response)).toEqual({
_tag: "McpServerNotFoundError",
name: "missing",
message: "MCP server not found: missing",
})
}
}),
{ config: { mcp: {} } },
)
})