11<!-- Autogenerated by weave; DO NOT EDIT -->
2- # MCP Go SDK v0.5.0
2+ # MCP Go SDK
33
44[ ![ Open in GitHub Codespaces] ( https://github.com/codespaces/badge.svg )] ( https://codespaces.new/modelcontextprotocol/go-sdk )
55
6- *** BREAKING CHANGES***
7-
8- This version contains breaking changes.
9- See the [ release notes] (
10- https://github.com/modelcontextprotocol/go-sdk/releases/tag/v0.5.0 ) for details.
11-
126[ ![ PkgGoDev] ( https://pkg.go.dev/badge/github.com/modelcontextprotocol/go-sdk )] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk )
137
14- This repository contains an unreleased implementation of the official Go
15- software development kit (SDK) for the Model Context Protocol (MCP).
8+ This repository contains an implementation of the official Go software
9+ development kit (SDK) for the Model Context Protocol (MCP).
1610
17- > [ !WARNING]
18- > The SDK is not yet at v1.0.0 and may still be subject to incompatible API
19- > changes. We aim to tag v1.0.0 in September, 2025. See
20- > https://github.com/modelcontextprotocol/go-sdk/issues/328 for details.
21-
22- ## Package documentation
11+ ## Package / Feature documentation
2312
2413The SDK consists of several importable packages:
2514
@@ -32,12 +21,14 @@ The SDK consists of several importable packages:
3221 their own transports.
3322- The
3423 [ ` github.com/modelcontextprotocol/go-sdk/auth ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/auth )
35- package provides some primitives for supporting oauth.
36-
24+ package provides some primitives for supporting OAuth.
3725- The
3826 [ ` github.com/modelcontextprotocol/go-sdk/oauthex ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/oauthex )
3927 package provides extensions to the OAuth protocol, such as ProtectedResourceMetadata.
4028
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+
4132## Getting started
4233
4334To get started creating an MCP server, create an ` mcp.Server ` instance, add
@@ -63,24 +54,28 @@ type Output struct {
6354 Greeting string ` json:"greeting" jsonschema:"the greeting to tell to the user"`
6455}
6556
66- func SayHi (ctx context .Context , req *mcp .CallToolRequest , input Input ) (*mcp .CallToolResult , Output , error ) {
57+ func SayHi (ctx context .Context , req *mcp .CallToolRequest , input Input ) (
58+ *mcp.CallToolResult,
59+ Output,
60+ error,
61+ ) {
6762 return nil , Output{Greeting: " Hi " + input.Name }, nil
6863}
6964
7065func main () {
7166 // Create a server with a single tool.
7267 server := mcp.NewServer (&mcp.Implementation {Name: " greeter" , Version: " v1.0.0" }, nil )
7368 mcp.AddTool (server, &mcp.Tool {Name: " greet" , Description: " say hi" }, SayHi)
74- // Run the server over stdin/stdout, until the client disconnects
69+ // Run the server over stdin/stdout, until the client disconnects.
7570 if err := server.Run (context.Background (), &mcp.StdioTransport {}); err != nil {
7671 log.Fatal (err)
7772 }
7873}
7974```
8075
81- To communicate with that server, we can similarly create an ` mcp.Client ` and
82- connect it to the corresponding server, by running the server command and
83- communicating over its stdin/stdout:
76+ To communicate with that server, create an ` mcp.Client ` and connect it to the
77+ corresponding server, by running the server command and communicating over its
78+ stdin/stdout:
8479
8580``` go
8681package main
@@ -99,7 +94,7 @@ func main() {
9994 // Create a new client, with no features.
10095 client := mcp.NewClient (&mcp.Implementation {Name: " mcp-client" , Version: " v1.0.0" }, nil )
10196
102- // Connect to a server over stdin/stdout
97+ // Connect to a server over stdin/stdout.
10398 transport := &mcp.CommandTransport {Command: exec.Command (" myserver" )}
10499 session , err := client.Connect (ctx, transport, nil )
105100 if err != nil {
@@ -128,24 +123,18 @@ func main() {
128123The [ ` examples/ ` ] ( /examples/ ) directory contains more example clients and
129124servers.
130125
131- ## Design
132-
133- The design doc for this SDK is at [ design.md] ( ./design/design.md ) , which was
134- initially reviewed at
135- [ modelcontextprotocol/discussions/364] ( https://github.com/orgs/modelcontextprotocol/discussions/364 ) .
126+ ## Contributing
136127
137- Further design discussion should occur in
138- [ issues] ( https://github.com/modelcontextprotocol/go-sdk/issues ) (for concrete
139- proposals) or
140- [ discussions] ( https://github.com/modelcontextprotocol/go-sdk/discussions ) for
141- open-ended discussion. See [ CONTRIBUTING.md] ( /CONTRIBUTING.md ) for details.
128+ We welcome contributions to the SDK! Please see See
129+ [ CONTRIBUTING.md] ( /CONTRIBUTING.md ) for details of how to contribute.
142130
143- ## Acknowledgements
131+ ## Acknowledgements / Alternatives
144132
145- Several existing Go MCP SDKs inspired the development and design of this
146- official SDK, notably [ mcp-go] ( https://github.com/mark3labs/mcp-go ) , authored
147- by Ed Zynda. We are grateful to Ed as well as the other contributors to mcp-go,
148- and to authors and contributors of other SDKs such as
133+ Several third party Go MCP SDKs inspired the development and design of this
134+ official SDK, and continue to be viable alternatives, notably
135+ [ mcp-go] ( https://github.com/mark3labs/mcp-go ) , originally authored by Ed Zynda.
136+ We are grateful to Ed as well as the other contributors to mcp-go, and to
137+ authors and contributors of other SDKs such as
149138[ mcp-golang] ( https://github.com/metoro-io/mcp-golang ) and
150139[ go-mcp] ( https://github.com/ThinkInAIXYZ/go-mcp ) . Thanks to their work, there
151140is a thriving ecosystem of Go MCP clients and servers.
0 commit comments