Skip to content

Update the MCP Go SDK to v1.7.0 and serve the 2026-07-28 protocol revision - #871

Open
yuzi-co wants to merge 2 commits into
sipeed:mainfrom
yuzi-co:feat/mcp-protocol-2026-07-28
Open

Update the MCP Go SDK to v1.7.0 and serve the 2026-07-28 protocol revision#871
yuzi-co wants to merge 2 commits into
sipeed:mainfrom
yuzi-co:feat/mcp-protocol-2026-07-28

Conversation

@yuzi-co

@yuzi-co yuzi-co commented Aug 10, 2026

Copy link
Copy Markdown

What this does

Updates github.com/modelcontextprotocol/go-sdk from v1.6.1 to v1.7.0, which
adds the 2026-07-28 protocol revision. The MCP handler needs no change to
serve it: the streamable HTTP transport offers that revision to a stateless
handler, and NewMCPHandler already sets Stateless: true. Older clients keep
working — the SDK negotiates the highest revision both sides support.

Behaviour changes that come with the SDK

Both follow the spec, and both apply because the handler is stateless.

  1. Sessions. A stateless server no longer issues or reads Mcp-Session-Id,
    and it answers DELETE with 405 rather than 204. A client that still
    sends the header is answered without it rather than rejected.
    MCPGODEBUG=allowsessionsinstateless=1 restores the old handling.
  2. Oversized bodies. A body over the existing 1MiB cap now returns 413
    with request body exceeds N bytes, instead of a generic read error. The cap
    itself is unchanged; the SDK just reports it with the right status.

Tests

TestMCPInitializeAndToolsList is adapted to the two changes above.

TestMCPHandlerServesLatestProtocol is new. It drives the endpoint the way a
2026-07-28 client does — server/discover instead of the initialize
handshake, per-request _meta for the client identity, and the Mcp-Method
and Mcp-Name headers the revision requires — then calls a tool and checks the
recorded HID write, so the tools are exercised under the revision rather than
merely listed by it. A second request confirms the older revisions still reach
the same endpoint and still have no server/discover.

The test asserts that 2026-07-28 is the first entry of
supportedVersions, which the SDK orders newest first. A future SDK that adds
a revision therefore fails this test on purpose, so the new revision gets a
deliberate review before the server starts offering it.

Verification

go vet -tags novision ./...          clean
go test -tags novision ./...         all packages pass
go test -race ./service/mcp/...      pass
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build ./...   clean
gofmt -l .                           empty

The novision tag is a downstream build tag, so on this branch it only covers
service/mcp/...; those packages pass. The remaining packages were verified
with the tag available.

Not touched: service/picoclaw keeps its own hand-rolled JSON-RPC endpoint at
protocol version 2024-11-05. It does not use this SDK.

@yuzi-co
yuzi-co force-pushed the feat/mcp-protocol-2026-07-28 branch from af946f2 to 461f4f2 Compare August 10, 2026 10:53
The release brings the 2026-07-28 protocol revision, and it changes two
behaviours that the existing tests pinned. Both come from the spec, and both
apply to this handler because it is stateless.

A stateless server no longer issues or reads Mcp-Session-Id, and it answers
DELETE with 405 rather than 204. Existing clients keep working: they negotiate
the revision they know, and the session header they send is ignored instead of
rejected. MCPGODEBUG=allowsessionsinstateless=1 restores the old handling for a
client that cannot do without it.

An oversized body now returns 413 with "request body exceeds N bytes". The
handler already capped the body at 1MiB with http.MaxBytesHandler. The SDK
turns that cap into the status the case deserves instead of a generic read
error, so the test asserts the status and the limit that produced it.
The streamable HTTP transport offers the 2026-07-28 revision only to a
stateless handler. A stateful one negotiates down to 2025-11-25, and the
revision becomes unreachable without any build or test failing. The handler
sets Stateless, so the revision is live today, and nothing recorded that.

TestMCPHandlerServesLatestProtocol probes the server the way a 2026-07-28
client does: server/discover in place of the initialize handshake, per-request
_meta that carries the client identity, and the Mcp-Method and Mcp-Name headers
that the revision makes mandatory. It then calls a tool and reads the recorded
HID write, which shows that the tools work under the revision rather than only
being listed by it.

The test asserts that 2026-07-28 is the first entry of supportedVersions, which
the SDK orders newest first. A later SDK that adds a revision therefore fails
this test on purpose: the new revision needs the same deliberate check before
the server starts speaking it. A second request proves the older revisions
still reach the same endpoint and still have no server/discover.
@yuzi-co
yuzi-co force-pushed the feat/mcp-protocol-2026-07-28 branch from 461f4f2 to 98e7515 Compare August 13, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant