freshcrate
Skin:/
Home > MCP Servers > go-sdk

go-sdk

The official Go SDK for Model Context Protocol servers and clients. Maintained in collaboration with Google.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

The official Go SDK for Model Context Protocol servers and clients. Maintained in collaboration with Google.

README

MCP Go SDK

Open in GitHub Codespaces

PkgGoDev OpenSSF Scorecard

This repository contains an implementation of the official Go software development kit (SDK) for the Model Context Protocol (MCP).

Package / Feature documentation

The SDK consists of several importable packages:

The SDK endeavors to implement the full MCP spec. The docs/ directory contains feature documentation, mapping the MCP spec to the packages above.

Version Compatibility

The following table shows which versions of the Go SDK support which versions of the MCP specification:

SDK Version Latest MCP Spec All Supported MCP Specs
v1.4.0+ 2025-11-25* 2025-11-25*, 2025-06-18, 2025-03-26, 2024-11-05
v1.2.0 - v1.3.1 2025-11-25** 2025-11-25**, 2025-06-18, 2025-03-26, 2024-11-05
v1.0.0 - v1.1.0 2025-06-18 2025-06-18, 2025-03-26, 2024-11-05

* Client side OAuth has experimental support.

** Partial support for 2025-11-25 (client side OAuth and Sampling with tools not available).

New releases of the SDK target only supported versions of Go. See https://go.dev/doc/devel/release#policy for more information.

Getting started

To get started creating an MCP server, create an mcp.Server instance, add features to it, and then run it over an mcp.Transport. For example, this server adds a single simple tool, and then connects it to clients over stdin/stdout:

package main

import (
	"context"
	"log"

	"github.com/modelcontextprotocol/go-sdk/mcp"
)

type Input struct {
	Name string `json:"name" jsonschema:"the name of the person to greet"`
}

type Output struct {
	Greeting string `json:"greeting" jsonschema:"the greeting to tell to the user"`
}

func SayHi(ctx context.Context, req *mcp.CallToolRequest, input Input) (
	*mcp.CallToolResult,
	Output,
	error,
) {
	return nil, Output{Greeting: "Hi " + input.Name}, nil
}

func main() {
	// Create a server with a single tool.
	server := mcp.NewServer(&mcp.Implementation{Name: "greeter", Version: "v1.0.0"}, nil)
	mcp.AddTool(server, &mcp.Tool{Name: "greet", Description: "say hi"}, SayHi)
	// Run the server over stdin/stdout, until the client disconnects.
	if err := server.Run(context.Background(), &mcp.StdioTransport{}); err != nil {
		log.Fatal(err)
	}
}

To communicate with that server, create an mcp.Client and connect it to the corresponding server, by running the server command and communicating over its stdin/stdout:

package main

import (
	"context"
	"log"
	"os/exec"

	"github.com/modelcontextprotocol/go-sdk/mcp"
)

func main() {
	ctx := context.Background()

	// Create a new client, with no features.
	client := mcp.NewClient(&mcp.Implementation{Name: "mcp-client", Version: "v1.0.0"}, nil)

	// Connect to a server over stdin/stdout.
	transport := &mcp.CommandTransport{Command: exec.Command("myserver")}
	session, err := client.Connect(ctx, transport, nil)
	if err != nil {
		log.Fatal(err)
	}
	defer session.Close()

	// Call a tool on the server.
	params := &mcp.CallToolParams{
		Name:      "greet",
		Arguments: map[string]any{"name": "you"},
	}
	res, err := session.CallTool(ctx, params)
	if err != nil {
		log.Fatalf("CallTool failed: %v", err)
	}
	if res.IsError {
		log.Fatal("tool failed")
	}
	for _, c := range res.Content {
		log.Print(c.(*mcp.TextContent).Text)
	}
}

The examples/ directory contains more example clients and servers.

Contributing

We welcome contributions to the SDK! Please see CONTRIBUTING.md for details of how to contribute.

Acknowledgements / Alternatives

Several third party Go MCP SDKs inspired the development and design of this official SDK, and continue to be viable alternatives, notably mcp-go, originally authored by Ed Zynda. We are grateful to Ed as well as the other contributors to mcp-go, and to authors and contributors of other SDKs such as mcp-golang and go-mcp. Thanks to their work, there is a thriving ecosystem of Go MCP clients and servers.

