SDK Guide

Go MCP SDK: Complete Developer Guide

Go MCP SDK is covered here as a Model Context Protocol SDK guide page: what it is, how it works, when to use it, how to configure it safely, and how to verify the result. The guidance is grounded in the official MCP specification, SDK documentation, and vendor

Overview

The Go MCP SDK is the official library for building MCP servers in Go. It supports tools, resources, prompts, transports, and the stdio and streamable-http transport.

Installation

go get github.com/modelcontextprotocol/go-sdk

Minimal Server Example

server := mcp.NewServer("my-server", "1.0.0")

server.AddTool(mcp.Tool{
    Name:        "add",
    Description: "Add two numbers",
    InputSchema: mcp.ToolInputSchema{
        Type: "object",
        Properties: map[string]any{
            "a": map[string]any{"type": "number"},
            "b": map[string]any{"type": "number"},
        },
    },
}, func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
    a := req.Params.Arguments["a"].(float64)
    b := req.Params.Arguments["b"].(float64)
    return mcp.NewToolResultText(fmt.Sprintf("%v", a+b)), nil
})

Adding a Tool

Tools are the primary way MCP servers expose functionality to clients. Each tool has a name, input schema, and handler function.

// Add more tools with server.AddTool(...)

Supported Features

tools
resources
prompts
transports

Testing Your Server

  1. Start the server and verify it prints no startup errors.
  2. Run npx @modelcontextprotocol/inspector and connect over stdio.
  3. Call your tools and verify they return the expected responses.
  4. Connect from Claude Desktop and confirm tool visibility.
M
MCPServer.in Editorial

Editorial Team

Published: 2026-08-05
Updated: 2026-08-05

References & Technical Specifications

Frequently Asked Questions

Contextual information and technical support details regarding Model Context Protocol integration