fix(httpapi): return mcp server not found errors (#28817)
This commit is contained in:
@@ -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: {} } },
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user