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

mcp

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MCPError

type MCPError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

MCPError represents an MCP error

type MCPRequest

type MCPRequest struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params,omitempty"`
}

MCPRequest represents a generic MCP request

type MCPResponse

type MCPResponse struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id"`
	Result  interface{} `json:"result,omitempty"`
	Error   *MCPError   `json:"error,omitempty"`
}

MCPResponse represents a generic MCP response

type Server

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

Server represents an MCP server

func NewServer

func NewServer(name, version, description string, logger *log.Logger) *Server

NewServer creates a new MCP server

func (*Server) AddTool

func (s *Server) AddTool(name, description string, inputSchema map[string]interface{}, handler ToolHandler)

AddTool adds a tool to the server

func (*Server) ServeStdio

func (s *Server) ServeStdio() error

ServeStdio starts the server using stdio transport

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

Tool represents an MCP tool

type ToolHandler

type ToolHandler func(ctx context.Context, params map[string]interface{}) (interface{}, error)

ToolHandler is a function that handles tool calls

Jump to

Keyboard shortcuts

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