{"record":{"id":"bc80af6e9fd2abd9","repo":"different-ai/openwork","slug":"mcp-endpoint-returned-http-methodresponse-status","errorCode":null,"errorMessage":"MCP endpoint returned HTTP ${methodResponse.status} to GET","messagePattern":"MCP endpoint returned HTTP (.+?) to GET","errorType":"exception","errorClass":"ProbeFailure","httpStatus":null,"severity":"error","filePath":"packages/enterprise-mcp-mock-server/src/testing/probe.ts","lineNumber":491,"sourceCode":"          headers: { \"content-type\": \"application/x-www-form-urlencoded\" },\n          body: new URLSearchParams({\n            token: refreshToken,\n            client_id: revocationClientId,\n            ...(revocationClientSecret ? { client_secret: revocationClientSecret } : {}),\n          }),\n        }, \"SHUTDOWN\", cleanupDeadline)\n        await discardResponseBody(revocationResponse, \"SHUTDOWN\", \"oauth_token\")\n      } catch {\n        // Cleanup never replaces the primary diagnostic failure.\n      }\n    }\n  }\n  try {\n    let startedAt = Date.now()\n    if (activeFault?.effect === \"method-405\") {\n      const methodResponse = await fetchStep(mcpUrl, { method: \"GET\" }, \"HTTP_ROUTING\", overallDeadline)\n      await discardResponseBody(methodResponse, \"HTTP_ROUTING\", \"mcp_method_405\")\n      throw new ProbeFailure(\n        \"HTTP_ROUTING\",\n        methodResponse.status === 405 ? \"mcp_method_405\" : \"http_failure\",\n        `MCP endpoint returned HTTP ${methodResponse.status} to GET`,\n      )\n    }\n    const challengeResponse = await fetchStep(\n      mcpUrl,\n      {\n        method: \"POST\",\n        headers: {\n          accept: \"application/json, text/event-stream\",\n          \"content-type\": \"application/json\",\n          origin: baseUrl.origin,\n        },\n        body: JSON.stringify({\n          jsonrpc: \"2.0\",\n          id: 0,\n          method: \"initialize\",","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/enterprise-mcp-mock-server/src/testing/probe.ts#L473-L509","documentation":"This branch runs when the scenario activates the method-405 fault: the probe sends a bare GET to the MCP endpoint to verify the server correctly rejects the unsupported method. If the response status is not 405, the probe fails with an http_failure ProbeFailure in phase HTTP_ROUTING instead of the intended mcp_method_405 subcode.","triggerScenarios":"Scenario includes activeFault with id effecting \"method-405\", and the server's GET on the MCP endpoint returns 200, 401, 404, or any status other than 405.","commonSituations":"Mock/fixture server not wired to emulate the 405 fault, a proxy answering GET before it reaches the MCP handler, or routing that serves a page/JSON on GET instead of rejecting the method.","solutions":["Ensure the MCP endpoint returns HTTP 405 Method Not Allowed for GET when the method-405 fault is active.","Verify the fault definition is registered/enabled in the scenario (correct fault id in activeFault).","Check that no reverse proxy or middleware short-circuits GET requests before the MCP handler.","Inspect the actual status in the message to decide whether the route exists at all (404) or auth intercepted it (401)."],"exampleFix":"// before\napp.get(endpointPath, handler)\n// after\napp.get(endpointPath, (req, res) => res.status(405).set(\"allow\", \"POST, DELETE\").end())","handlingStrategy":"validation","validationCode":"const res = await fetch(`${baseUrl}${endpointPath}`, { method: \"GET\" })\nif (res.status !== 405) throw new Error(`Expected 405 on GET ${endpointPath}, got ${res.status}`)","typeGuard":null,"tryCatchPattern":"try {\n  await probeEnterpriseMcpMockServer({ baseUrl, scenario })\n} catch (e) {\n  if (e instanceof ProbeFailure && e.phase === \"HTTP_ROUTING\") {\n    console.error(\"MCP endpoint method routing broken:\", e.message)\n  } else throw e\n}","preventionTips":["Keep an explicit GET handler on the MCP route that returns 405 with an Allow header","Exclude the MCP path from catch-all UI/SPA routing and redirects","Smoke-test method routing (GET should 405) whenever endpoint paths change"],"tags":["http","mcp","routing","fault-injection"],"backgroundTag":"unexpected-http-status-code","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}