Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v0.3.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mcp provides a small JSON-RPC 2.0 MCP server over stdio.

Index

Constants

View Source
const LegacyProtocolVersion = "2025-11-25"
View Source
const ProtocolVersion = "2026-07-28"

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(context.Context, map[string]any) (any, error)

Handler implements one tool call.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server dispatches MCP JSON-RPC methods and named tool handlers.

func NewServer

func NewServer(handlers map[string]Handler) *Server

NewServer registers and validates handlers.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, input io.Reader, output io.Writer) error

Serve reads and writes one JSON-RPC message per line until EOF or cancellation.

type Tool

type Tool struct {
	Name         string         `json:"name"`
	Title        string         `json:"title,omitempty"`
	Description  string         `json:"description"`
	InputSchema  map[string]any `json:"inputSchema"`
	OutputSchema map[string]any `json:"outputSchema,omitempty"`
	Annotations  map[string]any `json:"annotations,omitempty"`
}

Tool describes one exposed MCP operation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL