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) 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, method string, params json.RawMessage) (interface{}, error)
- type GetPromptFunc
- type InitializeFunc
- type JSONRPCRequest
- type JSONRPCResponse
- type ListPromptsFunc
- type ListResourcesFunc
- type ListToolsFunc
- type MCPServer
- type NotificationFunc
- type PingFunc
- type ReadResourceFunc
- 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 DefaultServer
Types ¶
type CallToolFunc ¶
type CompleteFunc ¶
type CompleteFunc func(ctx context.Context, ref interface{}, argument mcp.CompleteArgument) (*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) 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, method string, params json.RawMessage, ) (interface{}, error)
Request is the main entrypoint of the server
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 ListResourcesFunc ¶
type ListToolsFunc ¶
type MCPServer ¶
type MCPServer interface { Request( ctx context.Context, method string, params json.RawMessage, ) (interface{}, error) HandleInitialize(InitializeFunc) HandlePing(PingFunc) HandleListResources(ListResourcesFunc) 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 SetLevelFunc ¶
type SetLevelFunc func(ctx context.Context, level mcp.LoggingLevel) error
type StdioServer ¶
type StdioServer struct {
// contains filtered or unexported fields
}
StdioServer wraps a DefaultServer and handles stdio communication
Click to show internal directories.
Click to hide internal directories.