Documentation
¶
Index ¶
- func ServeStdio(server MCPServer) error
- type CallToolFunc
- type CompleteFunc
- type DefaultServer
- func (s *DefaultServer) HandleCallTool(f CallToolFunc)
- func (s *DefaultServer) HandleComplete(f CompleteFunc)
- func (s *DefaultServer) HandleGetPrompt(f GetPromptFunc)
- func (s *DefaultServer) HandleInitialize(f InitializeFunc)
- func (s *DefaultServer) HandleListPrompts(f ListPromptsFunc)
- func (s *DefaultServer) HandleListResourceTemplates(f ListResourceTemplatesFunc)
- func (s *DefaultServer) HandleListResources(f ListResourcesFunc)
- func (s *DefaultServer) HandleListTools(f ListToolsFunc)
- func (s *DefaultServer) HandleNotification(name string, f NotificationFunc)
- func (s *DefaultServer) HandlePing(f PingFunc)
- func (s *DefaultServer) HandleReadResource(f ReadResourceFunc)
- func (s *DefaultServer) HandleSetLevel(f SetLevelFunc)
- func (s *DefaultServer) HandleSubscribe(f SubscribeFunc)
- func (s *DefaultServer) HandleUnsubscribe(f UnsubscribeFunc)
- func (s *DefaultServer) Request(ctx context.Context, request JSONRPCRequest) JSONRPCResponse
- type GetPromptFunc
- type InitializeFunc
- type JSONRPCRequest
- type JSONRPCResponse
- type ListPromptsFunc
- type ListResourceTemplatesFunc
- type ListResourcesFunc
- type ListToolsFunc
- type MCPServer
- type NotificationFunc
- type PingFunc
- type ReadResourceFunc
- type SSEServer
- type SetLevelFunc
- type StdioServer
- type SubscribeFunc
- type UnsubscribeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeStdio ¶
ServeStdio creates a stdio server wrapper around an existing MCPServer
Types ¶
type CallToolFunc ¶
type CompleteFunc ¶
type CompleteFunc func(ctx context.Context, ref interface{}, argument mcp.CompleteRequestParamsArgument) (*mcp.CompleteResult, error)
type DefaultServer ¶
type DefaultServer struct {
// contains filtered or unexported fields
}
func (*DefaultServer) HandleCallTool ¶
func (s *DefaultServer) HandleCallTool( f CallToolFunc, )
func (*DefaultServer) HandleComplete ¶
func (s *DefaultServer) HandleComplete( f CompleteFunc, )
func (*DefaultServer) HandleGetPrompt ¶
func (s *DefaultServer) HandleGetPrompt( f GetPromptFunc, )
func (*DefaultServer) HandleInitialize ¶
func (s *DefaultServer) HandleInitialize( f InitializeFunc, )
Handler registration methods
func (*DefaultServer) HandleListPrompts ¶
func (s *DefaultServer) HandleListPrompts( f ListPromptsFunc, )
func (*DefaultServer) HandleListResourceTemplates ¶ added in v0.4.1
func (s *DefaultServer) HandleListResourceTemplates( f ListResourceTemplatesFunc, )
func (*DefaultServer) HandleListResources ¶
func (s *DefaultServer) HandleListResources( f ListResourcesFunc, )
func (*DefaultServer) HandleListTools ¶
func (s *DefaultServer) HandleListTools( f ListToolsFunc, )
func (*DefaultServer) HandleNotification ¶ added in v0.1.5
func (s *DefaultServer) HandleNotification(name string, f NotificationFunc)
func (*DefaultServer) HandlePing ¶
func (s *DefaultServer) HandlePing( f PingFunc, )
func (*DefaultServer) HandleReadResource ¶
func (s *DefaultServer) HandleReadResource( f ReadResourceFunc, )
func (*DefaultServer) HandleSetLevel ¶
func (s *DefaultServer) HandleSetLevel( f SetLevelFunc, )
func (*DefaultServer) HandleSubscribe ¶
func (s *DefaultServer) HandleSubscribe( f SubscribeFunc, )
func (*DefaultServer) HandleUnsubscribe ¶
func (s *DefaultServer) HandleUnsubscribe( f UnsubscribeFunc, )
func (*DefaultServer) Request ¶
func (s *DefaultServer) Request( ctx context.Context, request JSONRPCRequest, ) JSONRPCResponse
type GetPromptFunc ¶
type InitializeFunc ¶
type InitializeFunc func(ctx context.Context, capabilities mcp.ClientCapabilities, clientInfo mcp.Implementation, protocolVersion string) (*mcp.InitializeResult, error)
type JSONRPCRequest ¶
type JSONRPCRequest struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params"` }
JSONRPCRequest represents a JSON-RPC 2.0 request
type JSONRPCResponse ¶
type JSONRPCResponse struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id,omitempty"` Result interface{} `json:"result,omitempty"` Error *struct { Code int `json:"code"` Message string `json:"message"` } `json:"error,omitempty"` }
JSONRPCResponse represents a JSON-RPC 2.0 response
type ListPromptsFunc ¶
type ListResourceTemplatesFunc ¶ added in v0.4.1
type ListResourcesFunc ¶
type ListToolsFunc ¶
type MCPServer ¶
type MCPServer interface { Request(ctx context.Context, request JSONRPCRequest) JSONRPCResponse HandleInitialize(InitializeFunc) HandlePing(PingFunc) HandleListResources(ListResourcesFunc) HandleListResourceTemplates(ListResourceTemplatesFunc) HandleReadResource(ReadResourceFunc) HandleSubscribe(SubscribeFunc) HandleUnsubscribe(UnsubscribeFunc) HandleListPrompts(ListPromptsFunc) HandleGetPrompt(GetPromptFunc) HandleListTools(ListToolsFunc) HandleCallTool(CallToolFunc) HandleSetLevel(SetLevelFunc) HandleComplete(CompleteFunc) HandleNotification(string, NotificationFunc) }
func NewDefaultServer ¶
NewDefaultServer creates a new server with default handlers
type NotificationFunc ¶ added in v0.1.2
type ReadResourceFunc ¶
type SSEServer ¶ added in v0.2.0
type SSEServer struct {
// contains filtered or unexported fields
}
func NewSSEServer ¶ added in v0.2.0
func NewTestServer ¶ added in v0.2.0
NewTestServer creates a test server for testing purposes It returns the SSEServer and a test server that can be closed when done
func (*SSEServer) SendEventToSession ¶ added in v0.2.0
SendEventToSession sends an event to a specific session
type SetLevelFunc ¶
type SetLevelFunc func(ctx context.Context, level mcp.LoggingLevel) error
type StdioServer ¶
type StdioServer struct {
// contains filtered or unexported fields
}
StdioServer wraps a MCPServer and handles stdio communication
Click to show internal directories.
Click to hide internal directories.