different-ai/openwork · error · ProbeFailure

MCP endpoint returned HTTP ${methodResponse.status} to GET

Error message

MCP endpoint returned HTTP ${methodResponse.status} to GET

What it means

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.

Source

Thrown at packages/enterprise-mcp-mock-server/src/testing/probe.ts:491

          headers: { "content-type": "application/x-www-form-urlencoded" },
          body: new URLSearchParams({
            token: refreshToken,
            client_id: revocationClientId,
            ...(revocationClientSecret ? { client_secret: revocationClientSecret } : {}),
          }),
        }, "SHUTDOWN", cleanupDeadline)
        await discardResponseBody(revocationResponse, "SHUTDOWN", "oauth_token")
      } catch {
        // Cleanup never replaces the primary diagnostic failure.
      }
    }
  }
  try {
    let startedAt = Date.now()
    if (activeFault?.effect === "method-405") {
      const methodResponse = await fetchStep(mcpUrl, { method: "GET" }, "HTTP_ROUTING", overallDeadline)
      await discardResponseBody(methodResponse, "HTTP_ROUTING", "mcp_method_405")
      throw new ProbeFailure(
        "HTTP_ROUTING",
        methodResponse.status === 405 ? "mcp_method_405" : "http_failure",
        `MCP endpoint returned HTTP ${methodResponse.status} to GET`,
      )
    }
    const challengeResponse = await fetchStep(
      mcpUrl,
      {
        method: "POST",
        headers: {
          accept: "application/json, text/event-stream",
          "content-type": "application/json",
          origin: baseUrl.origin,
        },
        body: JSON.stringify({
          jsonrpc: "2.0",
          id: 0,
          method: "initialize",

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Ensure the MCP endpoint returns HTTP 405 Method Not Allowed for GET when the method-405 fault is active.
  2. Verify the fault definition is registered/enabled in the scenario (correct fault id in activeFault).
  3. Check that no reverse proxy or middleware short-circuits GET requests before the MCP handler.
  4. Inspect the actual status in the message to decide whether the route exists at all (404) or auth intercepted it (401).

Example fix

// before
app.get(endpointPath, handler)
// after
app.get(endpointPath, (req, res) => res.status(405).set("allow", "POST, DELETE").end())
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`${baseUrl}${endpointPath}`, { method: "GET" })
if (res.status !== 405) throw new Error(`Expected 405 on GET ${endpointPath}, got ${res.status}`)

Try / catch

try {
  await probeEnterpriseMcpMockServer({ baseUrl, scenario })
} catch (e) {
  if (e instanceof ProbeFailure && e.phase === "HTTP_ROUTING") {
    console.error("MCP endpoint method routing broken:", e.message)
  } else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/bc80af6e9fd2abd9. Report an issue: GitHub.