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

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 94/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Mcp
Install
Single
Trust
Trust: Established
Entrypoint
README.md
Universal CLI install command
npx tokrepo install cad7f465-8f0f-4455-b75b-704d94077c15
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