Cette page est affichée en anglais. Une traduction française est en cours.
MCP ConfigsMay 12, 2026·2 min de lecture

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.

MCP Hub
MCP Hub · Community
Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 17/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
Mcp Config
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
Asset
Commande de staging sûr
npx -y tokrepo@latest install cad7f465-8f0f-4455-b75b-704d94077c15 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

Introduction

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 et remerciements

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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires