server

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListPromptsResult

type ListPromptsResult struct {
	Prompts    []protocol.Prompt `json:"prompts"`
	NextCursor string            `json:"nextCursor"`
}

ListPromptsResult is the response type for prompts/list method

type ListResourcesResult

type ListResourcesResult struct {
	Resources  []protocol.Resource `json:"resources"`
	NextCursor string              `json:"nextCursor"`
}

ListResourcesResult is the response type for resources/list method

type ListToolsResult

type ListToolsResult struct {
	Tools      []protocol.Tool `json:"tools"`
	NextCursor string          `json:"nextCursor"`
}

ListToolsResult is the response type for tools/list method

type RequestHandler added in v0.0.7

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

RequestHandler handles incoming MCP protocol requests

func NewRequestHandler added in v0.0.7

func NewRequestHandler(s *Server) *RequestHandler

func (*RequestHandler) HandleBatchRequest added in v0.0.10

func (h *RequestHandler) HandleBatchRequest(ctx context.Context, batch protocol.BatchRequest) (protocol.BatchResponse, error)

HandleBatchRequest processes a batch of requests and returns batch responses

func (*RequestHandler) HandleNotification added in v0.0.7

func (h *RequestHandler) HandleNotification(ctx context.Context, notif *protocol.Notification) error

HandleNotification processes a notification (no response expected)

func (*RequestHandler) HandleRequest added in v0.0.7

func (h *RequestHandler) HandleRequest(ctx context.Context, req *protocol.Request) (*protocol.Response, error)

HandleRequest processes a request and returns a response

type SSEBridgeServer added in v0.0.7

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

SSEBridgeServer is a stdio server that forwards all requests to an SSE server

func NewSSEBridgeServer added in v0.0.7

func NewSSEBridgeServer(logger zerolog.Logger, sseURL string) *SSEBridgeServer

NewSSEBridgeServer creates a new stdio server instance that forwards to SSE

func (*SSEBridgeServer) Start added in v0.0.7

func (s *SSEBridgeServer) Start(ctx context.Context) error

Start begins listening for and handling messages on stdio

func (*SSEBridgeServer) Stop added in v0.0.7

func (s *SSEBridgeServer) Stop(ctx context.Context) error

Stop gracefully stops the stdio server

type Server

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

Server represents an MCP server that can use different transports

func NewServer

func NewServer(logger zerolog.Logger, t transport.Transport, opts ...ServerOption) *Server

NewServer creates a new server instance

func (*Server) Start added in v0.0.7

func (s *Server) Start(ctx context.Context) error

Start begins the server with the configured transport

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully stops the server

type ServerOption

type ServerOption func(*Server)

func WithPromptProvider added in v0.0.7

func WithPromptProvider(pp pkg.PromptProvider) ServerOption

func WithResourceProvider added in v0.0.7

func WithResourceProvider(rp pkg.ResourceProvider) ServerOption

func WithServerName

func WithServerName(name string) ServerOption

func WithServerVersion

func WithServerVersion(version string) ServerOption

func WithSessionStore added in v0.0.9

func WithSessionStore(store session.SessionStore) ServerOption

func WithToolProvider added in v0.0.7

func WithToolProvider(tp pkg.ToolProvider) ServerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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