Skip to content

server/discover returns -32601 Method not found, so every modern MCP SDK connect logs an error #2433

Closed

Description

@xxww0098

Version

codebase-memory-mcp 0.11.0

Platform

macOS (Apple Silicon)

Install channel

GitHub release archive / install.sh

Binary variant

ui

What happened, and what did you expect?

The current official MCP SDK client uses server/discover as its default connect probe (see @modelcontextprotocol/client, connect mode auto: it sends server/discover, and falls back to the 2025-era initialize handshake only if the probe fails). Against CBM 0.11.0 that probe is answered with -32601 Method not found on every connection, and the daemon records it as an error.

From ~/.cache/codebase-memory-mcp/logs/cbm-daemon.log:

level=warn msg=mcp.request protocol=jsonrpc method=server/discover status=error duration_ms=0

45 occurrences in the log; server/discover is the only method that ever reports status=error (every initialize, tools/list, prompts/list etc. is status=ok).

Impact:

  • Every modern-SDK connect produces a spurious error/warn line in the daemon log.
  • No modern (2026-07-28) revision is ever advertised, so clients cannot use the modern revision even when they ask for it — the server silently negotiates down to 2025-11-25.

Expected: implement server/discover (returning supportedVersions, capabilities, instructions, plus cache hints) as required for protocol revision 2026-07-28; or, if the modern revision is intentionally unsupported, don't log the expected fallback probe as an error.

This is not the same as #1813: there the server exited / never answered in the test container. Here the server answers promptly with a well-formed JSON-RPC error while tools/list works normally.

Reproduction

  1. Start the MCP server on stdio: codebase-memory-mcp
  2. initialize, claiming the modern revision (the server negotiates down to 2025-11-25):
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2026-07-28","capabilities":{},"clientInfo":{"name":"probe","version":"1"}}}

Result:

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"codebase-memory-mcp","version":"0.11.0"},"capabilities":{"tools":{"listChanged":false},"prompts":{"listChanged":false}},"instructions":"..."}}
  1. server/discover:
{"jsonrpc":"2.0","id":2,"method":"server/discover","params":{}}

Result:

{"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Method not found"}}

Expected: a DiscoverResult (supportedVersions + capabilities), since the official client uses this as its connect probe.

  1. Sanity check — the same session's tools/list succeeds, so the transport/handshake is fine:
{"jsonrpc":"2.0","id":3,"method":"tools/list","params":{}}

→ returns the 15 tools.

The same -32601 is returned when initialize is sent at 2025-06-18 or 2025-11-25; the client always probes server/discover first.

Logs

level=info  msg=mcp.request protocol=jsonrpc method=initialize    status=ok duration_ms=0
level=info  msg=mcp.request protocol=jsonrpc method=tools/list    status=ok duration_ms=0
level=info  msg=mcp.request protocol=jsonrpc method=prompts/list  status=ok duration_ms=0
level=warn  msg=mcp.request protocol=jsonrpc method=server/discover status=error duration_ms=0

Only server/discover errors; cbm-daemon.log contains zero level=error/panic/fatal lines, i.e. this is the sole recurring error surface.

Confirmations

Activity

  1. added
    questionFurther information is requested
    priority/normalStandard review queue; useful PR with ordinary maintainer urgency.
    on Oct 1, 2026
  2. Zhuoxi2000 commented on Oct 6, 2026

    @Zhuoxi2000
    Contributor

    Drafted with an AI coding assistant (Claude). Line numbers are at main 268a9d8.

    Read against the 2026-07-28 versioning page (https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning), the -32601 reply looks correct for the server as it is today, and only the log line looks wrong.

    Why the reply itself is correct

    • The page calls 2025-11-25 and earlier "legacy" versions. SUPPORTED_PROTOCOL_VERSIONS (src/mcp/mcp.c:1382) stops at 2025-11-25, so CBM is a legacy server. The "Servers MUST implement server/discover" requirement sits in the Protocol Version Negotiation section, which describes the modern per-request _meta versioning.
    • The compatibility matrix row for a dual-era client and a legacy server says: "Works. stdio: the probe returns a non-modern error or times out, and the client falls back to initialize." That is the sequence in the report: discover gets -32601, then initialize and tools/list succeed.
    • Returning a DiscoverResult on its own would probably make things worse. Per the row for a dual-era client and a modern server, the client then "stays modern". From that point it sends requests with per-request _meta and no initialize, and expects stateless serving and -32022 UnsupportedProtocolVersionError for version mismatches. A server that answers discover but still requires initialize would break the fallback that currently works.

    The part that does look like a defect

    The method-not-found branch (src/mcp/mcp.c, around line 18684) calls cbm_log_mcp_request(req.method, NULL, true, ...). cbm_log_mcp_request (src/foundation/log.c:365) maps is_error to level=warn ... status=error. Every modern-SDK connect therefore leaves one warn line in cbm-daemon.log, even though the probe outcome is the expected one. The branch does not touch cbm_diag_record_query, so only the log is affected, not the query counters.

    Two possible directions

    1. Log-only. Recognise server/discover as an expected connect probe, in the same spirit as the Cline connection throws status=error on resource and prompt template discovery queries #958 handling of resources/list. Keep the -32601 reply unchanged, but log it as info/ok (or a distinct status) instead of warn/error. Add a test in tests/test_mcp.c next to server_handle_unknown_method, using the existing mcp_capture_log sink to check that the warn line is not emitted. Other unknown methods would keep logging at warn. This is small. Open PR fix(mcp): report request timing and transport failures #2372 changes the cbm_log_mcp_request signature and touches the same branch, so I would rebase onto it if it lands first.
    2. Full dual-era 2026-07-28 support. This is a much larger change. It overlaps MCP spec conformance: 10 requirement(s) violated (via @hasmcp/mcp-spec-test) — spec 2026-07-28 #1813 and MCP spec conformance: 5 requirement(s) violated (via @hasmcp/mcp-spec-test) — spec 2025-11-25 #1814 and needs your design call.

    Which of these, if either, would you like? If it is (1), should the discover probe be logged at info with status=ok, or with its own status such as status=legacy_probe, so it can still be grepped? I'm happy to open a focused PR with a regression test for (1) once you say which one you want.

  3. mvanhorn commented on Oct 6, 2026

    @mvanhorn
    Contributor

    The method-not-found path in cbm_mcp_server_handle always called cbm_log_mcp_request with the error argument set to true, which is written as level=warn and status=error. server/discover is not implemented, so the modern connect probe takes that path and gets the same log treatment as any other unknown method.

    That call now passes false for the error argument when the method is server/discover and true for every other unknown method, so the probe is logged as level=info with status=ok while other misses stay level=warn and status=error.

  4. DeusData commented on Oct 19, 2026

    @DeusData
    Owner

    Thank you for the follow-up analysis and the distinction between legacy fallback logging and full modern protocol support. I have read the report of a log-only change, but have not verified its landing or release status. The broader protocol direction remains a separate maintainer decision.

  5. DeusData commented on Oct 20, 2026

    @DeusData
    Owner

    Fixed on main by 9c89041 (PR #2556, thanks to @mvanhorn): the server/discover connect probe is now logged at level=info with status=ok, and the reply stays -32601 Method not found so current MCP clients fall back to initialize as before. Other unknown methods still log as warnings.

    Thank you @xxww0098 for the precise report with log excerpts and a runnable reproduction, and @Zhuoxi2000 for reading the 2026-07-28 versioning rules against the code. Support for the 2026-07-28 protocol revision itself is a separate question and is not part of this change.

  6. added a commit that references this issue on Oct 20, 2026
    6bc7ade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/normalStandard review queue; useful PR with ordinary maintainer urgency.questionFurther information is requestedux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions