mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

Request represents a JSON-RPC style request with a method and optional params.

type Response

type Response struct {
	Result interface{} `json:"result,omitempty"`
	Error  string      `json:"error,omitempty"`
}

Response represents a JSON-RPC style response.

type Server

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

Server is a basic MCP server that manages tools and routes requests.

func NewServer

func NewServer() *Server

NewServer creates and returns a new Server.

func (*Server) HandleRequest

func (s *Server) HandleRequest(req *Request) *Response

HandleRequest routes a request to the appropriate handler based on method.

func (*Server) ListTools

func (s *Server) ListTools() []*Tool

ListTools returns all registered tools.

func (*Server) RegisterTool

func (s *Server) RegisterTool(t *Tool)

RegisterTool adds a tool to the server's registry.

type Tool

type Tool struct {
	Name        string
	Description string
	Handler     func(params json.RawMessage) (json.RawMessage, error)
}

Tool represents an MCP tool with a name, description, and handler function.

Jump to

Keyboard shortcuts

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