server

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Tools   map[string]interface{} `json:"tools,omitempty"`
	Prompts map[string]interface{} `json:"prompts,omitempty"`
}

type Error

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

type HTTPServer

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

HTTPServer wraps MCPServer to provide HTTP/SSE transport

func NewHTTPServer

func NewHTTPServer(mcp *MCPServer) *HTTPServer

func (*HTTPServer) BroadcastToAll

func (h *HTTPServer) BroadcastToAll(message interface{}) error

BroadcastToAll sends a message to all connected clients

func (*HTTPServer) SendToClient

func (h *HTTPServer) SendToClient(clientID string, message interface{}) error

SendToClient sends a message to a specific client via SSE

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(addr string) error

ServeHTTP starts the HTTP server on the specified address

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string       `json:"protocolVersion"`
	Capabilities    Capabilities `json:"capabilities"`
	ServerInfo      ServerInfo   `json:"serverInfo"`
}

type MCPServer

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

func NewMCPServer

func NewMCPServer() (*MCPServer, error)

func (*MCPServer) Serve

func (s *MCPServer) Serve(stdin io.Reader, stdout, stderr io.Writer) error

type Request

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

MCP Protocol structures

type Response

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

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type ToolInfo

type ToolInfo struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	InputSchema interface{} `json:"inputSchema"`
}

Jump to

Keyboard shortcuts

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