modelcontextprotocol/go-sdk

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

What it solves

This SDK provides a standardized way for developers to build clients and servers that follow the Model Context Protocol (MCP). It eliminates the need to implement the protocol's communication logic from scratch, allowing developers to focus on creating the tools and resources that AI models can interact with.

How it works

The SDK provides a set of Go packages that implement the MCP specification. It allows developers to create an mcp.Server to define tools and resources, and an mcp.Client to connect to those servers. Communication is handled via transports, such as standard input/output (stdin/stdout) or custom JSON-RPC implementations.

Who it’s for

Go developers who want to integrate AI models with external data sources and tools using the Model Context Protocol.

Highlights

  • Full Spec Implementation: Aims to implement the complete MCP specification across multiple versions.
  • Bespoke Transports: Includes built-in support for StdioTransport and CommandTransport, with a jsonrpc package for creating custom transports.
  • OAuth Support: Provides primitives and extensions for supporting OAuth authentication.
  • Modular Design: Organized into separate packages for core API, JSON-RPC, and authentication.

Related

  • Project
  • Project
  • Project
  • Project
  • Project