11<!-- Autogenerated by weave; DO NOT EDIT -->
2- # MCP Go SDK
2+ # MCP Go SDK v0.2.0
3+
4+ *** BREAKING CHANGES***
5+
6+ This version contains breaking changes.
7+ See the [ release notes] (
8+ https://github.com/modelcontextprotocol/go-sdk/releases/tag/v0.2.0 ) for details.
39
410[ ![ PkgGoDev] ( https://pkg.go.dev/badge/github.com/modelcontextprotocol/go-sdk )] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk )
511
@@ -26,7 +32,7 @@ open-ended discussion. See CONTRIBUTING.md for details.
2632
2733## Package documentation
2834
29- The SDK consists of two importable packages:
35+ The SDK consists of three importable packages:
3036
3137- The
3238 [ ` github.com/modelcontextprotocol/go-sdk/mcp ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp )
@@ -36,6 +42,10 @@ The SDK consists of two importable packages:
3642 [ ` github.com/modelcontextprotocol/go-sdk/jsonschema ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/jsonschema )
3743 package provides an implementation of [ JSON
3844 Schema] ( https://json-schema.org/ ) , used for MCP tool input and output schema.
45+ - The
46+ [ ` github.com/modelcontextprotocol/jsonrpc ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/jsonschema ) package is for users implementing
47+ their own transports.
48+
3949
4050## Example
4151
@@ -57,7 +67,7 @@ func main() {
5767 ctx := context.Background ()
5868
5969 // Create a new client, with no features.
60- client := mcp.NewClient (" mcp-client" , " v1.0.0" , nil )
70+ client := mcp.NewClient (&mcp. Implementation {Name: " mcp-client" , Version: " v1.0.0" } , nil )
6171
6272 // Connect to a server over stdin/stdout
6373 transport := mcp.NewCommandTransport (exec.Command (" myserver" ))
@@ -99,7 +109,7 @@ import (
99109)
100110
101111type HiParams struct {
102- Name string ` json:"name"`
112+ Name string ` json:"name", mcp:"the name of the person to greet" `
103113}
104114
105115func SayHi (ctx context .Context , cc *mcp .ServerSession , params *mcp .CallToolParamsFor [HiParams ]) (*mcp .CallToolResultFor [any ], error ) {
@@ -110,12 +120,9 @@ func SayHi(ctx context.Context, cc *mcp.ServerSession, params *mcp.CallToolParam
110120
111121func main () {
112122 // Create a server with a single tool.
113- server := mcp.NewServer (" greeter" , " v1.0.0" , nil )
114- server.AddTools (
115- mcp.NewServerTool (" greet" , " say hi" , SayHi, mcp.Input (
116- mcp.Property (" name" , mcp.Description (" the name of the person to greet" )),
117- )),
118- )
123+ server := mcp.NewServer (&mcp.Implementation {Name: " greeter" , Version: " v1.0.0" }, nil )
124+
125+ mcp.AddTool (server, &mcp.Tool {Name: " greet" , Description: " say hi" }, SayHi)
119126 // Run the server over stdin/stdout, until the client disconnects
120127 if err := server.Run (context.Background (), mcp.NewStdioTransport ()); err != nil {
121128 log.Fatal (err)
0 commit comments