| 1 | # MCP Go SDK |
| 2 | |
| 3 | [](https://codespaces.new/modelcontextprotocol/go-sdk) |
| 4 | |
| 5 | [](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk) |
| 6 | [](https://scorecard.dev/viewer/?uri=github.com/modelcontextprotocol/go-sdk) |
| 7 | |
| 8 | This repository contains an implementation of the official Go software |
| 9 | development kit (SDK) for the Model Context Protocol (MCP). |
| 10 | |
| 11 | ## Package / Feature documentation |
| 12 | |
| 13 | The SDK consists of several importable packages: |
| 14 | |
| 15 | - The |
| 16 | [`github.com/modelcontextprotocol/go-sdk/mcp`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp) |
| 17 | package defines the primary APIs for constructing and using MCP clients and |
| 18 | servers. |
| 19 | - The |
| 20 | [`github.com/modelcontextprotocol/go-sdk/jsonrpc`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/jsonrpc) package is for users implementing |
| 21 | their own transports. |
| 22 | - The |
| 23 | [`github.com/modelcontextprotocol/go-sdk/auth`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/auth) |
| 24 | package provides some primitives for supporting OAuth. |
| 25 | - The |
| 26 | [`github.com/modelcontextprotocol/go-sdk/oauthex`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/oauthex) |
| 27 | package provides extensions to the OAuth protocol, such as ProtectedResourceMetadata. |
| 28 | |
| 29 | The SDK endeavors to implement the full MCP spec. The [`docs/`](/docs/) directory |
| 30 | contains feature documentation, mapping the MCP spec to the packages above. |
| 31 | |
| 32 | ## Version Compatibility |
| 33 | |
| 34 | The following table shows which versions of the Go SDK support which versions of the MCP specification: |
| 35 | |
| 36 | | SDK Version | Latest MCP Spec | All Supported MCP Specs | |
| 37 | |-----------------|-------------------|----------------------------------------------------| |
| 38 | | v1.4.0+ | 2025-11-25\* | 2025-11-25\*, 2025-06-18, 2025-03-26, 2024-11-05 | |
| 39 | | v1.2.0 - v1.3.1 | 2025-11-25\*\* | 2025-11-25\*\*, 2025-06-18, 2025-03-26, 2024-11-05 | |
| 40 | | v1.0.0 - v1.1.0 | 2025-06-18 | 2025-06-18, 2025-03-26, 2024-11-05 | |
| 41 | |
| 42 | \* Client side OAuth has experimental support. |
| 43 | |
| 44 | \*\* Partial support for 2025-11-25 (client side OAuth and Sampling with tools not available). |
| 45 | |
| 46 | New releases of the SDK target only supported versions of Go. See |
| 47 | https://go.dev/doc/devel/release#policy for more information. |
| 48 | |
| 49 | ## Getting started |
| 50 | |
| 51 | To get started creating an MCP server, create an `mcp.Server` instance, add |
| 52 | features to it, and then run it over an `mcp.Transport`. For example, this |
| 53 | server adds a single simple tool, and then connects it to clients over |
| 54 | stdin/stdout: |
| 55 | |
| 56 | %include server/server.go - |
| 57 | |
| 58 | To communicate with that server, create an `mcp.Client` and connect it to the |
| 59 | corresponding server, by running the server command and communicating over its |
| 60 | stdin/stdout: |
| 61 | |
| 62 | %include client/client.go - |
| 63 | |
| 64 | The [`examples/`](/examples/) directory contains more example clients and |
| 65 | servers. |
| 66 | |
| 67 | ## Contributing |
| 68 | |
| 69 | We welcome contributions to the SDK! Please see |
| 70 | [CONTRIBUTING.md](/CONTRIBUTING.md) for details of how to contribute. |
| 71 | |
| 72 | ## Acknowledgements / Alternatives |
| 73 | |
| 74 | Several third party Go MCP SDKs inspired the development and design of this |
| 75 | official SDK, and continue to be viable alternatives, notably |
| 76 | [mcp-go](https://github.com/mark3labs/mcp-go), originally authored by Ed Zynda. |
| 77 | We are grateful to Ed as well as the other contributors to mcp-go, and to |
| 78 | authors and contributors of other SDKs such as |
| 79 | [mcp-golang](https://github.com/metoro-io/mcp-golang) and |
| 80 | [go-mcp](https://github.com/ThinkInAIXYZ/go-mcp). Thanks to their work, there |
| 81 | is a thriving ecosystem of Go MCP clients and servers. |
| 82 | |
| 83 | ## License |
| 84 | |
| 85 | This project is licensed under Apache 2.0 for new contributions, with existing |
| 86 | code under MIT - see the [LICENSE](./LICENSE) file for details. |