Releases: modelcontextprotocol/go-sdk
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
v1.4.0
This release marks the completion of the full 2025-11-25 specification implementation, by introducing the support for Sampling with Tools and experimental client-side OAuth support. It also contains multiple bug fixes and improvements. Thanks to all contributors!
Client-side OAuth support
This release introduces experimental support for OAuth on the client side of the SDK. It aims to support the full scope of the current MCP specification for authorization. To use it, you need to compile the SDK with the -tags mcp_go_client_oauth flag. Some changes may still be applied to this new API, based on developer feedback. The functionality is planned to become stable in v1.5.0 release, expected by the end of March 2026. More details can be found at https://github.com/modelcontextprotocol/go-sdk/blob/main/docs/protocol.md#client.
- all: client side OAuth support by @maciej-kisiel in #785
Sampling with Tools
Starting from this release, the server use the new CreateMessageWithTools method to create a sampling request to the client that contains tools that can be used by the client. On the client side, CreateMessageWithToolsHandler may be used to handle such requests and issue ToolUse responses to the server.
Behavior changes
We have two important behavior changes that were introduced to fix a bug or improve security posture. They can be temporarily turned off by specifying a special MCPGODEBUG environment variable when running the SDK. Different options can be added together, separated by a comma.
Introduced DNS rebinding protection
The requests arriving via a localhost address (127.0.0.1, [::1]) that have a non-localhost Host header will be rejected to protect against DNS rebinding attacks. The protection can be disabled by specifying StreamableHTTPOptions.DisableLocalhostProtection, but it should be done only if security implications are understood (see documentation for the option).
This protection is a behavior change, as the protection is now enabled by default. Because of that, we have introduced an MCPGODEBUG option to bring back the previous default behavior for users that need more time to adjust. However, if possible, we recommend specifying DisableLocalhostProtection described above, as it is a more future-proof solution. The MCPGODEBUG option to remove this protection (disablelocalhostprotection=1) will be removed in v1.6.0.
- feat: add automatic DNS rebinding protection for localhost servers by @pcarleton in #760
Removed JSON content escaping when marshaling
By default encoding/json escapes the contents of the objects, which causes some servers to fail. We switched to no escaping by default, to be consistent with other SDKs. Since this is a behavior change, we introduced an MCPGODEBUG option to bring back the previous behavior for users that need more time to adjust to it. That option (jsonescaping=1) will be removed in v1.6.0.
- mcp: update JSON marshaling to not HTML-escape messages by @maciej-kisiel in #769
Bug fixes
Security vulnerability caused by the case insensitive parsing behavior of encoding/json has been submitted (also release as a cherry pick in v1.3.1). Security advisory has been posted.
- all: use case-sensitive JSON unmarshaling by @maciej-kisiel in #807
Other fixes:
- mcp: validation only for accept action by @CocaineCong in #766
- mcp: allow SSE messages with empty data (SEP-1699) by @maciej-kisiel in #779
- jsonrpc2: fix Content-Length header parsing to be case-insensitive by @nithinputhenveettil in #789
- mcp: fix multi-select enum elicitation by @maciej-kisiel in #795
- mcp: return 400 instead of 500 when body read fails in stateless mode by @roncodingenthusiast in #817
Enhancements
Notably, the SDK now supports the extensions field in client and server capabilities, which should enable creation of MCP Apps.
Other enhancements:
- mcp: enforce retry limit when SSE stream makes no progress by @majiayu000 in #742
- mcp: export session missing error by @CocaineCong in #771
- fix: add JSON tags to ElicitationCapabilities fields by @awschmeder in #774
- mcp: improve http transports error handling and make transport work with any size message by @alexbumbacea in #734
- examples: bind auth-middleware server to localhost by default by @TheodorNEngoy in #784
Repository organization
Some effort was put into better organization of the repository, as well as making sure it's up to date and secure. As a highlight, the repository is not integrated with OSSF Scorecard with a positive score of 8.7. Additionally, the full conformance test suite is now run on every PR and push to main.
- chore: update licensing to Apache 2.0 for new contributions by @domdomegg in #750
- chore: update dependencies to newest versions, require Go 1.24 by @maciej-kisiel in #765
- conformance: prepare the conformance test suite by @maciej-kisiel in #764
- chore: use rand.Text and slog.DiscardHandler over intrernal implementation by @IAmSurajBobade in #773
- conformance: mark the new
dns-rebinding-protectionscenario as failing by @maciej-kisiel in #775 - conformance: trigger conformance tests automatically by @maciej-kisiel in #776
- mcp: finalize cleanup of Go 1.23, make Go version support explicit by @maciej-kisiel in #780
- Use omitzero json tag for byte array field in ResourceContents, instead of omitempty by @IAmSurajBobade in #782
- Testing: use synctest for timing-dependent tests by @La002 in #756
- chore: add ROADMAP.md by @maciej-kisiel in #788
- chore: bump node.js version for conformance test runs. by @maciej-kisiel in #796
- Update issue templates by @maciej-kisiel in #797
- chore: add an issue template for enhancements by @maciej-kisiel in #798
- chore: setup dependabot to update github actions. by @maciej-kisiel in #800
- build(deps): bump actions/setup-node from 4.1.0 to 6.2.0 by @dependabot[bot] in #801
- build(deps): bump actions/setup-go from 5.5.0 to 6.2.0 by @dependabot[bot] in #804
- build(deps): bump actions/checkout from 4.3.0 to 6.0.2 by @dependabot[bot] in #803
- Update SECURITY.md to use GitHub Security Advisories by @localden in #809
- chore: Configure OSSF Scorecard action by @maciej-kisiel in #811
- chore: configure a simple AGENTS.md file and a skill for fixing GitHu… by @maciej-kisiel in #810
- chore: update publish-docs permissions to be more targeted. by @maciej-kisiel in #812
- chore: increase timeout for conformance server start. by @maciej-kisiel in #813
- chore: update the version of the conformance suite. by @maciej-kisiel in #814
- chore: Configure advanced CodeQL setup by @maciej-kisiel in #819
New Contributors
- @domdomegg made their first contribution in #750
- @majiayu000 made their first contribution in #742
- @awschmeder made their first contribution in #774
- @alexbumbacea made their first contribution in #734
- @TheodorNEngoy made their first contribution in #784
- @pcarleton made their first contribution in #760
- @nithinputhenveettil made their first contribution in #789
- @ymmt2005 made their first contribution in #794
- @localden made their first contribution in #809
- @roncodingenthusiast made their first contribution in https://g...
v1.3.1
This release is a patch release for v1.3.0.
It contains a cherry-pick for a security issue reported in #805, which takes advantage of the default behavior of Go's standard library JSON decoder that allows case-insensitive matches to struct field names (or "json" tags). The issue has been addressed by changing the JSON decoder to one that supports case sensitive matching.
Fixes
- all: use case-sensitive JSON unmarshaling by @maciej-kisiel in #807
New external dependencies
- https://github.com/segmentio/encoding, which is the package that provides the new decoder.
Full Changelog: v1.3.0...v1.3.1
v1.3.0
This release is equivalent to v1.3.0-pre.1. Thank you to those who tested the pre-release.
This release includes several enhancements and bugfixes. Worth mentioning is the addition of schema caching, which significantly improves the performance in some stateless server deployment scenarios.
Dependency updates
Enhancements
- perf: add schema caching to avoid repeated reflection by @SamMorrowDrums in #685
- mcp: add DisableListening option to StreamableClientTransport by @zxxf18 in #729
- feat: deprecated logger in client & add Logger in ClientOption by @CocaineCong in #738
- feat: deleted the old logger in client by @CocaineCong in #744
- Export GetError and SetError methods by @jba in #753
Bugfixes
- fix: connectStandaloneSSE checking Content-Type header by @liushuangls in #736
- mcp: fix SSEClientTransport to report HTTP errors properly by @hassan123789 in #740
- mcp: add Allow header to 405 responses per RFC 9110 §15.5.6 by @SamMorrowDrums in #757
- mcp: fix a race condition in logging by @maciej-kisiel in #761
Chores
- docs: adds SDK version support matrix by @La002 in #737
- .github/workflows: add nightly conformance tests by @findleyr in #752
New Contributors
- @La002 made their first contribution in #737
- @hassan123789 made their first contribution in #740
- @liushuangls made their first contribution in #736
- @CocaineCong made their first contribution in #738
- @zxxf18 made their first contribution in #729
- @SamMorrowDrums made their first contribution in #685
- @maciej-kisiel made their first contribution in #761
Full Changelog: v1.2.0...v1.3.0
v1.3.0-pre.1
This release includes several enhancements and bugfixes. Worth mentioning is the addition of schema caching, which significantly improves the performance in some stateless server deployment scenarios.
Dependency updates
Enhancements
- perf: add schema caching to avoid repeated reflection by @SamMorrowDrums in #685
- mcp: add DisableListening option to StreamableClientTransport by @zxxf18 in #729
- feat: deprecated logger in client & add Logger in ClientOption by @CocaineCong in #738
- feat: deleted the old logger in client by @CocaineCong in #744
- Export GetError and SetError methods by @jba in #753
Bugfixes
- fix: connectStandaloneSSE checking Content-Type header by @liushuangls in #736
- mcp: fix SSEClientTransport to report HTTP errors properly by @hassan123789 in #740
- mcp: add Allow header to 405 responses per RFC 9110 §15.5.6 by @SamMorrowDrums in #757
- mcp: fix a race condition in logging by @maciej-kisiel in #761
Chores
- docs: adds SDK version support matrix by @La002 in #737
- .github/workflows: add nightly conformance tests by @findleyr in #752
New Contributors
- @La002 made their first contribution in #737
- @hassan123789 made their first contribution in #740
- @liushuangls made their first contribution in #736
- @CocaineCong made their first contribution in #738
- @zxxf18 made their first contribution in #729
- @SamMorrowDrums made their first contribution in #685
- @maciej-kisiel made their first contribution in #761
Full Changelog: v1.2.0...v1.3.0-pre.1
v1.2.0
This release is equivalent to v1.2.0-pre.2. Thank you to those who tested the prerelease.
This release adds partial support for the 2025-11-25 version of the MCP spec and fixes some bugs in the streamable transports. It also includes some minor new APIs, changes to contributing flows, and small bugfixes.
Contributing changes
- CONTRIBUTING.md is updated to remove the ad-hoc antitrust policy (#651), and add a dependency update policy (#635).
- An example server (
examples/server/conformance) is added for the new conformance tests at modelcontextprotocol/conformance. Test can be run withscripts/conformance.sh(#650).
Partial support for the 2025-11-25 spec
The following SEPs from the 2025-11-25 spec are now supported. Please see #725 for the proposed API additions included to support these SEPs.
- SEP-973: icons and metadata (#570)
- SEP-986: tool name validation (#640)
- SEP-1024: elicitation defaults (#644)
- SEP-1036: URL mode elicitation (#646)
- SEP-1699: SSE polling (#663)
- SEP-1330: elicitation enum improvements (#676)
Other API additions
- Common error codes are now available through the sentinel
jsonrpc.Error(#452) - OAuth 2.0 Protected Resource Metadata support (#643)
ClientCapabilities.RootsV2and RootCapabilities are added to work around an API bug (#607)Capabilitiesfields are added toServerOptionsandClientOptions, to simplify capability configuration (#706)
Streamable fixes
Several bug fixes are included for the streamable transports:
- mcp: relax SSE connection response handling in non-strict mode by @zhxie in #611
- Fix: Skip non-message SSE events in processStream by @raphaelmansuy in #637
- mcp: better handling for streamable context cancellation by @findleyr in #677
- mcp: don't break the streamable client connection for transient errors by @findleyr in #723
Other notable bugfixes
- fix: handle Windows CRLF in MCP client by @isfzhang in #665
- auth, mcp: add UserID to TokenInfo for session hijacking prevention by @findleyr in #695
- internal/docs: document UserID for session hijacking prevention by @findleyr in #697
- mcp: allow re-using connections in more cases by @howardjohn in #709
- oauthex: validate URL schemes in auth server metadata and DCR by @findleyr in #712
- mcp: debounce server change notifications by @findleyr in #717
- oauthex: fix content type check in getJSON by @nikolavp in #721
New Contributors
- @zhxie made their first contribution in #611
- @SpringMT made their first contribution in #614
- @raphaelmansuy made their first contribution in #637
- @markus-kusano made their first contribution in #644
- @isfzhang made their first contribution in #665
- @orius123 made their first contribution in #643
- @howardjohn made their first contribution in #709
- @nikolavp made their first contribution in #721
Full Changelog: v1.1.0...v1.2.0
v1.2.0-pre.2
This release brings one minor change to v1.2.0-pre.1: the icon themes "light" and "dark" now have their own type and constants.
What's Changed
- docs: add GitHub Pages redirect to latest release documentation by @jonathanhefner in #702
- mcp: switch icon theme to named string type by @findleyr in #733
New Contributors
- @jonathanhefner made their first contribution in #702
Full Changelog: v1.2.0-pre.1...v1.2.0-pre.2
v1.2.0-pre.1
This release adds partial support for the 2025-11-25 version of the MCP spec and fixes some bugs in the streamable transports. It also includes some minor new APIs, changes to contributing flows, and small bugfixes.
Please test the prerelease if you can, and review any pending proposals included in the release. Your feedback is greatly appreciated!
Contributing changes
- CONTRIBUTING.md is updated to remove the ad-hoc antitrust policy (#651), and add a dependency update policy (#635).
- An example server (
examples/server/conformance) is added for the new conformance tests at modelcontextprotocol/conformance. Test can be run withscripts/conformance.sh(#650).
Partial support for the 2025-11-25 spec
The following SEPs from the 2025-11-25 spec are now supported. Please see #725 for the proposed API additions included to support these SEPs.
- SEP-973: icons and metadata (#570)
- SEP-986: tool name validation (#640)
- SEP-1024: elicitation defaults (#644)
- SEP-1036: URL mode elicitation (#646)
- SEP-1699: SSE polling (#663)
- SEP-1330: elicitation enum improvements (#676)
Other API additions
- Common error codes are now available through the sentinel
jsonrpc.Error(#452) - OAuth 2.0 Protected Resource Metadata support (#643)
ClientCapabilities.RootsV2and RootCapabilities are added to work around an API bug (#607)Capabilitiesfields are added toServerOptionsandClientOptions, to simplify capability configuration (#706)
Streamable fixes
Several bug fixes are included for the streamable transports:
- mcp: relax SSE connection response handling in non-strict mode by @zhxie in #611
- Fix: Skip non-message SSE events in processStream by @raphaelmansuy in #637
- mcp: better handling for streamable context cancellation by @findleyr in #677
- mcp: don't break the streamable client connection for transient errors by @findleyr in #723
Other notable bugfixes
- fix: handle Windows CRLF in MCP client(#664) by @isfzhang in #665
- auth, mcp: add UserID to TokenInfo for session hijacking prevention by @findleyr in #695
- internal/docs: document UserID for session hijacking prevention by @findleyr in #697
- mcp: allow re-using connections in more cases by @howardjohn in #709
- oauthex: validate URL schemes in auth server metadata and DCR by @findleyr in #712
- mcp: debounce server change notifications by @findleyr in #717
- oauthex: fix content type check in getJSON by @nikolavp in #721
New Contributors
- @zhxie made their first contribution in #611
- @SpringMT made their first contribution in #614
- @raphaelmansuy made their first contribution in #637
- @markus-kusano made their first contribution in #644
- @isfzhang made their first contribution in #665
- @orius123 made their first contribution in #643
- @howardjohn made their first contribution in #709
- @nikolavp made their first contribution in #721
Full Changelog: v1.1.0...v1.2.0-pre.1
v1.1.0
This release introduces a few new features, and includes improvements and bug fixes for the streamable transport. Notably, the default behavior of the streamable server transport is changed to disable streams resumption (see #580).
Behavior Changes
Stream resumption disabled by default. In the StreamableServerTransport, the default value of nil for the EventStore field now disables stream resumption, rather than defaulting to use an in-memory event store. Resumption is not desirable in many cases, particularly for servers that must serve a large number of users and/or streams.
If you want to enable resumption, set StreamableHTTPOptions.EventStore.
In general, we will avoid changing behaviors that may be relied upon by users, but in this case the old default was deemed to be an oversight/bug, and fixing it now will benefit future users.
API Additions
IOTransportis a new general-purpose transport constructed from anio.ReadCloserandio.WriteCloser(#444 ).ServerOptions.LoggerandStreamableHTTPOptions.Loggerenable server-side logging (#170).StreamableHTTPOptions.EventStoreenables stream resumption (#587).StreamableHTTPOptions.SessionTimeoutadds a timeout which, when set, causes idle sessions to be automatically closed (#499).
Experimental client-side oauth support
The auth package now includes experimental APIs when build with the mcp_go_client_oauth build tag. See auth/client.go for more details. These APIs may change before their official release.
New Contributors
- @atomAltera made their first contribution in #376
- @Adebayo120 made their first contribution in #555
- @jhrozek made their first contribution in #561
- @AdrielVelazquez made their first contribution in #566
- @appleboy made their first contribution in #567
- @RyoKusnadi made their first contribution in #563
- @TomCN0803 made their first contribution in #581
- @rutu1717 made their first contribution in #603
Full Changelog: v1.0.0...v1.1.0