Feature: Upgrade MCP SDK to v1.7.0 and adapt to stateless protocol - #411
Conversation
The 2026-07-28 revision drops session-based architecture. The SDK negotiates the highest mutually supported version, so older clients keep working. Four fixes the bump required: - request.ResponseWriter implements Flush/Unwrap, so the SDK's SSE writes through http.ResponseController actually flush instead of no-opping. Log capture is capped at 64 KiB; SSE streams made it unbounded. - tools/list is marked cacheScope "private" — it is filtered per OAuth scope, and the SDK defaults cacheable results to "public". - cmd/mcp-stdio drops its keepalive goroutine, which duplicated ServerOptions.KeepAlive and wrote id-less errors onto stdout. - server/discover (SEP-2575) bypasses auth, as initialize already does. Also pins MaxRequestBodyBytes to the 10 MB already enforced (the SDK default would tighten it to 4 MiB) and stops advertising the deprecated logging capability, which this server never honoured. Stateless servers no longer echo Mcp-Session-Id and answer DELETE with 405; both are spec-permitted, and MCPGODEBUG=allowsessionsinstateless=1 restores the old behaviour if a client needs it. See cmd/mcp-http/README.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
suggestion (non-blocking): scope the
The last clause holds only for clients on pre- case methodInitialize, methodPing, notificationInitialized, notificationRootsListChanged, methodSetLevel, methodSubscribe, methodUnsubscribe:
if validatedMeta.usesNewProtocol {
ss.server.opts.Logger.Error("method removed in the new protocol", "method", req.Method)
return nil, &jsonrpc.Error{
Code: jsonrpc.CodeMethodNotFound,
Message: fmt.Sprintf("%q is not supported in the new protocol", req.Method),
}
}Nothing breaks today, since clients still negotiate legacy revisions — but Suggested wording:
For what it's worth, the |
Description
The
2026-07-28revision drops session-based architecture. The SDK negotiates the highest mutually supported version, so older clients keep working. Four fixes the bump required:request.ResponseWriterimplements Flush/Unwrap, so the SDK's SSE writes throughhttp.ResponseControlleractually flush instead of no-opping. Log capture is capped at 64 KiB; SSE streams made it unbounded.tools/listis marked cacheScope "private" — it is filtered per OAuth scope, and the SDK defaults cacheable results to "public".cmd/mcp-stdiodrops its keepalive goroutine, which duplicatedServerOptions.KeepAliveand wrote id-less errors onto stdout.Also pins
MaxRequestBodyBytesto the 10 MB already enforced (the SDK default would tighten it to 4 MiB) and stops advertising the deprecated logging capability, which this server never honoured.Stateless servers no longer echo
Mcp-Session-Idand answerDELETEwith405; both are spec-permitted, andMCPGODEBUG=allowsessionsinstateless=1restores the old behaviour if a client needs it. See cmd/mcp-http/README.md.Type of Change
Testing
go test -v ./...)Checklist