MCP Go Starter

MCP Go Starter

mcp-go-starter•bysammorrowdrums

A feature-complete Model Context Protocol server template in Go built on the official go-sdk, demonstrating tools, resources, templates, and prompts.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Registers example tools such as hello, get_weather, ask_llm, long_task, and load_bonus_tool with annotations and structured data.
  • •Exposes static and file-based resources along with resource templates for personalized greetings and data lookup by ID.
  • •Includes prompt templates for greetings in various styles and code review with focus areas.
  • •Runs the server over stdio for local development or HTTP for remote/web deployment.

BEST FOR

  • •Developers learning to build MCP servers in Go who want a working reference implementation.
  • •Teams needing a starting point that supports both local stdio and remote HTTP transports.

ABOUT MCP-GO-STARTER

MCP Go Starter is cataloged as an MCP server attributed to sammorrowdrums. A feature-complete Model Context Protocol server template in Go built on the official go-sdk, demonstrating tools, resources, templates, and prompts. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP Go Starter are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What transports does the starter support?

It provides stdio for local development and HTTP for remote or web deployment.

How does long_task report progress?

It sends progress notifications during a loop over five seconds before returning a completion result.

上游原版 README

在 GitHub 查看同一版本原文

README.md · c01e8c38ac3a · 采集于 2026-11-13 10:27:42 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP Go Starter

CI Go Report Card Go Version License: MIT MCP

A feature-complete Model Context Protocol (MCP) server template in Go using the official go-sdk. This starter demonstrates all major MCP features with clean, idiomatic Go code.

📚 Documentation

✨ Features

CategoryFeatureDescription
ToolshelloBasic tool with annotations
get_weatherTool returning structured data
ask_llmTool that invokes LLM sampling
long_taskTool with 5-second progress updates
load_bonus_toolDynamically loads a new tool
Resourcesinfo://aboutStatic informational resource
file://example.mdFile-based markdown resource
Templatesgreeting://{name}Personalized greeting
data://items/{id}Data lookup by ID
PromptsgreetGreeting in various styles
code_reviewCode review with focus areas

MCP sampling (ask_llm) is deprecated as of protocol version 2026-07-28 (SEP-2577). This workshop keeps the example during the supported deprecation window; new production servers should call LLM provider APIs directly.

🚀 Quick Start

Prerequisites

Air and goimports are pinned in tools/go.mod, including their transitive dependencies, and updated by Dependabot alongside the server modules. Install them with go -C tools install tool.

Installation

# Clone the repository
git clone https://github.com/SamMorrowDrums/mcp-go-starter.git
cd mcp-go-starter

# Download dependencies
go mod download

Running the Server

stdio transport (for local development):

go run ./cmd/stdio
# Or: make run-stdio

HTTP transport (for remote/web deployment):

go run ./cmd/http
# Or: make run-http
# Server runs on http://localhost:3000

The HTTP endpoint requires JSON requests and rejects cross-origin browser requests. Native MCP clients without an Origin header and same-origin browser clients remain supported.

Building Binaries

make build
# Creates bin/stdio and bin/http

🔧 VS Code Integration

This project includes VS Code configuration for seamless development:

  1. Open the project in VS Code
  2. The MCP configuration is in .vscode/mcp.json
  3. Build with Ctrl+Shift+B (or Cmd+Shift+B on Mac)
  4. Test the server using VS Code's MCP tools

Using DevContainers

  1. Install the Dev Containers extension
  2. Open command palette: "Dev Containers: Reopen in Container"
  3. Everything is pre-configured and ready to use!

📁 Project Structure

