Releases: modelcontextprotocol/go-sdk
Release list
v1.7.0
This release brings full support for protocol version 2026-07-28.
The wire protocol is largely rewritten: a stateless model with per-request _meta, a new server/discover RPC replacing the initialize handshake, multi-round-trip requests (MRTR) replacing server-initiated calls, a unified subscriptions/listen stream replacing free-floating change notifications, standardised HTTP headers, and the formal deprecation of the roots, sampling, and logging features.
The streamable HTTP transport accepts requests at protocol version 2026-07-28 only when StreamableHTTPOptions.Stateless = true. If you want to expose the new protocol over HTTP, set Stateless = true; if you want to keep stateful sessions, your clients will negotiate down to 2025-11-25.
Backward compatibility with 2025-11-25 and earlier is preserved on every endpoint. The SDK negotiates the highest mutually-supported version at connect time. The new protocol is enabled by default for new clients; existing legacy clients and servers continue to work unchanged.
This release consolidates everything shipped in v1.7.0-pre.1, v1.7.0-pre.2, and v1.7.0-pre.3. Thank you to everyone who exercised the pre-releases and filed feedback.
v1.7.0-pre.3 is already successfully used by GitHub, serving more than half a million users.
Make MCP Stateless (SEP-2575) & Sessionless (SEP-2567)
The initialize/notifications/initialized handshake is removed in 2026-07-28. Each request now carries _meta.io.modelcontextprotocol/{protocolVersion,clientInfo,clientCapabilities} so the server can validate the peer without state. A new server/discover RPC lets clients learn the server's supported versions and capabilities up front; the SDK falls back to legacy initialize if discover fails. Resumability (Last-Event-ID, standalone GET) is removed; ping, logging/setLevel, resources/subscribe, and resources/unsubscribe are also removed on this revision and rejected with MethodNotFound.
- mcp: Implement support for SEP-2575 on client side by @guglielmo-san (#975)
- mcp: Implement server-side support for discover method (SEP-2575) by @guglielmo-san (#987)
- mcp: Implement stateless server (SEP-2575) by @guglielmo-san (#965)
- mcp: add support for logging level (SEP-2575) by @guglielmo-san (#997)
- mcp: Remove resumability and introduce
MissingRequiredClientCapabilityerror data by @guglielmo-san (#1005) - mcp: remove session header handling in stateless mode by @maciej-kisiel (#952)
- mcp: do not call DELETE for sessionless & doc adjustments by @maciej-kisiel (#960)
- mcp: Implement retry on advised supportedVersions in
UnsupportedProtocolVersionerror by @guglielmo-san (#989) - mcp: Enable legacy initialize fallback on any error by @guglielmo-san (#1014)
Subscriptions listen (SEP-2575)
The legacy tools/list_changed, prompts/list_changed, resources/list_changed, and resources/updated notifications are replaced by a single long-lived subscriptions/listen request whose response stream multiplexes every change notification the client opted into, each tagged with io.modelcontextprotocol/subscriptionId. The SDK opens this stream automatically on Client.Connect when the corresponding list-changed handler is set; servers route notifications only to subscribed sessions.
- mcp: Implement
subscriptions/listenrpc (SEP-2575) by @guglielmo-san (#1007) - mcp: refactor notification of subscribed sessions by @guglielmo-san (#1018)
Multi Round-Trip Requests (SEP-2322)
Server-to-client requests for elicitation, sampling, and roots are no longer issued as fresh JSON-RPC requests. Instead a tool/prompt/resource handler returns an InputRequiredResult whose inputRequests field carries the requests; the client fulfils each and retries the original call with inputResponses populated. The SDK ships client- and server-side middleware that handles this transparently in both directions, including a server-side compatibility shim that lets MRTR handlers also work against legacy clients.
- feat: multi-round-trip request implementation (SEP-2322) by @yarolegovich (#950)
Cacheable list results (SEP-2549)
tools/list, prompts/list, resources/list, resources/templates/list, resources/read, and server/discover results now carry ttlMs and cacheScope fields. Clients honour them as freshness hints to reduce polling; shared intermediaries use cacheScope to decide whether responses may be cached.
- mcp: add ttl for list results (SEP-2549) by @guglielmo-san (#1008)
- mcp: add Cacheable fields to
DiscoverResultby @guglielmo-san (#1022)
HTTP standardization (SEP-2243)
The streamable HTTP transport now mirrors selected fields from the JSON-RPC body into HTTP headers (Mcp-Method, Mcp-Name, Mcp-Protocol-Version, Mcp-Param-*) so network intermediaries can route and observe MCP traffic without deep packet inspection. Tools can declare per-parameter passthrough via x-mcp-header annotations on their input schema. Body↔header mismatches return -32020 HeaderMismatch.
- mcp: HTTP Header Standardization for
x-mcp-headerby @guglielmo-san (#915) - mcp: fix http-standardization (SEP-2243) by @guglielmo-san (#1010)
Deprecation of roots, sampling, and logging (SEP-2577)
Roots, sampling, and logging are formally deprecated on the 2026-07-28 revision. The SDK continues to expose the corresponding Go types for backward compatibility with older peers, but new servers should not rely on them.
- mcp: Deprecate roots, sampling and logging (SEP-2577) by @guglielmo-san (#1017)
Behavior changes guarded by MCPGODEBUG
Seven escape-hatch flags are added in this release to restore behavior that changed as part of spec-compliance fixes. All will be removed in v1.9.0.
customresnotfounderrcode=1— restore the old-32002code forResourceNotFoundError.hintomitempty=1— restoreomitemptyonToolAnnotations.ReadOnlyHintandIdempotentHint. The default now always serializes these fields because the Go types are barebool(not*bool), so omittingfalsemade it indistinguishable from "unset".allowsessionsinstateless=1— restore session-id handling on stateless streamable HTTP servers (read/writeMcp-Session-Id, acceptDELETE). The default behavior is now what the spec requires: stateless servers ignore session IDs entirely and return405 Method Not AllowedforDELETE.nomethodnotfoundcodeinerror=1— restore the previous STDIO behavior where the JSON-RPCMethodNotFound(-32601) code is omitted from the error response for unhandled methods. The default now includes the code.noprotocolerrorbody=1— restore the previous streamable HTTP client behavior of not decoding the JSON-RPC error body of a non-2xx HTTP response. The default now surfaces the underlying JSON-RPC error.nowrapinvalidparams=1— restore the previous behavior of returning rawunmarshalParamserrors from receiving handlers instead of wrapping them as a JSON-RPC-32602 Invalid paramserror. Introduced by #1087.disablecompleteparamsvalidation=1— restore the previous behavior of acceptingcompletion/completeresponses without validating the presence of thecompletionparams object. Introduced by #1080.
Other Changes to the SDK
Streamable HTTP transport:
- mcp: allow opt-in to cancel handler ctx on aborted POST by @guglielmo-san (#1099)
- mcp: enforce body size limit in Streamable ...
v1.7.0-pre.3
This is a follow-up pre-release on top of v1.7.0-pre.2, still targeting protocol version 2026-07-28. It rounds out the previous pre-release with additional spec-compliance fixes, small ergonomic improvements to the streamable HTTP transport, and OAuth session persistence support.
Streamable HTTP request cancellation
The streamable HTTP transport now exposes an opt-in StreamableHTTPOptions.PropagateRequestCancellation flag. When enabled, aborting an in-flight POST cancels the handler context on stateless servers using the 2026-07-28 protocol, so long-running tool handlers can stop paying for orphaned work when the client goes away. Existing behavior is unchanged by default.
- mcp: allow opt-in to cancel handler ctx on aborted POST by @guglielmo-san (#1099)
OAuth session persistence
Adds NewTokenSource and InitialTokenSource fields to AuthorizationCodeHandlerConfig. Together they let applications persist OAuth2 sessions across restarts by intercepting token refreshes and seeding the handler with a previously saved token source. A package example demonstrates the persistence pattern.
Spec compliance fixes
Continued alignment with the spec adjustments for the 2026-07-28 protocol.
- mcp: update return meta in
DiscoverResult(SEP-2575) by @guglielmo-san (#1097) - mcp: add return type to
subscriptions/listenby @guglielmo-san (#1088) - mcp: reject calls to
server/discoverfor<2026-07-28requests by @guglielmo-san (#1084) - mcp: include
resultTypeon new-protocol responses by @ychampion (#1060) - mcp: infer elicit mode from
ElicitParamsby @guglielmo-san (#1078) - mcp: wrap
unmarshalParamserrors with a JSON-RPC error by @guglielmo-san (#1087) - mcp: add param validation for
CompleteResultby @guglielmo-san (#1080) - mcp: do not
ApplyDefaultwhenres.Content == nilby @guglielmo-san (#1069)
Behavior changes guarded by MCPGODEBUG
Two new escape-hatch flags are added in this pre-release to restore the previous behavior of two spec-compliance fixes above.
nowrapinvalidparams=1— restore the previous behavior of returning rawunmarshalParamserrors from receiving handlers instead of wrapping them as a JSON-RPC-32602 Invalid paramserror. Introduced by #1087.disablecompleteparamsvalidation=1— restore the previous behavior of acceptingcompletion/completeresponses without validating the presence of thecompletionparams object. Introduced by #1080.
Other Changes to the SDK
- docs: update docs by @guglielmo-san (#1089)
- docs: update
troubleshoot.mdto includeresultTypeby @guglielmo-san (#1081) - ci: fix nightly runs by @guglielmo-san (#1086)
New Contributors
- @ychampion made their first contribution in #1060
Full Changelog: v1.7.0-pre.2...v1.7.0-pre.3
v1.7.0-pre.2
v1.7.0-pre.2
This is a follow-up pre-release on top of v1.7.0-pre.1, still targeting protocol version 2026-07-28. It rounds out the previous release with conformance-test coverage on both client and server, tightens spec compliance and introduces first-class support for custom JSON-RPC methods.
Custom JSON-RPC methods
The SDK now supports registering non-standard JSON-RPC methods end-to-end. Servers can register handlers with AddReceivingCustomMethod and clients can invoke them via AddSendingCustomMethod.
- mcp: Allow registration of custom JSON-RPC methods by @guglielmo-san (#956)
Conformance tests
Both the client and server implementations are now exercised by the official MCP conformance test suite as part of CI.
- mcp: add integration for server conformance tests by @guglielmo-san (#1054)
- mcp: add conformance tests on client by @guglielmo-san (#1063)
Protection agains OOM attacks
The streamable HTTP transport now enforces a configurable request body size limit to protect servers against OOM-style attacks from oversized payloads.
- mcp: enforce body size limit in Streamable connection by @guglielmo-san (#1055)
Spec compliance fixes
Several smaller fixes bring the implementation closer to the spec.
- mcp: do not exclude Notifications from carrying InitializeParams in Meta by @guglielmo-san (#1049)
- mcp: cap negotiated protocolVersion in legacy initialize to
protocolVersion20251125by @guglielmo-san (#1051) - mcp: make NotificationSubscriptions a mandatory field by @guglielmo-san (#1050)
- fix: extra wrapper for input response map by @yarolegovich (#1045)
- mcp: do not enforce TTL on cached tool by @guglielmo-san (#1053)
- mcp: block server initiated requests (SEP-2322) by @guglielmo-san (#1057)
Full Changelog: v1.7.0-pre.1...v1.7.0-pre.2
v1.7.0-pre.1
v1.7.0 — MCP 2026-07-28
This release brings full support for protocol version 2026-07-28 as of https://github.com/modelcontextprotocol/modelcontextprotocol/tree/f817239f4d6b1efff2c4dfc2f7af85c985d73076.
Any change introduced after this commit, may not be implemented in this release.
The wire protocol is largely rewritten: a stateless model with per-request _meta, a new server/discover RPC replacing the initialize handshake, multi-round-trip requests (MRTR) replacing server-initiated calls, a unified subscriptions/listen stream replacing free-floating change notifications, standardised HTTP headers, and the formal deprecation of the roots, sampling, and logging features.
The streamable HTTP transport accepts requests at protocol version 2026-07-28 only when StreamableHTTPOptions.Stateless = true. If you want to expose the new protocol over HTTP, set Stateless = true; if you want to keep stateful sessions, your clients will negotiate down to 2025-11-25.
Backward compatibility with 2025-11-25 and earlier is preserved on every endpoint. The SDK negotiates the highest mutually-supported version at connect time. The new protocol is enabled by default for new clients; existing legacy clients and servers continue to work unchanged.
Make MCP Stateless (SEP-2575) & Sessionless (SEP-2567)
The initialize/notifications/initialized handshake is removed in 2026-07-28. Each request now carries _meta.io.modelcontextprotocol/{protocolVersion,clientInfo,clientCapabilities} so the server can validate the peer without state. A new server/discover RPC lets clients learn the server's supported versions and capabilities up front; the SDK falls back to legacy initialize if discover fails. Resumability (Last-Event-ID, standalone GET) is removed; ping, logging/setLevel, resources/subscribe, resources/unsubscribe are also removed on this revision and rejected with MethodNotFound.
- mcp: Implement support for SEP-2575 on client side by @guglielmo-san (#975)
- mcp: Implement server-side support for discover method (SEP-2575) by @guglielmo-san (#987)
- mcp: Implement stateless server (SEP-2275 — typo in PR title, actually SEP-2575) by @guglielmo-san (#965)
- mcp: add support for logging level (SEP-2575) by @guglielmo-san (#997)
- mcp: Remove resumability and introduce
MissingRequiredClientCapabilityerror data by @guglielmo-san (#1005) - mcp: remove session header handling in stateless mode by @maciej-kisiel (#952)
- mcp: do not call DELETE for sessionless & doc adjustments by @maciej-kisiel (#960)
- mcp: Implement retry on advised supportedVersions in
UnsupportedProtocolVersionerror by @guglielmo-san (#989) - mcp: Enable legacy initialize fallback on any error by @guglielmo-san (#1014)
Subscriptions listen (SEP-2575)
The legacy free-floating notifications/tools/list_changed, prompts/list_changed, resources/list_changed, and resources/updated notifications are replaced by a single long-lived subscriptions/listen request whose response stream multiplexes every change notification the client opted into, each tagged with io.modelcontextprotocol/subscriptionId. The SDK opens this stream automatically on Client.Connect when the corresponding list-changed handler is set; servers route notifications only to subscribed sessions.
- mcp: Implement
subscriptions/listenrpc (SEP-2575) by @guglielmo-san (#1007) - mcp: refactor notification of subscribed sessions by @guglielmo-san (#1018)
Multi Round-Trip Requests (SEP-2322)
Server-to-client requests for elicitation, sampling, and roots are no longer issued as fresh JSON-RPC requests. Instead a tool/prompt/resource handler returns an InputRequiredResult whose inputRequests field carries the requests; the client fulfils each and retries the original call with inputResponses populated. The SDK ships client- and server-side middleware that handles this transparently in both directions, including a server-side compatibility shim that lets MRTR handlers also work against legacy clients.
- feat: multi-round-trip request implementation (SEP-2322) by @yarolegovich (#950)
Cacheable list results (SEP-2549)
tools/list, prompts/list, resources/list, resources/templates/list, resources/read, and server/discover results now carry ttlMs and cacheScope fields. Clients honour them as freshness hints to reduce polling; shared intermediaries use cacheScope to decide whether responses may be cached.
- mcp: add ttl for list results (SEP-2549) by @guglielmo-san (#1008)
- mcp: add Cacheable fields to DiscoverResult by @guglielmo-san (#1022)
HTTP standardization (SEP-2243)
The streamable HTTP transport now mirrors selected fields from the JSON-RPC body into HTTP headers (Mcp-Method, Mcp-Name, Mcp-Protocol-Version, Mcp-Param-*) so network intermediaries can route and observe MCP traffic without deep packet inspection. Tools can declare per-parameter passthrough via x-mcp-header annotations on their input schema. Body↔header mismatches return -32020 HeaderMismatch.
- mcp: HTTP Header Standardization for
x-mcp-headerby @guglielmo-san (#915) - mcp: fix http-standardization (SEP-2243) by @guglielmo-san (#1010)
Authorization improvements
- mcp: align resource not found error code with SEP-2164 by @yarolegovich (#931)
- mcp: OIDC-Flavored Refresh Token Guidance (SEP-2207) by @guglielmo-san (#939)
- mcp: Add client-side scope accumulation (SEP-2350) by @guglielmo-san (#944)
- mcp: add optional issuer validator for pre-registered client validation (SEP-2352) by @guglielmo-san (#946)
- auth: issuer mix-up mitigation (SEP-2468) by @max-stytch (#859)
- Compare auth server metadata issuer ignoring trailing slash by @gainsley (#955)
- auth: bind refreshing token source to a background context, not the request ctx by @toabctl (#988)
- auth: add
ClockSkewoption toRequireBearerTokenOptionsby @BorisTyshkevich (#969) - auth: add
AllowMissingExpirationoption toRequireBearerTokenOptionsby @BorisTyshkevich (#971) - oauthex: add
MatchesResourcehelper (RFC 9728/8707 audience comparison) by @BorisTyshkevich (#970) - fix: handle
oauth2.RetrieveErrorduring token refresh by @smlx (#917)
Behavior Changes guarded by MCPGODEBUG
Five new escape-hatch flags were added to restore previous behavior. All will be removed in v1.9.0.
customresnotfounderrcode=1— restore the old-32002code forResourceNotFoundError.hintomitempty=1— restoreomitemptyonToolAnnotations.ReadOnlyHintandIdempotentHint. The default now always serializes these fields because the Go types are barebool(not*bool), so omittingfalsemade it indistinguishable from "unset".allowsessionsinstateless=1— restore session-id handling on stateless streamable HTTP servers (read/writeMcp-Session-Id, acceptDELETE). The default behavior is now what the spec requires: stateless servers ignore session IDs entirely and return405 Method Not AllowedforDELETE.nomethodnotfoundcodeinerror=1— restore the previous STDIO behavior where the JSON-RPCMethodNotFound(-32601) code is omitted from the error response for unhandled methods. The default now includes the code.noprotocolerrorbody=1— restore the previous streamable HTTP client behavior of not decoding the JSON-RPC error body of a non-2xx HTTP response. The default now surfaces the underlying JSON-RPC error.
Other Changes to the SDK
- mcp: close HTTP response body...
v1.6.1
This release adds an MCPGODEBUG flag to opt out of the Content-Type check on POST requests.
Behavior Changes
Prior to v1.6.0 (v1.4.0...v1.5.0), the Content-Type check on POST requests was gated by the same disablecrossoriginprotection MCPGODEBUG flag as the cross-origin protection. In v1.6.0, the cross-origin protection was disabled by default (replaced by the opt-in enableoriginverification flag), but the Content-Type check was kept on unconditionally, leaving no way to disable it.
This release restores an escape hatch for both the Streamable HTTP and SSE transports: setting MCPGODEBUG=disablecontenttypecheck=1 skips the Content-Type: application/json validation on POST requests.
See #957.
What's Changed
- mcp: add MCPGPDEBUG for opt-in Content-Type check by @guglielmo-san in #972
Full Changelog: v1.6.0...v1.6.1
v1.6.0
This release is equivalent to v1.6.0-pre.1. Thank you to those who tested the pre-release.
In this release we introduce several smaller fixes and improvements, and we started working for release 2026-06-30. The main new feature is the introduction of ClientCredentialsHandler for OAuth client credentials grant.
Add ClientCredentialsHandler for OAuth client credentials grant
Added ClientCredentialsHandler implementing auth.OAuthHandler using the OAuth 2.0 Client Credentials grant (RFC 6749 Section 4.4) for service-to-service authentication with pre-registered credentials.
2026-06-30 Release related PRs
-
feat: add automatic application_type inference by @guglielmo-san in #904
New
application_typefield is added to theClientRegistrationMetadatafor DynamicClientRegistration. If not specified, theapplication_typewill be inferred from the RedirectURIs. This implements SEP-837. -
feat: HTTP Header Standardization for method and name by @guglielmo-san in #907
By mirroring key fields from the JSON-RPC payload into HTTP headers, network intermediaries such as load balancers, proxies, and observability tools can route and process MCP traffic without deep packet inspection, reducing latency and computational overhead. This partially implements SEP-2243.
Behavior Changes
SetError Behavior Change
Previously the SetError method on CallToolResult always overwrote the Content field with the error text. Now SetError preserves the existing value if it has already been populated. You can restore the previous behavior by setting the environment variable seterroroverwrite=1.
Cross-Origin Protection Default Change
Previously (v1.4.1-v1.5.0) default (zero-value) cross-origin protection was applied when CrossOriginProtection in StreamableHTTPOptions was nil. Now cross-origin protection is not enabled by default when CrossOriginProtection is nil.
You can restore the previous behavior (enable by default) by setting enableoriginverification=1.
- mcp: remove default cross origin protection by @maciej-kisiel in #906
disablecrossoriginprotection was replaced by enableoriginverification after the default was changed to not enable cross-origin protection.
jsonescaping option was removed, according to plan.
Other Changes to the SDK
- internal: remove unused util functions by @alexandear in #871
- build(deps): bump github/codeql-action from 4.32.4 to 4.35.1 by @dependabot[bot] in #873
- build(deps): bump actions/setup-go from 6.3.0 to 6.4.0 by @dependabot[bot] in #874
- build(deps): bump actions/setup-node from 6.2.0 to 6.3.0 by @dependabot[bot] in #875
- build(deps): bump dominikh/staticcheck-action from 1.4.0 to 1.4.1 by @dependabot[bot] in #872
- oauthex: accept 200 in client registration by @MatyasVondraOutreach in #877
- mcp: allow Content-Type parameters in streamable transport by @rafaeljusto in #878
- mcp: preserve existing Content in SetError by @ravyg in #864
- mcp: fix race condition in
ServerSession.startKeepaliveby @begelundmuller in #856 - chore: preserve CNAME when deploying to GitHub pages by @maciej-kisiel in #884
- extauth: refactor enterprise auth tests by @maciej-kisiel in #879
- feat: Add Support for mkdocs by @Dinesht04 in #883
- mcp: add DNS rebinding and cross origin protections to SSE transport by @maciej-kisiel in #891
- mcp: log out-of-band errors instead of dropping them by @ravyg in #887
- mcp: don't close session when keepalive ping returns method-not-found by @maciej-kisiel in #900
- mcp: accept parameterized Content-Type types by @kalvinnchau in #890
- mcp: remove default cross origin protection by @maciej-kisiel in #906
- Update README.md by @N-Masi in #896
- mcp: preserve transport errors in Write error chain by @jpugliesi in #888
- mcp: do not re-prompt OAuth after cancelled Authorize by @ravyg in #885
- mcp: Upgrade jsonschema-go by @rafaeljusto in #912
- internal/jsonrpc2: remove unused code by @maciej-kisiel in #910
- MCPGODEBUG update for 1.6.0 by @maciej-kisiel in #893
New Contributors
- @MatyasVondraOutreach made their first contribution in #877
- @rafaeljusto made their first contribution in #878
- @begelundmuller made their first contribution in #856
- @Dinesht04 made their first contribution in #883
- @N-Masi made their first contribution in #896
- @jpugliesi made their first contribution in #888
- @guglielmo-san made their first contribution in #904
Full Changelog: v1.5.0...v1.6.0-pre.1
v1.6.0-pre.1
In this release we introduce several smaller fixes and improvements, and we started working for release 2026-06-30. The main new feature is the introduction of ClientCredentialsHandler for OAuth client credentials grant.
Add ClientCredentialsHandler for OAuth client credentials grant
Added ClientCredentialsHandler implementing auth.OAuthHandler using the OAuth 2.0 Client Credentials grant (RFC 6749 Section 4.4) for service-to-service authentication with pre-registered credentials.
2026-06-30 Release related PRs
-
feat: add automatic application_type inference by @guglielmo-san in #904
New
application_typefield is added to theClientRegistrationMetadatafor DynamicClientRegistration. If not specified, theapplication_typewill be inferred from the RedirectURIs. This implements SEP-837. -
feat: HTTP Header Standardization for method and name by @guglielmo-san in #907
By mirroring key fields from the JSON-RPC payload into HTTP headers, network intermediaries such as load balancers, proxies, and observability tools can route and process MCP traffic without deep packet inspection, reducing latency and computational overhead. This partially implements SEP-2243.
Behavior Changes
SetError Behavior Change
Previously the SetError method on CallToolResult always overwrote the Content field with the error text. Now SetError preserves the existing value if it has already been populated. You can restore the previous behavior by setting the environment variable seterroroverwrite=1.
Cross-Origin Protection Default Change
Previously (v1.4.1-v1.5.0) default (zero-value) cross-origin protection was applied when CrossOriginProtection in StreamableHTTPOptions was nil. Now cross-origin protection is not enabled by default when CrossOriginProtection is nil.
You can restore the previous behavior (enable by default) by setting enableoriginverification=1.
- mcp: remove default cross origin protection by @maciej-kisiel in #906
disablecrossoriginprotection was replaced by enableoriginverification after the default was changed to not enable cross-origin protection.
jsonescaping option was removed, according to plan.
Other Changes to the SDK
- internal: remove unused util functions by @alexandear in #871
- build(deps): bump github/codeql-action from 4.32.4 to 4.35.1 by @dependabot[bot] in #873
- build(deps): bump actions/setup-go from 6.3.0 to 6.4.0 by @dependabot[bot] in #874
- build(deps): bump actions/setup-node from 6.2.0 to 6.3.0 by @dependabot[bot] in #875
- build(deps): bump dominikh/staticcheck-action from 1.4.0 to 1.4.1 by @dependabot[bot] in #872
- oauthex: accept 200 in client registration by @MatyasVondraOutreach in #877
- mcp: allow Content-Type parameters in streamable transport by @rafaeljusto in #878
- mcp: preserve existing Content in SetError by @ravyg in #864
- mcp: fix race condition in
ServerSession.startKeepaliveby @begelundmuller in #856 - chore: preserve CNAME when deploying to GitHub pages by @maciej-kisiel in #884
- extauth: refactor enterprise auth tests by @maciej-kisiel in #879
- feat: Add Support for mkdocs by @Dinesht04 in #883
- mcp: add DNS rebinding and cross origin protections to SSE transport by @maciej-kisiel in #891
- mcp: log out-of-band errors instead of dropping them by @ravyg in #887
- mcp: don't close session when keepalive ping returns method-not-found by @maciej-kisiel in #900
- mcp: accept parameterized Content-Type types by @kalvinnchau in #890
- mcp: remove default cross origin protection by @maciej-kisiel in #906
- Update README.md by @N-Masi in #896
- mcp: preserve transport errors in Write error chain by @jpugliesi in #888
- mcp: do not re-prompt OAuth after cancelled Authorize by @ravyg in #885
- mcp: Upgrade jsonschema-go by @rafaeljusto in #912
- internal/jsonrpc2: remove unused code by @maciej-kisiel in #910
- MCPGODEBUG update for 1.6.0 by @maciej-kisiel in #893
New Contributors
- @MatyasVondraOutreach made their first contribution in #877
- @rafaeljusto made their first contribution in #878
- @begelundmuller made their first contribution in #856
- @Dinesht04 made their first contribution in #883
- @N-Masi made their first contribution in #896
- @jpugliesi made their first contribution in #888
- @guglielmo-san made their first contribution in #904
Full Changelog: v1.5.0...v1.6.0-pre.1
v1.5.0
This release is equivalent to v1.5.0-pre.1. Thank you to those who tested the pre-release.
In this release we introduce important enhancements to the client-side OAuth flows. We also introduce several smaller fixes and improvements.
Stabilization of client-side OAuth APIs
As previously communicated, we're stabilizing the client-side OAuth APIs in v1.5.0. This means that the mcp_go_client_oauth build tag will no longer be required to compile the functionality and standard backward compatibility guarantees apply from now on.
Compared to the experimental support published in v1.4.0, we made some backwards incompatible changes:
auth.AuthorizationCodeHandlerConfig.AuthorizationCodeFetcher's type was changed fromfunc(context.Context, *auth.AuthorizationArgs) (*auth.AuthorizationResult, error)toauth.AuthorizationCodeFetcherwhich is a reusable definition carrying the same underlying function type.auth.AuthorizationCodeHandlerConfig.PreregisteredClientConfigwas removed and replaced withauth.AuthorizationCodeHandlerConfig.PreregisteredClientwhich uses a newly introducedoauthex.ClientCredentialstype. The type used previously (auth.PreregisteredClientConfig) has been removed.- Deprecated functionality has been removed from both
authandoauthexpackages.
- all: stabilize client OAuth support by @maciej-kisiel in #861
Enterprise Managed Authorization support added
Support for Enterprise Managed Authorization has been added to auth/extauth package. Huge thanks to @radar07 for the implementation!
Note: this support is part of an official MCP extension and is not part of the core protocol. The support of this functionality is not covered by the principles defined in SDK tiers.
Other changes to the SDK
- examples: fix OAuth client example after latest changes. by @maciej-kisiel in #820
- build(deps): bump actions/upload-artifact from 4.6.1 to 7.0.0 by @dependabot[bot] in #824
- build(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.3 by @dependabot[bot] in #825
- build(deps): bump actions/setup-go from 6.2.0 to 6.3.0 by @dependabot[bot] in #827
- build(deps): bump actions/checkout from 4.2.2 to 6.0.2 by @dependabot[bot] in #826
- mcp: simplify and unify unit tests introduced for sampling with tools. by @maciej-kisiel in #799
- auth: fix 2025-03-26 backcompat by @maciej-kisiel in #821
- chore: update deps after v1.4.0 release by @maciej-kisiel in #829
- build(deps): bump github/codeql-action from 3 to 4 by @dependabot[bot] in #823
- mcp: update latestProtocolVersion to 2025-11-25 by @findleyr in #724
- mcp: protect ioConn.protocolVersion with a mutex by @maciej-kisiel in #832
- examples: add an example that display header forwarding. by @maciej-kisiel in #836
- internal: fix Unicode zero character handling by @maciej-kisiel in #841
- auth: allow passing custom http.Client to AuthorizationCodeHandler by @maciej-kisiel in #840
- mcp: verify 'Origin' and 'Content-Type' headers by @maciej-kisiel in #842
- auth: return scope in WWW-Authenticate header. by @maciej-kisiel in #834
- mcp: fix setProgressToken when Meta is nil by @StevenRChen in #846
- all: clean up Go 1.24 specific code. by @maciej-kisiel in #850
- mcp: re-enable race test after fixing data races by @maciej-kisiel in #851
- mcp: handle empty chunks in MemoryEventStore by @jba in #862
- oauthex: use internal JSON library for decoding. by @maciej-kisiel in #866
- all: fix typos by @alexandear in #869
- mcp: return input validation errors as tool results, not JSON-RPC errors by @ravyg in #863
- all: modernize code by @alexandear in #868
- mcp: accept parameterized Accept media types by @kalvinnchau in #853
- mcp: use http.ResponseController to ensure writes are flushed by @toofishes in #870
New Contributors
- @StevenRChen made their first contribution in #846
- @radar07 made their first contribution in #770
- @alexandear made their first contribution in #869
- @ravyg made their first contribution in #863
- @kalvinnchau made their first contribution in #853
- @toofishes made their first contribution in #870
Full Changelog: v1.4.1...v1.5.0
v1.5.0-pre.1
In this release we introduce important enhancements to the client-side OAuth flows. We also introduce several smaller fixes and improvements.
Stabilization of client-side OAuth APIs
As previously communicated, we're stabilizing the client-side OAuth APIs in v1.5.0. This means that the mcp_go_client_oauth build tag will no longer be required to compile the functionality and standard backward compatibility guarantees apply from now on.
Compared to the experimental support published in v1.4.0, we made some backwards incompatible changes:
auth.AuthorizationCodeHandlerConfig.AuthorizationCodeFetcher's type was changed fromfunc(context.Context, *auth.AuthorizationArgs) (*auth.AuthorizationResult, error)toauth.AuthorizationCodeFetcherwhich is a reusable definition carrying the same underlying function type.auth.AuthorizationCodeHandlerConfig.PreregisteredClientConfigwas removed and replaced withauth.AuthorizationCodeHandlerConfig.PreregisteredClientwhich uses a newly introducedoauthex.ClientCredentialstype. The type used previously (auth.PreregisteredClientConfig) has been removed.- Deprecated functionality has been removed from both
authandoauthexpackages.
- all: stabilize client OAuth support by @maciej-kisiel in #861
Enterprise Managed Authorization support added
Support for Enterprise Managed Authorization has been added to auth/extauth package. Huge thanks to @radar07 for the implementation!
Note: this support is part of an official MCP extension and is not part of the core protocol. The support of this functionality is not covered by the principles defined in SDK tiers.
Other changes to the SDK
- examples: fix OAuth client example after latest changes. by @maciej-kisiel in #820
- build(deps): bump actions/upload-artifact from 4.6.1 to 7.0.0 by @dependabot[bot] in #824
- build(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.3 by @dependabot[bot] in #825
- build(deps): bump actions/setup-go from 6.2.0 to 6.3.0 by @dependabot[bot] in #827
- build(deps): bump actions/checkout from 4.2.2 to 6.0.2 by @dependabot[bot] in #826
- mcp: simplify and unify unit tests introduced for sampling with tools. by @maciej-kisiel in #799
- auth: fix 2025-03-26 backcompat by @maciej-kisiel in #821
- chore: update deps after v1.4.0 release by @maciej-kisiel in #829
- build(deps): bump github/codeql-action from 3 to 4 by @dependabot[bot] in #823
- mcp: update latestProtocolVersion to 2025-11-25 by @findleyr in #724
- mcp: protect ioConn.protocolVersion with a mutex by @maciej-kisiel in #832
- examples: add an example that display header forwarding. by @maciej-kisiel in #836
- internal: fix Unicode zero character handling by @maciej-kisiel in #841
- auth: allow passing custom http.Client to AuthorizationCodeHandler by @maciej-kisiel in #840
- mcp: verify 'Origin' and 'Content-Type' headers by @maciej-kisiel in #842
- auth: return scope in WWW-Authenticate header. by @maciej-kisiel in #834
- mcp: fix setProgressToken when Meta is nil by @StevenRChen in #846
- all: clean up Go 1.24 specific code. by @maciej-kisiel in #850
- mcp: re-enable race test after fixing data races by @maciej-kisiel in #851
- mcp: handle empty chunks in MemoryEventStore by @jba in #862
- oauthex: use internal JSON library for decoding. by @maciej-kisiel in #866
- all: fix typos by @alexandear in #869
- mcp: return input validation errors as tool results, not JSON-RPC errors by @ravyg in #863
- all: modernize code by @alexandear in #868
- mcp: accept parameterized Accept media types by @kalvinnchau in #853
- mcp: use http.ResponseController to ensure writes are flushed by @toofishes in #870
New Contributors
- @StevenRChen made their first contribution in #846
- @radar07 made their first contribution in #770
- @alexandear made their first contribution in #869
- @ravyg made their first contribution in #863
- @kalvinnchau made their first contribution in #853
- @toofishes made their first contribution in #870
Full Changelog: v1.4.1...v1.5.0-pre.1
v1.4.1
This release is a patch release for v1.4.0.
It contains cherry-picks for several security improvements. Security advisories will follow.
Fixes
Update of the segmentio/encoding module version
The JSON parsing library that was adopted to avoid attacks taking advantage of the Go's standard parser being case insensitive turned out to contain an issue itself. We have submitted the fix upstream and this release updates the dependency to the patched version.
Cross-origin requests protection
We have added additional protection against cross origin requests. From now on, we verify that Content-Type for JSON-RPC POST requests is set to application/json and use the new http.CrossOriginProtection functionality to verify the origin of the request. Usage of this functionality required increasing the required Go version to 1.25, which is in line with our Go version policy of supporting two newest Go versions. The behavior can be customized by passing a configured http.CrossOriginProtection object to StreamableHTTPOptions.
Since this is a behavior change, we introduced a compatibility parameter disablecrossoriginprotection that will allow to temporarily disable it. It will be removed in v1.6.0 version of the SDK. See here for more details about behavior changes and a history of compatibility parameters across SDK versions.
Allowing customization of http.Client for client-side OAuth
We have introduced an optional http.Client parameter to AuthorizationCodeHandlerConfig. This allows customization of the transport, for example implementing environment specific protection against Server-Side Request Forgery.
Pull requests
- internal: fix Unicode zero character handling by @maciej-kisiel in #841
- auth: allow passing custom http.Client to AuthorizationCodeHandler by @maciej-kisiel in #840
- mcp: verify 'Origin' and 'Content-Type' headers by @maciej-kisiel in #842
Full Changelog: v1.4.0...v1.4.1