Skip to content

bug: checkDewey doctor check uses HTTP GET against POST-only MCP endpoint #16

@yvonnedevlinrh

Description

@yvonnedevlinrh

Summary

checkDewey() in internal/doctor/checks.go performs an HTTP GET to the Dewey MCP endpoint (http://localhost:3333/mcp/). The MCP Streamable HTTP transport only accepts POST for JSON-RPC calls; a plain GET without SSE headers returns a non-200 status. This causes the doctor check to report a spurious warning ("Dewey returned HTTP 405") even when Dewey is healthy and running.

To Reproduce

  1. Start Dewey with HTTP transport: dewey --http :3333
  2. Run replicator doctor
  3. Observe the Dewey check returns warn with Dewey returned HTTP 400 at http://localhost:3333/mcp/ (1ms)
  4. Verify Dewey is healthy independently: send a JSON-RPC POST to http://localhost:3333/mcp/ and confirm it returns success

Expected behavior

When Dewey is running and healthy, the doctor check should report pass with "Dewey is reachable."

Root Cause

checkDewey() (internal/doctor/checks.go:98) uses client.Get(deweyURL). The Dewey MCP endpoint is served by the Go SDK's StreamableHTTPHandler, which routes by HTTP method: POST for JSON-RPC, GET for SSE session establishment, DELETE for session termination. A plain GET without the required Accept: text/event-stream header is not treated as a successful health probe.

Suggested Fix

The replicator already has a proper JSON-RPC health call in internal/memory/proxy.go:102-106:

func (c *Client) Health() error {
    _, err := c.Call("dewey_health", map[string]any{})
    return err
}

This method is not used by the doctor check.

Replace the raw HTTP GET in checkDewey() with a call to memory.NewClient(deweyURL).Health(), which sends a proper JSON-RPC POST to the dewey_health method. Update tests to use a JSON-RPC mock server instead of a simple HTTP handler.

Location

  • Health check: internal/doctor/checks.go:94-126
  • Existing JSON-RPC health call: internal/memory/proxy.go:102-106
  • Dewey URL default: internal/config/config.go:27 (http://localhost:3333/mcp/)
  • Tests: internal/doctor/checks_test.go:93-122

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions