MCP.so
Sign In
Servers

Go-MCP

@virgoC0der

Make your own MCP servers with Golang

Overview

What is Go-MCP?

Go-MCP is a Go implementation of the Model Context Protocol (MCP), a protocol for building AI services. It defines three core primitives: Prompts, Tools, and Resources. It provides a type-safe API with multiple transport options and unified response handling.

How to use Go-MCP?

Install via go get github.com/virgoC0der/go-mcp. Create a server by implementing the MCPService interface and calling mcp.NewServer with options like Address and Type. Create a client with mcp.NewClient, connect, and use the service interface to interact with prompts, tools, and resources.

Key features of Go-MCP

  • Complete MCP protocol implementation with JSON-RPC 2.0 support
  • Type-safe API with interfaces for Prompts, Tools, and Resources
  • Multiple transport options: HTTP, SSE, WebSocket, and stdio
  • Unified response structure across all transport layers
  • Cursor-based pagination for list operations
  • Change notifications and resource subscriptions

Use cases of Go-MCP

  • Build an AI service that exposes prompts, tools, and resources via MCP
  • Create a client to interact with any MCP-compatible server
  • Develop a custom server for an application like a weather service or app launcher
  • Integrate paginated resource listing into an AI assistant workflow

FAQ from Go-MCP

What transports does Go-MCP support?

Go-MCP supports HTTP, SSE (Server-Sent Events), WebSocket, and stdio transports, configurable via the Type option in server and client options.

Does Go-MCP support pagination?

Yes. All list operations (ListPrompts, ListTools, ListResources) use cursor-based pagination. The client can pass an empty cursor for the first page and use NextCursor from the result to fetch subsequent pages.

Can I subscribe to resource changes?

Yes. Go-MCP supports resource subscriptions via the SubscribeToResource method on the service interface. The server must declare the Subscribe capability.

What MCP specification version is implemented?

Go-MCP has been updated to support the Model Context Protocol 2025-03-26 specification, including JSON-RPC 2.0, enhanced multimodal content, and rich server capability declarations.

Is JSON-RPC supported?

Yes. Go-MCP provides full JSON-RPC 2.0 support with

More from Other