| Filename | Latest commit message | Latest commit date |
|---|---|---|
Add a framework for feature documentation, and start populating it with our SDK documentation. This framework is as follows: - internal/docs/**.src.md is the markdown source for the docs/ directory. - The x/example/internal/cmd/weave tool is used to compile these docs to the top-level docs, supporting both linked code samples and generated tables of contents. - The readme-check workflow is updated to check these docs as well. - The structure of these docs follows the MCP spec. - Wherever possible, example code is linked from actual Go documentation examples, so that it is testable. Some minor modifications to the weave tool were made to support this framework. Additionally, partially fill out this documentation with content on base protocol and client features, as well as troubleshooting help. Along the way, a bug was encountered that our LoggingTransport was not concurrency safe. This is fixed with a mutex. Fixes https://github.com/modelcontextprotocol/go-sdk/issues/466 Fixes https://github.com/modelcontextprotocol/go-sdk/issues/409 Updates https://github.com/modelcontextprotocol/go-sdk/issues/442 |
||
| .. | ||
| client | ||
| server | ||
| doc.go | ||
| README.src.md | ||
MCP Go SDK v0.5.0
BREAKING CHANGES
This version contains breaking changes. See the release notes for details.
This repository contains an unreleased implementation of the official Go software development kit (SDK) for the Model Context Protocol (MCP).
Warning
The SDK is not yet at v1.0.0 and may still be subject to incompatible API changes. We aim to tag v1.0.0 in September, 2025. See https://github.com/modelcontextprotocol/go-sdk/issues/328 for details.
Package documentation
The SDK consists of three importable packages:
- The
github.com/modelcontextprotocol/go-sdk/mcppackage defines the primary APIs for constructing and using MCP clients and servers. - The
github.com/modelcontextprotocol/go-sdk/jsonrpcpackage is for users implementing their own transports. - The
github.com/modelcontextprotocol/go-sdk/authpackage provides some primitives for supporting oauth.
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:
%include server/server.go -
To communicate with that server, we can similarly create an mcp.Client and
connect it to the corresponding server, by running the server command and
communicating over its stdin/stdout:
%include client/client.go -
The examples/ directory contains more example clients and
servers.
Design
The design doc for this SDK is at design.md, which was initially reviewed at modelcontextprotocol/discussions/364.
Further design discussion should occur in issues (for concrete proposals) or discussions for open-ended discussion. See CONTRIBUTING.md for details.
Acknowledgements
Several existing Go MCP SDKs inspired the development and design of this official SDK, notably mcp-go, 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 the MIT License - see the LICENSE file for details.