MCP ConfigsMay 12, 2026·2 min read

mcp-go — Build MCP Servers in Go

mcp-go is a Go SDK for building MCP servers (tools, resources, prompts) and serving them over stdio transports, so agents can call your Go code as tools.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Trust: Established
Entrypoint
Asset
Safe staging command
npx -y tokrepo@latest install cad7f465-8f0f-4455-b75b-704d94077c15 --target codex

Stages files first; activation requires review of the staged README and plan.

Intro

mcp-go is a Go SDK for building MCP servers (tools, resources, prompts) and serving them over stdio transports, so agents can call your Go code as tools.

  • Best for: Go teams who want first-class tool servers (strong typing, middleware, session handling) for agent workflows
  • Works with: Go 1.x toolchain, stdio MCP clients, server-side tool/resource/prompt patterns
  • Setup time: 12 minutes

Practical Notes

  • Quickstart includes a calculator tool example you can run in <15 minutes
  • The README contains multiple example sections (server/resources/tools/prompts/session management) you can copy incrementally

A Go-Native Pattern for Tool Design

Treat each MCP tool as a stable “function contract”:

  • Keep inputs small and typed (string/number/enum) so the agent can call it reliably.
  • Put your real side effects behind a thin validation layer.
  • Prefer idempotent operations (safe retries) and provide clear error messages.

Once you have one tool, scale to a toolkit:

  1. Add resources for read-only context (like listing projects or configs).
  2. Add tools for side effects (create/update/apply).
  3. Add prompts to encode standard operating procedures for your team.

That split (resources vs tools vs prompts) makes agent behavior easier to reason about and audit.

FAQ

Q: Is mcp-go only for servers? A: It’s primarily a server SDK; it helps you expose tools/resources/prompts to MCP clients.

Q: Do I need HTTP? A: No. The README quickstart uses stdio transport, which works with many clients.

Q: How do I keep tools safe? A: Validate inputs, keep side effects minimal, and prefer idempotent operations.

🙏

Source & Thanks

Source: https://github.com/mark3labs/mcp-go > License: MIT > GitHub stars: 8,682 · forks: 826

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets