mcp-go
MIT-licensed Go implementation of the Model Context Protocol for building MCP servers and clients with tools, resources, prompts, stdio, SSE, Streamable HTTP, hooks, session management, validation, sampling, roots, and tracing.
Open the source and read safety notes before installing.
Safety notes
- mcp-go is a library for exposing application behavior through MCP; the risk depends on the tools, resources, prompts, and transports built with it.
- Treat tool handlers like API endpoints: validate inputs, enforce authorization, bound side effects, and return safe errors.
- Use stdio for local-only workflows when possible; add authentication, TLS, rate limits, request logging, and origin controls for HTTP or SSE deployments.
- Session, hook, task, sampling, roots, and tracing features can affect control flow or expose extra context, so review them before production use.
Privacy notes
- MCP servers built with mcp-go may expose resource contents, tool arguments, prompt templates, request metadata, session state, traces, logs, and application errors to MCP clients and model providers.
- Do not include secrets, internal identifiers, customer data, or privileged paths in tool descriptions, validation errors, logs, traces, or examples.
- Network transports can expose MCP traffic beyond the local machine; document data retention, authentication, and observability behavior for each deployment.
Prerequisites
- Go toolchain compatible with the module's current `go.mod` requirements.
- A defined MCP client boundary, such as stdio for local clients or Streamable HTTP/SSE for networked clients.
- Reviewed tool, resource, and prompt schemas before exposing application behavior to LLM clients.
- Authentication, authorization, and transport security plan for any non-local MCP server.
Schema details
- Install type
- cli
- Troubleshooting
- No
- Scope
- Source repo
- Estimated setup
- 10 minutes
- Difficulty
- intermediate
- Website
- https://mcp-go.dev/
- Pricing
- free
- Disclosure
- editorial
- Application category
- DeveloperApplication
- Operating system
- Cross-platform
Full copyable content
go get github.com/mark3labs/mcp-goAbout this resource
Overview
mcp-go is a Go SDK for building Model Context Protocol servers and clients. It
provides high-level APIs for defining tools, resources, prompts, request
handlers, transports, sessions, hooks, task-augmented tools, sampling, roots,
validation, and tracing.
Use it when a Go service needs to expose data or actions to Claude, Cursor, Codex, VS Code, custom MCP hosts, or another MCP-compatible client without hand-rolling the JSON-RPC protocol layer.
Core Capabilities
| Area | mcp-go Coverage |
|---|---|
| Servers | server.NewMCPServer, tool/resource/prompt registration, request routing, recovery, and server options |
| Tools | Typed tool schemas, argument helpers, handlers, validation, task tools, and middleware hooks |
| Resources | Static resources, dynamic resource templates, MIME types, and resource handlers |
| Prompts | Reusable prompt templates and prompt handlers |
| Transports | stdio, SSE, Streamable HTTP, in-process sessions, and transport options |
| Protocol Features | Session management, sampling, roots, elicitation, OAuth protected-resource metadata, and notifications |
| Testing/Operations | Test helpers, tracing, hooks, output validation, panic recovery tests, and concurrency coverage |
Quick Start
Install the module:
go get github.com/mark3labs/mcp-go
A minimal stdio server defines a tool and handler:
package main
import (
"context"
"fmt"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
)
func main() {
s := server.NewMCPServer(
"Demo",
"1.0.0",
server.WithToolCapabilities(false),
)
tool := mcp.NewTool("hello_world",
mcp.WithDescription("Say hello to someone"),
mcp.WithString("name", mcp.Required()),
)
s.AddTool(tool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
name, err := request.RequireString("name")
if err != nil {
return mcp.NewToolResultError(err.Error()), nil
}
return mcp.NewToolResultText(fmt.Sprintf("Hello, %s!", name)), nil
})
if err := server.ServeStdio(s); err != nil {
panic(err)
}
}
MCP Fit
Go teams can use mcp-go to expose existing service logic as MCP tools,
resources, and prompts while keeping protocol handling in a library. The same
server can start as a local stdio integration for desktop clients and later
move to Streamable HTTP or SSE when a hosted boundary is needed.
Because MCP tools are action surfaces, treat each handler with the same rigor as an internal API endpoint: validation, authorization, observability, and clear side-effect boundaries matter.
Use Cases
- Build a Go MCP server around internal APIs, CLIs, databases, or developer tools.
- Expose structured resources from a Go service to MCP-compatible clients.
- Add MCP support to an existing Go daemon or developer platform.
- Prototype stdio MCP servers before deploying a network transport.
- Use testing helpers and validation to keep tool schemas stable.
Source Review
Verified on 2026-06-18:
- The upstream README describes
mcp-goas a Go implementation of the Model Context Protocol with tools, resources, prompts, transports, session management, hooks, OAuth protected-resource metadata, and code generation notes. go.moddeclares the module pathgithub.com/mark3labs/mcp-goand current Go/dependency requirements.- GitHub reports MIT licensing and active development for
mark3labs/mcp-go. - pkg.go.dev resolves package documentation for
github.com/mark3labs/mcp-go.
Safety and Privacy
mcp-go itself is a library. The sensitive part is the server you build with
it. Keep tool handlers narrow, validate all arguments, avoid broad filesystem or
network access by default, and add explicit authentication before exposing
HTTP/SSE transports outside localhost.
Be careful with generated tool descriptions and error messages: they become model-visible context. Avoid leaking secrets, internal identifiers, private paths, customer records, or privileged operational details through schemas, logs, traces, or validation errors.
Duplicate Check
Checked current content/mcp/, content/tools/, content/skills/, open pull
requests, and repository-wide content for mark3labs/mcp-go, mcp-go, Go MCP
SDK, Golang MCP server, Model Context Protocol Go, Go MCP client, Streamable
HTTP MCP Go, and MCP tools Go. No dedicated mcp-go entry, exact source URL
duplicate, target file, or open duplicate PR was found.
Source citations
Add this badge to your README
How it compares
mcp-go side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | mcp-go MIT-licensed Go implementation of the Model Context Protocol for building MCP servers and clients with tools, resources, prompts, stdio, SSE, Streamable HTTP, hooks, session management, validation, sampling, roots, and tracing. Open dossier | Official MCP Go SDK Official Go SDK for Model Context Protocol servers and clients, maintained by the MCP project in collaboration with Google, with packages for MCP, JSON-RPC, OAuth primitives, OAuth protected-resource metadata, clients, servers, transports, examples, and conformance work. Open dossier | Official MCP Java SDK Official Java SDK for Model Context Protocol clients and servers, maintained in collaboration with Spring AI, with Java 17+ support, Maven artifacts, synchronous and asynchronous APIs, Reactive Streams, Project Reactor, JDK HttpClient, Servlet transport, JSON binding modules, and conformance tests. Open dossier | Official MCP Python SDK Official Python SDK for Model Context Protocol clients and servers, published as the `mcp` package on PyPI, with FastMCP server helpers, client support, tools, resources, prompts, stdio, SSE, Streamable HTTP, authentication, elicitation, sampling, logging, and standalone development tools. Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Category | tools | tools | tools | tools |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | mark3labs | Model Context Protocol | Model Context Protocol | Model Context Protocol |
| Added | 2026-06-18 | 2026-06-18 | 2026-06-18 | 2026-06-18 |
| Platforms | CLI | CLI | CLI | CLI |
| Source repo | — | — | — | — |
| Safety notes | ✓mcp-go is a library for exposing application behavior through MCP; the risk depends on the tools, resources, prompts, and transports built with it. Treat tool handlers like API endpoints: validate inputs, enforce authorization, bound side effects, and return safe errors. Use stdio for local-only workflows when possible; add authentication, TLS, rate limits, request logging, and origin controls for HTTP or SSE deployments. Session, hook, task, sampling, roots, and tracing features can affect control flow or expose extra context, so review them before production use. | ✓The official Go SDK is a protocol library; the risk is in the MCP clients, servers, tools, resources, prompts, and transports you build with it. Validate inputs, enforce capability checks, and bound side effects for every tool handler. Use local transports for local-only integrations, and add authentication, TLS, authorization, logging, and rate limits before exposing network transports. OAuth and protected-resource metadata are security-sensitive surfaces; test them against the current MCP specification and client expectations. | ✓The official Java SDK is a protocol library; production risk comes from your MCP tools, resources, prompts, transports, authorization hooks, and framework integration. Validate tool inputs, enforce caller permissions, bound side effects, and avoid returning raw Java exceptions or internal stack details to MCP clients. Servlet, Spring, and remote transport deployments need authentication, TLS, request limits, observability policy, cancellation behavior, and abuse protection. Spring AI MCP security and annotation support may simplify integration, but application owners still need to review authorization, tenant boundaries, and data retention. | ✓The official Python SDK is a protocol library; risk comes from the tools, resources, prompts, transports, auth flows, and server process you build with it. Validate all tool inputs, enforce caller permissions, bound file and network access, and sanitize errors before returning them to an MCP client. HTTP, SSE, and ASGI deployments need authentication, TLS, CORS review, host/path routing controls, request limits, logging policy, and abuse protection. The upstream README says v2 is alpha; production projects should stay on the stable v1 line unless they intentionally pin and test a pre-release. |
| Privacy notes | ✓MCP servers built with mcp-go may expose resource contents, tool arguments, prompt templates, request metadata, session state, traces, logs, and application errors to MCP clients and model providers. Do not include secrets, internal identifiers, customer data, or privileged paths in tool descriptions, validation errors, logs, traces, or examples. Network transports can expose MCP traffic beyond the local machine; document data retention, authentication, and observability behavior for each deployment. | ✓MCP clients and servers built with the SDK may expose request metadata, tool arguments, tool results, resource contents, prompt templates, OAuth state, errors, traces, and logs. Do not leak private resource contents, customer data, internal identifiers, tokens, privileged paths, or operational metadata in schemas, error messages, examples, or logs. Document which model provider, client, server, and transport can observe each request before deploying outside localhost. | ✓Java MCP clients and servers may expose tool arguments, tool results, resource contents, prompt templates, request metadata, correlation IDs, logs, traces, and authorization context. Avoid leaking secrets, customer data, private resources, internal identifiers, stack traces, privileged paths, or token values through schemas, responses, errors, or logs. Document which MCP client, server process, Java framework, model provider, transport, and observability system can observe each request. | ✓MCP Python servers may expose local files, application data, tool arguments, tool results, resource contents, prompt templates, authentication state, logs, traces, and errors. Do not leak secrets, customer data, private paths, internal identifiers, token values, or privileged resource contents through schemas, examples, responses, or logs. Document which MCP client, model provider, server process, transport, ASGI layer, and observability system can observe each request. |
| Prerequisites |
|
|
|
|
| Install | | | | |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.