Repository navigation
Description
Summary
On a fresh stdio connection, server/discover returns supportedVersions: ["2026-07-28"]. If the client then sends initialize on the same stream, the server rejects it with -32022 — including when the client requests exactly the advertised version, 2026-07-28:
data: {"supported": ["2026-07-28"], "requested": "2026-07-28"}
The client cannot recover from that: discovery offers one revision, and the handshake is refused for that same revision. The failure is deterministic and needs no timing, delay, or slow client.
Separately, on a connection where no discovery was sent, initialize at 2026-07-28 is not honored but silently downgraded to 2025-11-25, so the server's actual initialize ceiling and its advertised support disagree.
Environment
basic-memory1.0.0 (latest on PyPI; latest GitHub release)- FastMCP 4.1.3 (
serverInfo.version=4.1.3) - Python 3.12, Linux x86_64, stdio transport, SQLite
- Client that fails: OpenCode v2.4.1 with its default
protocol: "auto"
Reproduction
Two messages to the server's stdin. The _meta envelope is required: without it server/discover returns -32601 Method not found, and with protocolVersion but no clientCapabilities it returns -32602 params._meta is missing the required envelope key(s): io.modelcontextprotocol/clientCapabilities.
import json, subprocess, threading, time
p = subprocess.Popen(["basic-memory", "mcp"], stdin=subprocess.PIPE,
stdout=subprocess.PIPE, text=True, bufsize=1)
got = {}
def reader():
for ln in p.stdout:
if ln.startswith("{"):
m = json.loads(ln)
if "id" in m:
got[m["id"]] = m
threading.Thread(target=reader, daemon=True).start()
def send(obj):
p.stdin.write(json.dumps(obj) + "\n"); p.stdin.flush()
send({"jsonrpc": "2.0", "id": "d", "method": "server/discover", "params": {"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": {}}}})
while "d" not in got: time.sleep(0.1)
print("discover:", got["d"]["result"]["supportedVersions"])
send({"jsonrpc": "2.0", "id": "i", "method": "initialize", "params": {
"protocolVersion": "2026-07-28", "capabilities": {},
"clientInfo": {"name": "probe", "version": "1"}}})
while "i" not in got: time.sleep(0.1)
print("initialize:", json.dumps(got["i"]))Results
| sequence | outcome |
|---|---|
initialize("2026-07-28") only, no discovery |
2025-11-25 (silent downgrade) |
initialize("2025-06-18") only, no discovery |
2025-06-18 |
server/discover, then initialize("2025-11-25") |
-32022 {"supported":["2026-07-28"],"requested":"2025-11-25"} |
server/discover, then initialize("2026-07-28") |
-32022 {"supported":["2026-07-28"],"requested":"2026-07-28"} |
The last row is the interesting one: the requested revision and the advertised revision are identical and the handshake is still refused. Rejection does not depend on the client asking for an older revision.
Impact
OpenCode v2.4.1's default negotiation (protocol: "auto": probe server/discover, commit to the advertised revision) never connects to Basic Memory 1.0.0. Its log:
level=WARN message="mcp transport error" server=basic-memory
error="Received a response for an unknown message ID: ... server-discover-probe-1 ..."
level=WARN message="mcp connect failed" server=basic-memory
status.error="connection is serving the 2026-07-28 protocol; the initialize
handshake is not accepted; the server supports 2026-07-28. Set \"protocol\"
for this server to one of those or to \"legacy\"."
Twelve connect attempts between 2026-11-04 and 2026-11-25, every one failed. The server itself is healthy throughout: bm status reports all files current, and a direct legacy handshake succeeds in about 5 s and lists all 12 bm_* tools.
For reference, server/discover takes 4.3-4.5 s from a cold start on this machine, so clients with a probe timeout near 10 s can also fall back to legacy initialize under load — which lands in the same -32022 path.
Expected
One of these, and either is fine — the current state is what is not:
- If the modern era has no
initialize, reject it with an error that names the correct next step (for example, "use tools/list directly"), so a client can adapt instead of retrying a handshake that can never succeed. - If
initializeremains valid after discovery, accept it at the advertised2026-07-28rather than refusing the revision that discovery just offered.
Related question, which I cannot settle from the client side: after a successful server/discover, is a client expected to send initialize at all? If not, the report is really about the error being unactionable rather than about the rejection itself.
Workaround
Pin the client to the legacy handshake, which negotiates correctly and yields all 12 tools:
"basic-memory": {
"type": "local",
"command": ["/path/to/basic-memory", "mcp"],
"enabled": true,
"protocol": "legacy",
"timeout": 120000
}Related
- Copilot stdio interoperability: delayed modern discovery causes legacy initialize rejection (-32022) #1713 (closed) covers a different trigger of the same
-32022code: a client whose discovery probe times out and then falls back to legacyinitialize. It was closed as client-side. The case here is deterministic and does not involve a timeout — the handshake is refused at the advertised revision after a successful discovery.
Activity