Repository navigation
v1.9.0-pre.1
Pre-releaseIn this release we introduce fixes, hardening, and small API additions on top of v1.8.0. It adds no new protocol revision: 2026-07-28 remains the newest version the SDK negotiates.
Most changes tighten spec compliance (standard JSON-RPC error codes, exact JSON number decoding without float64 rounding, SEP-2243 HTTP headers, MRTR, and OAuth/OIDC validation), bound peer-controlled inputs, and add hooks for stream keep-alives, per-session notifications, and middleware.
Eight new MCPGODEBUG flags let you revert individual behavior changes, and seven flags from v1.7.0 are removed as scheduled; see below.
Hardening
HTTP clients no longer follow cross-origin or method-changing redirects unless the http.Client sets its own CheckRedirect (StreamableClientTransport, SSEClientTransport, and OAuth requests). The stdio frame cap now holds across arbitrary read boundaries, CommandTransport gains MaxLineLength, StreamableClientTransport applies DefaultMaxEventSize when unset, and ParseWWWAuthenticate runs in linear time. On the client, the prompts/list, resources/list, resources/templates/list, and resources/read caches are capped at 512 entries each and no longer retain results with ttlMs <= 0.
- mcp: restrict HTTP client redirects to same origin to prevent cross-origin redirect by @guglielmo-san (#1440)
- mcp: make the ioConn frame cap independent of read boundaries by @Tangerg (#1510)
- fix(mcp): default maxEventSize not used by @yarolegovich (#1457)
- mcp: add MaxLineLength to CommandTransport by @beatcracker (#1333)
- oauthex: parse WWW-Authenticate in linear time by @jyotir-aditya (#1456)
- mcp: cap the client caches and stop retaining uncacheable results by @Assertive-xxh (#1527)
- mcp: reject unencoded non-ASCII characters in Mcp-Param headers by @luiacuaniello (#1521)
- mcp: restrict x-mcp-header annotations to properties reachable via properties keys alone by @guglielmo-san (#1515)
- fix(mcp): disabled client capabilities exposing roots by @yarolegovich (#1460)
- internal/util: match "localhost" case-insensitively in IsLoopback by @akshita317 (#1316)
Streams, per-session notifications, and middleware APIs
StreamableHTTPOptions.StreamKeepAlive sends periodic SSE comments on idle POST response streams (30s by default; negative disables) so proxies do not drop subscriptions/listen or slow calls.
ServerSession.NotifyToolListChanged, NotifyPromptListChanged, NotifyResourceListChanged, and NotifyResourceUpdated notify a single 2026-07-28 session's open subscriptions/listen streams.
StreamableHTTPOptions.OnRequestSummary, HasParams, and Request.GetID (ClientRequest.ID / ServerRequest.ID) expose request metadata to middleware and observability hooks.
ClientSession.Discover, ParseURLElicitationRequiredError, and Annotations.SetPriority / HasPriority (to serialize an explicit 0 priority).
- mcp: add StreamableHTTPOptions.StreamKeepAlive for periodic SSE comments on idle streams by @yhxlele (#1232)
- mcp: enable stream keep-alive for general POST requests by @guglielmo-san (#1477)
- mcp: add per session list changed notifications by @nahapetyan-serob (#1511)
- mcp: add ServerSession.NotifyResourceUpdated by @nahapetyan-serob (#1524)
- mcp: expose streamable HTTP request summaries by @CaliLuke (#1101)
- mcp: add HasParams so middleware can tell whether params are present by @jmrplens (#1269)
- mcp: expose the JSON-RPC request id to receiving middleware by @xianshujun (#1464)
- mcp: export cs.Discover for server/discover by @guglielmo-san (#1428)
- mcp: add ParseURLElicitationRequiredError by @QuentinBisson (#1495)
- mcp: add explicit priority handling to Annotations to support serializing a value of zero by @guglielmo-san (#1320)
Behavior changes guarded by MCPGODEBUG
The new flags below revert the corresponding change (except demotesessionlifecyclelog, which is opt-in). All will be removed in v1.11.0; see docs/mcpgodebug.md for details.
structuredcontentfloat64=1— decode numbers inCallToolResult.StructuredContentasfloat64instead ofjson.Number(#1239).disablepromptargsvalidation=1— call the prompt handler even when a required argument is missing instead of returning-32602(#1297).allowmissingclientparams=1— acceptelicitation/create,notifications/elicitation/complete, andnotifications/resources/updatedwith missing ornullparams (#1315).nopreinitinvalidrequest=1— refuse pre-initializerequests on legacy sessions with code0instead of-32600(#1393).nointernalerrorcode=1— send handler errors carrying no code with code0instead of-32603(#1407).fatalnewprotocolerrors=1— fail the streamable client connection when an independent2026-07-28request fails (#1353).followallredirects=1— follow cross-origin and method-changing HTTP redirects (#1440).demotesessionlifecyclelog=1(opt-in) — emit per-session lifecycle logs at debug level instead of info (#1208).
Options below were removed, according to plan:
customresnotfounderrcodehintomitemptyallowsessionsinstatelessnomethodnotfoundcodeinerrornoprotocolerrorbodynowrapinvalidparamsdisablecompleteparamsvalidation
The removal of plaintextstatefulrejection and blockingcancelnotify, added in v1.8.0, was postponed to v1.10.0.
Other Changes to the SDK
Spec compliance, JSON numbers, and SEP-2243 headers:
- mcp: preserve structured content number precision by @CaliLuke (#1239)
- mcp: preserve number precision during schema validation by @guglielmo-san (#1462)
- fix: support exact JSON number decoding for large request IDs above 2^53 by @guglielmo-san (#1401)
- mcp: preserve explicit null structured content across transport by @Tangerg (#1285)
- mcp: omit structured output from error results by @Ilyuha888 (#1397)
- internal/json: decode in place instead of through a streaming Decoder by @raveesh-me (#1454)
- mcp: reject prompts/get requests missing a required argument by @po-et (#1297)
- mcp: reject server messages missing required params on the client by @fadiroot (#1315)
- mcp: answer a request sent before initialize with Invalid Request by @talhayme (#1393)
- mcp: refuse a call on a legacy session before initialize by @jmrplens (#1273)
- mcp: send handler errors that carry no code as Internal error by @talhayme (#1407)
- internal/jsonrpc2: send error response when result fails to marshal by @beiryu (#1400)
- mcp: report an error when a sampling or elicitation handler returns nil by @po-et (#1304)
- mcp: send an empty result, not null, for a nil tool, prompt or completion result by @po-et (#1301)
- mcp: send empty arrays for completions and prompts with nothing to return by @po-et (#1290)
- mcp: preserve required text field when marshaling empty ResourceContents by @shoemoney (#1149)
- mcp: marshal ResourceNotFoundError data as JSON by @kerthans (#1427)
- mcp: label resultType on results that bypass the dispatcher by @roncodingenthusiast (#1226)
- mcp: reject null entries in InputRequests during unmarshaling by @guglielmo-san (#1398)
- mcp: reject null titled enum entries in elicitation schemas by @jyotir-aditya (#1447)
- mcp: accept titled multi-select items that declare type string by @jyotir-aditya (#1312)
- mcp: apply defaults to null tool arguments by @pkarpovich (#1343)
- mcp: reject legacy-format requests on 2026-only servers by @Enigmage (#1345)
- mcp: fail Ping fast on 2026-07-28 sessions by @azilber (#1378)
- mcp: do not require Mcp-Method on notifications by @toledompm (#1504)
- mcp: accept empty Mcp-Param-* and Mcp-Name header values by @po-et (#1289)
- mcp: decode a Base64-wrapped Mcp-Name before comparing it to the body by @arpankernel (#1242)
- mcp: base64-encode a non-header-safe Mcp-Name by @akashjainn (#1246)
- fix(mcp): process singleton headers correctly by @yarolegovich (#1459)
Sessions, transports, cancellation, subscriptions, and MRTR:
- mcp: prevent a failed request from breaking a stateless streamable client by @jeongukjae (#1353)
- mcp: re-list and retry tools/call on HeaderMismatch by @nahapetyan-serob (#1502)
- mcp: keep a delivered response when the caller's context is cancelled by @vbcherepanov (#1370)
- mcp: bind peer cancellation before request ID reuse by @skosovsky (#1390)
- mcp: carry a cancelled notification's reason as the request's cancel cause by @jmrplens (#1255)
- mcp: send no response for a cancelled request on 2026-07-28 stdio sessions by @jmrplens (#1267)
- mcp: wrap ErrConnectionClosed for notifications and interrupted calls by @Jackmeson1 (#1449)
- refactor: simplify errors on connection closed by @guglielmo-san (#1468)
- mcp: make waiting for the ioConn write lock cancelable by @Tangerg (#1499)
- mcp: cancel pending keepalive ping when the session closes by @vshalpnjabi (#1478)
- mcp: notify sessions concurrently so one stalled peer cannot starve the rest by @yhxlele (#1228)
- mcp: notify every listen held open on a session by @jmrplens (#1490)
- mcp: retire only the subscriptions a listen registered by @cgair (#1275)
- mcp: retire a listen's subscriptions only while they are its own by @jmrplens (#1360)
- mcp: clear a resource subscription when its listen stream ends by @jeremy (#1283)
- mcp: route multi round-trip input requests through client receiving middleware by @guglielmo-san (#1479)
- mcp: repeat legacy multi-round-trip rounds until the handler completes by @SergeevDmitry (#1355)
- mcp: retry input-required results that carry only requestState by @SergeevDmitry (#1365)
- mcp: do not cache resources/read results of multi round-trip retries by @vbcherepanov (#1371)
- mcp: choose the interaction pattern from the negotiated protocol version by @jmrplens (#1266)
- mcp: allow nil params for ListRoots inputRequests by @guglielmo-san (#1517)
- fix(mcp): use internaljson for mrtr by @yarolegovich (#1458)
- mcp: avoid mutating client request parameters by @ar8327 (#1473)
- mcp: reuse server selection for new streamable requests by @Adebayo120 (#1414)
- fix: use server protocol version instead of context in streamable delivery by @guglielmo-san (#1491)
- mcp: record the negotiated protocol version on every path that records one by @jmrplens (#1274)
- mcp: classify the per-request protocol version by membership by @jmrplens (#1268)
- mcp: clear the caller's protocol version for the initialize handshake by @gwyszynski-sa (#1165)
- mcp: ignore the session ID on server/discover responses by @simon0191 (#1523)
- mcp: forward session state through LoggingTransport by @Zhuoxi2000 (#1434)
- mcp: accept custom methods over the SSE transport by @fadiroot (#1292)
- mcp: detach SSE client event stream from the Connect context by @beiryu (#1403)
- mcp: preserve SSE events buffered after the endpoint by @yyydddkkk (#1270)
- mcp: read a colon-less SSE line as a field with an empty value by @gu-feng418 (#1374)
- mcp: parse SSE field values per the SSE spec by @surlymochan (#1412)
- mcp: skip non-message events in SSEClientTransport by @MaxFreedomPollard (#1439)
- mcp: ignore notification in stdio batches by @guglielmo-san (#1277)
- mcp: gate session lifecycle log demotion behind MCPGODEBUG by @anneheartrecord (#1208)
- mcp: map custom slog levels to the nearest lower MCP level in LoggingHandler by @kaankucukx (#1446)
- mcp: log a keepalive session close at Warn, not Error by @oplatonov (#1282)
- mcp: log warnings when writing responses to disconnected clients fails by @guglielmo-san (#1469)
- mcp: remove unused middleware for url elicitation by @guglielmo-san (#1494)
- fix(mcp): name the offending path in computeURIFilepath localize error by @PratikDhanave (#1381)
- fix(mcp): use %v and ID.Raw() for jsonrpc response summary by @PratikDhanave (#1382)
- mcp: remove MCPGODEBUG options scheduled for removal in v1.9.0 by @guglielmo-san ([#1533])
Authorization (auth, auth/extauth, oauthex):
- auth: re-authorize when the access token expires without a refresh token by @luiacuaniello (#1418)
- auth: reuse the dynamically registered client across authorizations by @luiacuaniello (#1419)
- auth: require PKCE only in the authorization code flows by @luiacuaniello (#1465)
- oauthex: require S256 PKCE support in GetAuthServerMeta by @akshita317 (#1327)
- auth/extauth: fix token source lifetime and concurrent access in the handlers by @luiacuaniello (#1432)
- auth/extauth: send resource in client credentials token requests by @shlee1223 (#1451)
- auth/extauth: only forward an ID-JAG to the MCP authorization server by @akshita317 (#1438)
- auth/extauth: validate the RFC 9207 iss in PerformOIDCLogin by @akshita317 (#1442)
- conformance: run the client credentials scenario by @luiacuaniello (#1433)
- auth: strip a terminating slash from the issuer before building metadata URLs by @MaxFreedomPollard (#1245)
- auth: check token expiry before required scopes by @ilaigold (#1350)
- auth: reject userinfo, fragments, and dot segments in client ID URLs by @ilaigold (#1362)
- auth: use Bearer challenges for resource metadata by @jay23606 (#1396)
- mcp: include insufficient_scope error in WWW-Authenticate header for StatusForbidden by @guglielmo-san (#1421)
- auth: include error="invalid_token" in 401 challenges by @xianshujun (#1507)
- oauthex: encode and decode client metadata "jwks" as a JSON object by @kerthans (#1435)
- oauthex: keep challenges apart after a quoted value ending in a backslash by @akshita317 (#1307)
- oauthex: allow whitespace around "=" in auth-params after a comma by @akshita317 (#1322)
- oauthex: accept an empty quoted-string auth-param value by @akshita317 (#1344)
- oauthex: accept empty list elements in WWW-Authenticate by @akshita317 (#1351)
- oauthex: accept token68 challenges in WWW-Authenticate by @akshita317 (#1357)
- internal/authutil: treat an empty scope in a token response as absent by @akshita317 (#1308)
- oauthex: build defaultDiscoveryTransport lazily instead of at import by @kilarusravankumar (#1278)
- examples: check token audience and set UserID in auth examples by @kanywst (#1388)
Docs, conformance scripts, and CI:
- docs/server: fix logging defaults and the SetLoggingLevel method name by @rishabhsai (#1251)
- docs/client: fix the SEP-1034 and SEP-1330 links by @rishabhsai (#1252)
- CONTRIBUTING.md: document client and server conformance scripts by @kumachan99 (#1295)
- docs: refresh stale roadmap and doc links by @TastyHeadphones (#1306)
- docs(mcp): correct three inaccurate doc comments by @PratikDhanave (#1338)
- docs(oauthex): correct MatchesResource trailing-slash description by @PratikDhanave (#1339)
- mcp: check out testdata fixtures with LF line endings by @PerryLink (#1342)
- design: fix typos in mrtr.md by @seonoh (#1352)
- scripts: fix client-conformance.sh on Windows and with a relative --result_dir by @Shreyasg13 (#1366)
- docs(oauthex): fix broken [RFC 8414] godoc link (stray trailing paren) by @PratikDhanave (#1383)
- docs(auth): fix broken godoc links to AuthorizationCodeFetcher by @PratikDhanave (#1384)
- docs(mcp): fix misspelled [ClientCapabilities.Elicitation] godoc link by @PratikDhanave (#1385)
- fix(scripts): make --result_dir absolute in server-conformance.sh by @PerryLink (#1409)
- scripts: restore server conformance executable bit by @po-et (#1415)
- docs: clarify LoggingTransport log contents by @kimjooyoon (#1452)
- refactor: auto-close PRs that skip the intake requirements by @guglielmo-san (#1461)
- docs: improve docs clarity and automatic rejection by @guglielmo-san (#1463)
- docs: update docs-check workflow triggers by @guglielmo-san (#1466)
- build(deps): bump the codeql-action group with 3 updates by @dependabot (#1324)
- build(deps): bump the codeql-action group with 3 updates by @dependabot (#1484)
- build(deps): bump ossf/scorecard-action from 2.4.4 to 2.5.0 by @dependabot (#1485)
- build(deps): bump actions/upload-artifact from 7.0.1 to 7.0.2 by @dependabot (#1486)
- build(deps): bump actions/setup-node from 7.0.0 to 7.1.0 by @dependabot (#1487)
- build(deps): bump actions/setup-python from 7.0.0 to 7.1.0 by @dependabot (#1488)
New Contributors
- @CaliLuke made their first contribution in #1101
- @shoemoney made their first contribution in #1149
- @anneheartrecord made their first contribution in #1208
- @arpankernel made their first contribution in #1242
- @MaxFreedomPollard made their first contribution in #1245
- @akashjainn made their first contribution in #1246
- @rishabhsai made their first contribution in #1251
- @jmrplens made their first contribution in #1255
- @yyydddkkk made their first contribution in #1270
- @cgair made their first contribution in #1275
- @kilarusravankumar made their first contribution in #1278
- @oplatonov made their first contribution in #1282
- @jeremy made their first contribution in #1283
- @Tangerg made their first contribution in #1285
- @po-et made their first contribution in #1289
- @fadiroot made their first contribution in #1292
- @kumachan99 made their first contribution in #1295
- @TastyHeadphones made their first contribution in #1306
- @akshita317 made their first contribution in #1307
- @jyotir-aditya made their first contribution in #1312
- @beatcracker made their first contribution in #1333
- @PerryLink made their first contribution in #1342
- @pkarpovich made their first contribution in #1343
- @Enigmage made their first contribution in #1345
- @ilaigold made their first contribution in #1350
- @seonoh made their first contribution in #1352
- @jeongukjae made their first contribution in #1353
- @SergeevDmitry made their first contribution in #1355
- @Shreyasg13 made their first contribution in #1366
- @vbcherepanov made their first contribution in #1370
- @gu-feng418 made their first contribution in #1374
- @azilber made their first contribution in #1378
- @kanywst made their first contribution in #1388
- @skosovsky made their first contribution in #1390
- @talhayme made their first contribution in #1393
- @jay23606 made their first contribution in #1396
- @Ilyuha888 made their first contribution in #1397
- @beiryu made their first contribution in #1400
- @surlymochan made their first contribution in #1412
- @luiacuaniello made their first contribution in #1418
- @kerthans made their first contribution in #1427
- @Zhuoxi2000 made their first contribution in #1434
- @kaankucukx made their first contribution in #1446
- @Jackmeson1 made their first contribution in #1449
- @shlee1223 made their first contribution in #1451
- @kimjooyoon made their first contribution in #1452
- @raveesh-me made their first contribution in #1454
- @xianshujun made their first contribution in #1464
- @ar8327 made their first contribution in #1473
- @vshalpnjabi made their first contribution in #1478
- @QuentinBisson made their first contribution in #1495
- @nahapetyan-serob made their first contribution in #1502
- @toledompm made their first contribution in #1504
- @simon0191 made their first contribution in #1523
- @Assertive-xxh made their first contribution in #1527
Full Changelog: v1.8.0...v1.9.0