Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

modelcontextprotocol/go-sdk

AI Engineering

Official Go SDK for building MCP servers and clients, with packages for JSON-RPC transports and OAuth support.

5,342
617
Go
NOASSERTION
1 year old

What this project is

The Go SDK is the official Go implementation of the Model Context Protocol (MCP), maintained with Google. It provides importable packages for building MCP servers and clients: mcp for the primary client/server APIs, jsonrpc for custom transports, and auth/oauthex for OAuth support Package documentation. It targets Go developers who want MCP-compatible tool servers or clients rather than hand-rolling the protocol.

Getting started

Create an mcp.Server, register tools, then run it over an mcp.Transport. The README's stdin/stdout example defines a greet tool using typed input/output structs with jsonschema tags Getting started:

server := mcp.NewServer(&mcp.Implementation{Name: "greeter", Version: "v1.0.0"}, nil)
mcp.AddTool(server, &mcp.Tool{Name: "greet", Description: "say hi"}, SayHi)
if err := server.Run(context.Background(), &mcp.StdioTransport{}); err != nil {
    log.Fatal(err)
}

A client connects with mcp.CommandTransport, calls session.CallTool, and reads mcp.TextContent from the result Getting started. Run the server binary and point the client's exec.Command at it; adjust the command name and tool arguments to your implementation. More complete clients and servers are in the examples directory. The official MCP site is the reference for the protocol itself.

Compatibility

The SDK maps versions to MCP specification versions: v1.7.0+ targets the 2026-07-28 spec and supports several earlier revisions; v1.4.0–v1.6.1 target 2025-11-25, and v1.0.0–v1.1.0 target 2025-06-18 version table. Client-side OAuth is experimental in some releases, and older versions have partial 2025-11-25 support. Roots, sampling, and logging are deprecated as of protocol 2026-07-28 by SEP-2577 and remain supported for a compatibility window of at least twelve months deprecation notice. Releases target only supported Go versions, so check the Go release policy before pinning an older toolchain Go release policy.

Licensing

The project uses Apache 2.0 for new contributions, with existing code under MIT; the full terms are in the license file.

HotRepo's take

The repository has a recorded Go daily list entry on 2026-11-13 at 7th place with 4 stars gained that day and about 5.3k total stars. That is a modest daily movement on a long-running official SDK rather than a breakout, which is consistent with infrastructure code seeing steady use. No all-languages daily rank is recorded, so the Go-list position is the only HotRepo ranking evidence available.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

You might also like

  1. modelcontextprotocol/java-sdkLets JVM applications expose tools to, or call tools from, AI models over the Model Context Protocol.Java3,743
  2. github/github-mcp-serverConnects AI coding agents to GitHub repositories, issues, PRs and Actions through the Model Context Protocol.Go33,925
  3. github/copilot-sdkEmbed GitHub Copilot's agent loop in your own app without building orchestration, for teams with Copilot access or their own model keys.Java10,586
  4. googleapis/google-cloud-goOfficial Go client libraries for Google Cloud services such as Firestore, Storage and Pub/Sub.Go4,553
  5. ValveSoftware/source-sdk-2013Game code for Half-Life 2, HL2: DM and Team Fortress 2, for building Source engine mods on Windows or Linux.C++10,108