← Prompts
Reference / Understand Copilot Instructions Collection

Best practices and patterns for building Model Context Protocol (MCP) servers in...

Best practices and patterns for building Model Context Protocol (MCP) servers in Go using the official github.com/modelcontextprotocol/go-sdk package.

# Go MCP Server Development Guidelines

When building MCP servers in Go, follow these best practices and patterns using the official Go SDK.

## Server Setup

Create an MCP server using `mcp.NewServer`:

```go
import "github.com/modelcontextprotocol/go-sdk/mcp"

server := mcp.NewServer(
    &mcp.Implementation{
        Name:    "my-server",
        Version: "v1.0.0",
    },
    nil, // or provide mcp.Options
)
```

## Adding Tools

Use `mcp.AddTool` with struct-based input and output for type safety:

```go

Sign in to view the full prompt.

Sign In

Classification

Reference Documentation, cheatsheets, setup guides
Reference Understand
Explain or analyze
Scope Project
This codebase
Manual Manually placed / Persistent