{"id":29030759,"url":"https://github.com/modelcontextprotocol/go-sdk","last_synced_at":"2026-02-18T18:02:38.570Z","repository":{"id":301224744,"uuid":"971300888","full_name":"modelcontextprotocol/go-sdk","owner":"modelcontextprotocol","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-25T19:31:44.000Z","size":2689,"stargazers_count":22,"open_issues_count":26,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-25T19:38:16.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modelcontextprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-23T10:07:33.000Z","updated_at":"2025-06-25T19:31:48.000Z","dependencies_parsed_at":"2025-06-25T19:50:12.955Z","dependency_job_id":null,"html_url":"https://github.com/modelcontextprotocol/go-sdk","commit_stats":null,"previous_names":["modelcontextprotocol/go-sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/modelcontextprotocol/go-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Fgo-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Fgo-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Fgo-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Fgo-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modelcontextprotocol","download_url":"https://codeload.github.com/modelcontextprotocol/go-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modelcontextprotocol%2Fgo-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262043950,"owners_count":23249734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-26T10:00:31.065Z","updated_at":"2026-02-18T18:02:38.558Z","avatar_url":"https://github.com/modelcontextprotocol.png","language":"Go","funding_links":[],"categories":["Go","Repos","SDKs","📚 Projects (1974 total)","MCP Frameworks and libraries","Mcp Server Directories \u0026 Lists","📦 Other","MCP Ecosystem","Built With","MCP Servers \u0026 Protocol"],"sub_categories":["Official","MCP Servers","Go","Core \u0026 Frameworks","Running E2E Tests"],"readme":"\u003c!-- Autogenerated by weave; DO NOT EDIT --\u003e\n# MCP Go SDK\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/modelcontextprotocol/go-sdk)\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/modelcontextprotocol/go-sdk)](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk)\n\nThis repository contains an implementation of the official Go software\ndevelopment kit (SDK) for the Model Context Protocol (MCP).\n\n## Package / Feature documentation\n\nThe SDK consists of several importable packages:\n\n- The\n  [`github.com/modelcontextprotocol/go-sdk/mcp`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp)\n  package defines the primary APIs for constructing and using MCP clients and\n  servers.\n- The\n  [`github.com/modelcontextprotocol/go-sdk/jsonrpc`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/jsonrpc) package is for users implementing\n  their own transports.\n- The\n  [`github.com/modelcontextprotocol/go-sdk/auth`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/auth)\n  package provides some primitives for supporting OAuth.\n- The\n  [`github.com/modelcontextprotocol/go-sdk/oauthex`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/oauthex)\n  package provides extensions to the OAuth protocol, such as ProtectedResourceMetadata.\n\nThe SDK endeavors to implement the full MCP spec. The [`docs/`](/docs/) directory\ncontains feature documentation, mapping the MCP spec to the packages above.\n\n## Version Compatibility\n\nThe following table shows which versions of the Go SDK support which versions of the MCP specification:\n\n| SDK Version     | Latest MCP Spec   | All Supported MCP Specs                        |\n|-----------------|-------------------|------------------------------------------------|\n| v1.2.0+         | 2025-06-18        | 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 |\n| v1.0.0 - v1.1.0 | 2025-06-18        | 2025-06-18, 2025-03-26, 2024-11-05             |\n\nNew releases of the SDK target only supported versions of Go. See\nhttps://go.dev/doc/devel/release#policy for more information.\n\n## Getting started\n\nTo get started creating an MCP server, create an `mcp.Server` instance, add\nfeatures to it, and then run it over an `mcp.Transport`. For example, this\nserver adds a single simple tool, and then connects it to clients over\nstdin/stdout:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/modelcontextprotocol/go-sdk/mcp\"\n)\n\ntype Input struct {\n\tName string `json:\"name\" jsonschema:\"the name of the person to greet\"`\n}\n\ntype Output struct {\n\tGreeting string `json:\"greeting\" jsonschema:\"the greeting to tell to the user\"`\n}\n\nfunc SayHi(ctx context.Context, req *mcp.CallToolRequest, input Input) (\n\t*mcp.CallToolResult,\n\tOutput,\n\terror,\n) {\n\treturn nil, Output{Greeting: \"Hi \" + input.Name}, nil\n}\n\nfunc main() {\n\t// Create a server with a single tool.\n\tserver := mcp.NewServer(\u0026mcp.Implementation{Name: \"greeter\", Version: \"v1.0.0\"}, nil)\n\tmcp.AddTool(server, \u0026mcp.Tool{Name: \"greet\", Description: \"say hi\"}, SayHi)\n\t// Run the server over stdin/stdout, until the client disconnects.\n\tif err := server.Run(context.Background(), \u0026mcp.StdioTransport{}); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\nTo communicate with that server, create an `mcp.Client` and connect it to the\ncorresponding server, by running the server command and communicating over its\nstdin/stdout:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os/exec\"\n\n\t\"github.com/modelcontextprotocol/go-sdk/mcp\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\t// Create a new client, with no features.\n\tclient := mcp.NewClient(\u0026mcp.Implementation{Name: \"mcp-client\", Version: \"v1.0.0\"}, nil)\n\n\t// Connect to a server over stdin/stdout.\n\ttransport := \u0026mcp.CommandTransport{Command: exec.Command(\"myserver\")}\n\tsession, err := client.Connect(ctx, transport, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer session.Close()\n\n\t// Call a tool on the server.\n\tparams := \u0026mcp.CallToolParams{\n\t\tName:      \"greet\",\n\t\tArguments: map[string]any{\"name\": \"you\"},\n\t}\n\tres, err := session.CallTool(ctx, params)\n\tif err != nil {\n\t\tlog.Fatalf(\"CallTool failed: %v\", err)\n\t}\n\tif res.IsError {\n\t\tlog.Fatal(\"tool failed\")\n\t}\n\tfor _, c := range res.Content {\n\t\tlog.Print(c.(*mcp.TextContent).Text)\n\t}\n}\n```\n\nThe [`examples/`](/examples/) directory contains more example clients and\nservers.\n\n## Contributing\n\nWe welcome contributions to the SDK! Please see\n[CONTRIBUTING.md](/CONTRIBUTING.md) for details of how to contribute.\n\n## Acknowledgements / Alternatives\n\nSeveral third party Go MCP SDKs inspired the development and design of this\nofficial SDK, and continue to be viable alternatives, notably\n[mcp-go](https://github.com/mark3labs/mcp-go), originally authored by Ed Zynda.\nWe are grateful to Ed as well as the other contributors to mcp-go, and to\nauthors and contributors of other SDKs such as\n[mcp-golang](https://github.com/metoro-io/mcp-golang) and\n[go-mcp](https://github.com/ThinkInAIXYZ/go-mcp). Thanks to their work, there\nis a thriving ecosystem of Go MCP clients and servers.\n\n## License\n\nThis project is licensed under Apache 2.0 for new contributions, with existing\ncode under MIT - see the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelcontextprotocol%2Fgo-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodelcontextprotocol%2Fgo-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodelcontextprotocol%2Fgo-sdk/lists"}