License

This project is licensed under Apache 2.0 for new contributions, with existing code under MIT - see the LICENSE file for details.

Release History

VersionChangesUrgencyDate
v1.6.1This 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. High5/22/2026
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 CredentiaHigh5/8/2026
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 baHigh4/7/2026
v1.5.0-pre.1In 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 publishedMedium3/31/2026
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 Low3/13/2026
v1.4.0This 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](https://modelcontextprotocol.iLow2/27/2026
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 https://github.com/modelcontextprotocolLow2/18/2026
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 * go.mod: upgrade to jsonschema v0.4.2 by @jba in https://github.com/modelcontextprotocol/go-sdk/pull/732 ## Enhancements * perf: add schema caching to avoid repeated reLow2/9/2026
v1.3.0-pre.1This 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 * go.mod: upgrade to jsonschema v0.4.2 by @jba in https://github.com/modelcontextprotocol/go-sdk/pull/732 ## Enhancements * perf: add schema caching to avoid repeated reflection by @SamMorrowDrums in https://github.com/modelcontextprotocol/go-sdk/pull/685 * mcp: add DLow1/27/2026
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](https://modelcontextprotocol.io/specification/2025-11-25/changelog) 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 Low12/22/2025
v1.2.0-pre.2This 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 https://github.com/modelcontextprotocol/go-sdk/pull/702 * mcp: switch icon theme to named string type by @findleyr in https://github.com/modelcontextprotocol/go-sdk/pull/733 ## New Contributors * @jonathanhefner made their first contribution in https://githLow12/20/2025
v1.2.0-pre.1This release adds partial support for the [2025-11-25 version](https://modelcontextprotocol.io/specification/2025-11-25/changelog) 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](https://github.com/modelcontextprotocol/go-sdk/issues?q=is%3Aissue%20state%3Aopen%20milestone%3Av1.2.0%20label%3Aproposal) included in thLow12/12/2025
v1.1.0This 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 desLow10/30/2025
v1.1.0-pre.2This change fixes a few bugs in v1.1.0-pre.1. We plan to release it as v1.1.0 later today or tomorrow. ## What's Changed * docs: document support for resumability and redelivery by @findleyr in https://github.com/modelcontextprotocol/go-sdk/pull/606 * mcp: establish the streamable client standalone SSE stream in Connect by @findleyr in https://github.com/modelcontextprotocol/go-sdk/pull/604 * mcp: don't persist failed streamable sessions by @findleyr in https://github.com/modelcontextprotoLow10/29/2025
v1.1.0-pre.1This 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 desLow10/23/2025
v1.0.0**This is a stable release of the Go SDK.** This release is functionally equivalent to v0.8.0, but formalizes a compatibility guarantee: **going forward we won’t make breaking API changes.** The API we have is not perfect, but it’s important that we commit to supporting it so that others can depend on the SDK without further churn. If we want to improve the current API in the future, we’ll do so in backward compatible ways, such as by deprecating and adding. For example, [#396](https://githubLow9/30/2025
v0.8.0This release exists to include the API change from #518, mentioned in the [v0.7.0 release](https://github.com/modelcontextprotocol/go-sdk/releases/tag/v0.7.0). It also includes a small change to remove extraneous API. This concludes our API audit. Barring a realization over the weekend, we will cut v1.0.0 and any further API changes will be handled in a backwards compatible way. ## API Changes - #518: JSON schema fields are relaxed to type `any`, to decouple the SDK's API from the `githLow9/26/2025
v0.7.0This release fixes a couple bugs related to the `StreamableClientTransport`, and relaxes it to be less strict so that it can talk to certain servers that don't perfectly conform to the spec. It also updates to `google/jsonschema-go@v0.3.0`, which includes a couple backwards incompatible bug fixes (see below). For more details, see the [v0.7.0 milestone](https://github.com/modelcontextprotocol/go-sdk/milestone/6?closed=1). ## API Changes No changes in the API of the SDK itself, but the uLow9/24/2025
v0.6.0This release makes a couple minor API tweaks that arose in preparation for v1.0.0, and adds significant feature documentation in the [`docs/`](/docs/) directory. This is a release candidate, and all release blocking issues have now been addressed. We will tag v1.0.0 following a final audit (see also #328). For more details, see the [v0.6.0 milestone](https://github.com/modelcontextprotocol/go-sdk/milestone/5?closed=1). ## API Changes - Remove the distinguished `StreamID` type, which Low9/19/2025
v0.5.0This release fixes several bugs related to schema validation, and makes the final set of breaking changes planned before the v1 release. For more details, see the [v0.5.0 milestone](https://github.com/modelcontextprotocol/go-sdk/milestone/4). ## API Changes - Removed transport constructors (#305). These were deprecated in #272, but we left the constructors so that they could more easily be inlined away via the `go:fix inline` directive and gopls. Now they are removed. - Removed supportLow9/12/2025
v0.4.0This release fixes several bugs, and expands on OAuth support and examples. It also makes a few (hopefully minor) API changes as we approach a release candidate (see #328). For more details, see the [v0.4.0 milestone](https://github.com/modelcontextprotocol/go-sdk/milestone/3). Thank you to all who tested the SDK, filed bugs, and contributed. ## API Changes This release includes the following incompatible changes: - `mcp.CallToolRequest` now holds an `mcp.CallToolParamsRaw`, to avLow9/5/2025
v0.3.1This release fixes some bugs in v0.3.0: - A jsonschema caching bug leading to potentially incorrect inference (https://github.com/modelcontextprotocol/go-sdk/issues/366) - A panic in ClientSession.Complete (https://github.com/modelcontextprotocol/go-sdk/issues/375) - A panic with custom resource URIs (https://github.com/modelcontextprotocol/go-sdk/pull/365) - Incorrect rejection of HTTP DELETE without an Accept header in the streamable server transport (https://github.com/modelcontextprotoLow8/29/2025
v0.3.0This version of the SDK contains many bug fixes and new features. It is largely feature-complete, though see known limitations below. It also contains significant API changes from v0.2.0, detailed in the next section. As outlined in #328, we have adjusted our target for v1.0.0 back to September, primarily because of the late API changes below. It is expected that the API in this release is largely finalized, though we may make additional changes between now and the first release candidate. IfLow8/22/2025
v0.2.0## Breaking Changes * The plural `Server.AddXXX` methods have been removed, along with the `ServerXXX` types and the `NewServerTool` function. Instead use the singular `Server` methods `AddTool`, `AddPrompt`, `AddResource` and `AddResourceTemplate`. The `AddTool` function partially replaces `NewServerTool`. * All `ToolOption`s have been removed. Instead, construct a `jsonschema.Schema` directly, using a struct literal for example, or infer a schema from a struct with `jsonschema.For[T]`Low7/11/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

mcp-tidy🧹 Simplify your MCP servers with mcp-tidy, clearing server bloat to enhance performance and improve tool selection in Claude Code.main@2026-06-07
Paylink🌐 Simplify payment processing with PayLink, a unified API for multi-provider checkouts, ensuring reliable transactions and seamless integration.main@2026-06-06
musterMCP tool management and workflow proxyv0.3.1
tekmetric-mcp🔍 Ask questions about your shop data in natural language and get instant answers about appointments, customers, and repair orders with Tekmetric MCP.main@2026-06-05
whatsapp-agentkitBuild custom WhatsApp AI agents with Claude Code in under 30 minutes, no coding needed.main@2026-06-05

More from modelcontextprotocol

python-sdkThe official Python SDK for Model Context Protocol servers and clients
typescript-sdkThe official TypeScript SDK for Model Context Protocol servers and clients
modelcontextprotocolSpecification and documentation for the Model Context Protocol
registryA community driven registry service for Model Context Protocol (MCP) servers.

More in MCP Servers

claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.
langchain4jLangChain4j is an open-source Java library that simplifies the integration of LLMs into Java applications through a unified API, providing access to popular LLMs and vector databases. It makes impleme
ms-365-mcp-serverA Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API
PlanExeCreate a plan from a description in minutes