Documentation
¶
Index ¶
- type Client
- type Handler
- func (h *Handler) CallTool(ctx context.Context, request *jsonrpc.Request) (*schema.CallToolResult, *jsonrpc.Error)
- func (h *Handler) Cancel(ctx context.Context, notification *jsonrpc.Notification) *jsonrpc.Error
- func (h *Handler) Complete(ctx context.Context, request *jsonrpc.Request) (*schema.CompleteResult, *jsonrpc.Error)
- func (h *Handler) GetPrompt(ctx context.Context, request *jsonrpc.Request) (*schema.GetPromptResult, *jsonrpc.Error)
- func (h *Handler) Initialize(ctx context.Context, request *jsonrpc.Request) (*schema.InitializeResult, *jsonrpc.Error)
- func (h *Handler) ListPrompts(ctx context.Context, request *jsonrpc.Request) (*schema.ListPromptsResult, *jsonrpc.Error)
- func (h *Handler) ListResourceTemplates(ctx context.Context, request *jsonrpc.Request) (*schema.ListResourceTemplatesResult, *jsonrpc.Error)
- func (h *Handler) ListResources(ctx context.Context, request *jsonrpc.Request) (*schema.ListResourcesResult, *jsonrpc.Error)
- func (h *Handler) ListTools(ctx context.Context, request *jsonrpc.Request) (*schema.ListToolsResult, *jsonrpc.Error)
- func (h *Handler) OnNotification(ctx context.Context, notification *jsonrpc.Notification)
- func (h *Handler) Ping(ctx context.Context, request *jsonrpc.Request) (*schema.PingResult, *jsonrpc.Error)
- func (h *Handler) ReadResource(ctx context.Context, request *jsonrpc.Request) (*schema.ReadResourceResult, *jsonrpc.Error)
- func (h *Handler) Serve(parent context.Context, request *jsonrpc.Request, response *jsonrpc.Response)
- func (h *Handler) SetLevel(ctx context.Context, request *jsonrpc.Request) (*schema.SetLevelResult, *jsonrpc.Error)
- func (h *Handler) Subscribe(ctx context.Context, request *jsonrpc.Request) (*schema.SubscribeResult, *jsonrpc.Error)
- func (h *Handler) Unsubscribe(ctx context.Context, request *jsonrpc.Request) (*schema.UnsubscribeResult, *jsonrpc.Error)
- type Logger
- func (l *Logger) Alert(ctx context.Context, data interface{}) error
- func (l *Logger) Critical(ctx context.Context, data interface{}) error
- func (l *Logger) Debug(ctx context.Context, data interface{}) error
- func (l *Logger) Emergency(ctx context.Context, data interface{}) error
- func (l *Logger) Error(ctx context.Context, data interface{}) error
- func (l *Logger) Info(ctx context.Context, data interface{}) error
- func (l *Logger) Logger(name string) logger.Logger
- func (l *Logger) Notice(ctx context.Context, data interface{}) error
- func (l *Logger) Warning(ctx context.Context, data interface{}) error
- type Option
- func WithAuthorizationPolicy(policy *authorization.Policy) Option
- func WithAuthorizer(authorizer auth.Authorizer) Option
- func WithCapabilities(capabilities schema.ServerCapabilities) Option
- func WithImplementation(implementation schema.Implementation) Option
- func WithLoggerName(name string) Option
- func WithNewImplementer(newImplementer server.NewImplementer) Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) CreateMessage ¶
func (c *Client) CreateMessage(ctx context.Context, params *schema.CreateMessageRequestParams) (*schema.CreateMessageResult, *jsonrpc.Error)
CreateMessage creates sampling message
type Handler ¶
type Handler struct {
transport.Notifier
*Logger
*Server
// contains filtered or unexported fields
}
Handler represents handler
func (*Handler) CallTool ¶
func (h *Handler) CallTool(ctx context.Context, request *jsonrpc.Request) (*schema.CallToolResult, *jsonrpc.Error)
CallTool handles the tools/call method
func (*Handler) Complete ¶
func (h *Handler) Complete(ctx context.Context, request *jsonrpc.Request) (*schema.CompleteResult, *jsonrpc.Error)
Complete handles the completion/complete method
func (*Handler) GetPrompt ¶
func (h *Handler) GetPrompt(ctx context.Context, request *jsonrpc.Request) (*schema.GetPromptResult, *jsonrpc.Error)
GetPrompt handles the prompts/get method
func (*Handler) Initialize ¶
func (h *Handler) Initialize(ctx context.Context, request *jsonrpc.Request) (*schema.InitializeResult, *jsonrpc.Error)
Initialize handles the initialize method
func (*Handler) ListPrompts ¶
func (h *Handler) ListPrompts(ctx context.Context, request *jsonrpc.Request) (*schema.ListPromptsResult, *jsonrpc.Error)
ListPrompts handles the prompts/list method
func (*Handler) ListResourceTemplates ¶
func (h *Handler) ListResourceTemplates(ctx context.Context, request *jsonrpc.Request) (*schema.ListResourceTemplatesResult, *jsonrpc.Error)
ListResourceTemplates handles the resources/templates/list method
func (*Handler) ListResources ¶
func (h *Handler) ListResources(ctx context.Context, request *jsonrpc.Request) (*schema.ListResourcesResult, *jsonrpc.Error)
ListResources handles the resources/list method
func (*Handler) ListTools ¶
func (h *Handler) ListTools(ctx context.Context, request *jsonrpc.Request) (*schema.ListToolsResult, *jsonrpc.Error)
ListTools handles the tools/list method
func (*Handler) OnNotification ¶
func (h *Handler) OnNotification(ctx context.Context, notification *jsonrpc.Notification)
OnNotification handles incoming JSON-RPC notifications
func (*Handler) Ping ¶
func (h *Handler) Ping(ctx context.Context, request *jsonrpc.Request) (*schema.PingResult, *jsonrpc.Error)
Ping handles the ping method
func (*Handler) ReadResource ¶
func (h *Handler) ReadResource(ctx context.Context, request *jsonrpc.Request) (*schema.ReadResourceResult, *jsonrpc.Error)
ReadResource handles the resources/read method
func (*Handler) Serve ¶
func (h *Handler) Serve(parent context.Context, request *jsonrpc.Request, response *jsonrpc.Response)
Serve handles incoming JSON-RPC requests
func (*Handler) SetLevel ¶
func (h *Handler) SetLevel(ctx context.Context, request *jsonrpc.Request) (*schema.SetLevelResult, *jsonrpc.Error)
SetLevel handles the logging/setLevel method
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
type Option ¶
Option is a function that configures the server.
func WithAuthorizationPolicy ¶ added in v0.2.3
func WithAuthorizationPolicy(policy *authorization.Policy) Option
WithAuthorizationPolicy accepts authentication policy (no-op stub).
func WithAuthorizer ¶
func WithAuthorizer(authorizer auth.Authorizer) Option
func WithCapabilities ¶
func WithCapabilities(capabilities schema.ServerCapabilities) Option
WithCapabilities sets the server capabilities.
func WithImplementation ¶
func WithImplementation(implementation schema.Implementation) Option
WithImplementation sets the server implementation.
func WithNewImplementer ¶
func WithNewImplementer(newImplementer server.NewImplementer) Option
WithNewImplementer sets the new implementer.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents MCP protocol handler
func (*Server) HTTP ¶
HTTP return http server HTTP creates and returns an HTTP server with OAuth2 auth and SSE handlers.
func (*Server) NewHandler ¶
NewHandler creates a new handler instance