.
├── cmd/
│   ├── stdio/
│   │   └── main.go        # stdio transport entrypoint
│   └── http/
│       └── main.go        # HTTP transport entrypoint
├── internal/
│   └── server/
│       ├── server.go      # Server orchestration
│       ├── tools.go       # Tool definitions (hello, get_weather, etc.)
│       ├── resources.go   # Resource and template definitions
│       └── prompts.go     # Prompt definitions
├── .vscode/
│   ├── mcp.json           # MCP server configuration
│   ├── tasks.json         # Build/run tasks
│   └── extensions.json
├── .devcontainer/
│   └── devcontainer.json
├── .air.toml              # Live reload configuration
├── .golangci.yml          # Linter configuration
├── go.mod
├── Makefile
└── README.md

🛠️ Development

# Development with live reload (recommended)
make dev
# Requires air: go install github.com/air-verse/air@latest

# Run without live reload
make run-stdio

# Run tests
make test

# Format code
make fmt

# Lint code
make lint

# Install all dev tools
make install-tools

# Clean build artifacts
make clean

Live Reload

Install air for automatic rebuilds:

go install github.com/air-verse/air@latest
make dev

Changes to any .go file will automatically rebuild and restart the server.

🔍 MCP Inspector

The MCP Inspector is an essential development tool for testing and debugging MCP servers.

Running Inspector

npx @modelcontextprotocol/inspector -- go run ./cmd/stdio/main.go

What Inspector Provides

  • Tools Tab: List and invoke all registered tools with parameters
  • Resources Tab: Browse and read resources and templates
  • Prompts Tab: View and test prompt templates
  • Logs Tab: See JSON-RPC messages between client and server
  • Schema Validation: Verify tool input/output schemas

Debugging Tips

  1. Start Inspector before connecting your IDE/client
  2. Use the "Logs" tab to see exact request/response payloads
  3. Test tool annotations (ToolAnnotations) are exposed correctly
  4. Verify progress notifications appear for long_task
  5. Check that sampling works with ask_llm

📖 Feature Examples

Tool with Annotations

mcp.AddTool(server, &mcp.Tool{
    Name:        "hello",
    Title:       "Say Hello",
    Description: "A friendly greeting tool",
    Annotations: &mcp.ToolAnnotations{
        ReadOnlyHint: ptr(true),
    },
}, helloHandler)

func helloHandler(ctx context.Context, req *mcp.CallToolRequest, input helloInput) (*mcp.CallToolResult, any, error) {
    return &mcp.CallToolResult{
        Content: []mcp.Content{
            &mcp.TextContent{Text: fmt.Sprintf("Hello, %s!", input.Name)},
        },
    }, nil, nil
}

Resource Template

server.AddResourceTemplate(&mcp.ResourceTemplate{
    Name:        "Personalized Greeting",
    URITemplate: "greeting://{name}",
    MIMEType:    "text/plain",
}, greetingHandler)

Tool with Progress Updates

func longTaskHandler(ctx context.Context, req *mcp.CallToolRequest, input longTaskInput) (*mcp.CallToolResult, any, error) {
    progressToken := req.Params.GetProgressToken()
    
    for i := 0; i < 5; i++ {
        req.Session.NotifyProgress(ctx, &mcp.ProgressNotificationParams{
            ProgressToken: progressToken,
            Progress:      float64(i) / 5.0,
            Total:         1.0,
        })
        time.Sleep(time.Second)
    }
    
    return &mcp.CallToolResult{
        Content: []mcp.Content{&mcp.TextContent{Text: "Done!"}},
    }, nil, nil
}

Tool with Sampling

result, err := req.Session.CreateMessage(ctx, &mcp.CreateMessageParams{
    Messages: []*mcp.SamplingMessage{
        {Role: "user", Content: &mcp.TextContent{Text: prompt}},
    },
    MaxTokens: 100,
})

🔐 Environment Variables

Copy .env.example to .env and configure:

cp .env.example .env
VariableDescriptionDefault
PORTHTTP server port3000

🤝 Contributing

Contributions welcome! Please ensure your changes maintain feature parity with other language starters.

📄 License

MIT License - see LICENSE for details.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP Go Starter from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-go-starter)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools