Skip to main content
toolsSource-backedReview first Safety Privacy

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.

by mark3labs·added 2026-06-18·
HarnessCLI
Review first review before installing

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
Source repository stats
Scope
Source repo
Collection metadata
Estimated setup
10 minutes
Difficulty
intermediate
Tool listing metadata
Pricing
free
Disclosure
editorial
Application category
DeveloperApplication
Operating system
Cross-platform
Full copyable content
go get github.com/mark3labs/mcp-go

About 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-go as 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.mod declares the module path github.com/mark3labs/mcp-go and 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

Show that mcp-go is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/tools/mcp-go.svg)](https://heyclau.de/entry/tools/mcp-go)

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.

Fieldmcp-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 riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Categorytoolstoolstoolstools
Sourcesource-backedsource-backedsource-backedsource-backed
Authormark3labsModel Context ProtocolModel Context ProtocolModel Context Protocol
Added2026-06-182026-06-182026-06-182026-06-18
Platforms
CLI
CLI
CLI
CLI
Source repo
Safety notesmcp-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 notesMCP 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
  • 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.
  • Go toolchain compatible with the SDK's current `go.mod` requirement and Go support policy.
  • A target MCP spec version and compatibility plan for the clients or servers you need to support.
  • Authentication, authorization, and transport-security requirements for non-local MCP deployments.
  • Reviewed tool, resource, prompt, and OAuth behavior before exposing production services.
  • Java 17 or newer and a Maven or Gradle build configured for the selected SDK artifact version.
  • A choice of core Java SDK usage, Spring AI MCP integration, or both.
  • A target transport, such as stdio, JDK HttpClient, Servlet, WebFlux, WebMVC, or another framework path.
  • Authentication, authorization, and data-exposure requirements for production clients and servers.
  • Python 3.10 or newer and a project managed with uv, pip, or another Python package manager.
  • A decision between stable v1 usage and explicit v2 alpha testing with a pinned pre-release.
  • A target transport, such as stdio for local tools or Streamable HTTP for hosted MCP servers.
  • Clear authorization, side-effect, and data-exposure boundaries for production tools and resources.
Install
go get github.com/mark3labs/mcp-go
go get github.com/modelcontextprotocol/go-sdk
mvn dependency:get -Dartifact=io.modelcontextprotocol.sdk:mcp:2.0.0
uv add "mcp[cli]"
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.