mcp-go
mcp-go is a Go implementation of the Model Context Protocol (MCP) for connecting LLM applications to external data sources and tools, with a high-level API for building MCP servers.
Visit mark3labs/mcp-goOverview
mcp-go is a Go library for building MCP servers that expose tools, resources, and prompts to LLM applications. It handles protocol mechanics and server management so developers can focus on defining tool handlers and server capabilities.
Key Features
- High-level Go API for defining MCP servers, tools, resources, and prompts
- Minimal boilerplate with typed parameter helpers and handler routing
- Supports stdio, SSE, and streamable HTTP transports
- Includes session management, request hooks, and tool handler middleware
- Supports OAuth protected resource metadata via server helpers
- Includes task-augmented tools for asynchronous long-running operations
Use Cases
- Building Go-based MCP servers that expose tools to LLM applications
- Providing resources such as files, API responses, or database queries to LLM context
- Defining reusable prompt templates for LLM interactions
- Running long-running operations as task-augmented tools with polling
Getting Started
- Install the library with go get github.com/mark3labs/mcp-go.
- Create a server with server.NewMCPServer, define tools with mcp.NewTool, register handlers with AddTool, and serve over stdio with server.ServeStdio.
Before You Adopt
- License: MIT. Review its terms before using, modifying, or distributing the project.
- The library and the MCP specification are both described as under active development, with some advanced capabilities still in progress.
- The project describes full core MCP specification support as an aim rather than a completed guarantee.