Documentation
¶
Index ¶
- Constants
- func Assistant(msg string) protocol.PromptMessage
- func NewStdioSession(connectionID string, writer io.Writer, logger types.Logger, ...) *stdioSession
- func System(msg string) protocol.PromptMessage
- func Text(msg string) protocol.Content
- func User(msg string) protocol.PromptMessage
- type Context
- func (c *Context) CallTool(toolName string, input interface{}) (json.RawMessage, *protocol.ToolError, error)
- func (c *Context) CreateMessage(messages []protocol.SamplingMessage, opts *protocol.SamplingRequestParams) (*protocol.SamplingResult, error)
- func (c *Context) Debug(message string)
- func (c *Context) Error(message string)
- func (c *Context) Info(message string)
- func (c *Context) Log(level string, message string)
- func (c *Context) ReadResource(uri string) (protocol.ResourceContents, error)
- func (c *Context) ReportProgress(message string, current, total int)
- func (c *Context) Warning(message string)
- type DuplicateHandling
- type Hooks
- type LifecycleHandler
- type MessageHandler
- func (mh *MessageHandler) AddCancelFuncForTest(requestID string, cancel context.CancelFunc)
- func (mh *MessageHandler) GetCancelFuncForTest(requestID string) (context.CancelFunc, bool)
- func (mh *MessageHandler) HandleMessage(session types.ClientSession, message []byte) error
- func (mh *MessageHandler) RegisterNotificationHandler(method string, handler func(params json.RawMessage))
- func (mh *MessageHandler) SendLoggingMessage(level protocol.LoggingLevel, message string, logger *string, data interface{})
- func (mh *MessageHandler) SendNotificationToConnections(connectionIDs []string, notif *protocol.JSONRPCNotification)
- func (mh *MessageHandler) SendProgress(connectionID string, token interface{}, value interface{})
- type Registry
- func (r *Registry) AddPrompt(prompt protocol.Prompt) *Registry
- func (r *Registry) AddResourceTemplate(uriPattern string, handlerFn any) error
- func (r *Registry) AddRoot(root protocol.Root) *Registry
- func (r *Registry) GetPrompt(uri string) (protocol.Prompt, bool)
- func (r *Registry) GetPrompts() []protocol.Prompt
- func (r *Registry) GetRegisteredResource(uri string) (*registeredResource, bool)
- func (r *Registry) GetResource(uri string) (protocol.Resource, bool)
- func (r *Registry) GetToolHandler(name string) (func(ctx *Context, rawArgs json.RawMessage) (interface{}, error), bool)
- func (r *Registry) GetTools() []protocol.Tool
- func (r *Registry) RegisterResource(resource protocol.Resource) *Registry
- func (r *Registry) RegisterResourceTemplate(uriPattern string, config resourceConfig) error
- func (r *Registry) RegisterStaticResource(uri string, config resourceConfig) error
- func (r *Registry) RemovePrompt(name string) *Registry
- func (r *Registry) RemoveRoot(root protocol.Root) *Registry
- func (r *Registry) RemoveTool(name string) *Registry
- func (r *Registry) ResourceRegistry() map[string]protocol.Resource
- func (r *Registry) SetPromptChangedCallback(callback func())
- func (r *Registry) SetResourceChangedCallback(callback func(uri string))
- func (r *Registry) SetToolChangedCallback(callback func())
- func (r *Registry) TemplateRegistry() map[string]*resourceTemplateInfo
- func (r *Registry) Tool(name, desc string, fn any) *Registry
- type ResourceDetails
- type ResourceOption
- func WithAnnotations(annotations map[string]any) ResourceOption
- func WithAsync(progressTemplate string) ResourceOption
- func WithBinaryContent(data []byte) ResourceOption
- func WithContentTypeInference(enabled bool) ResourceOption
- func WithCustomKey(key string) ResourceOption
- func WithDefaultParamValue(paramName string, defaultValue interface{}) ResourceOption
- func WithDescription(description string) ResourceOption
- func WithDirectoryListing(dirPath string) ResourceOption
- func WithDuplicateHandling(handling DuplicateHandling) ResourceOption
- func WithFileContent(filePath string) ResourceOption
- func WithHandler(handlerFn any) ResourceOption
- func WithMimeType(mimeType string) ResourceOption
- func WithMultipleURIs(additionalURIs ...string) ResourceOption
- func WithName(name string) ResourceOption
- func WithReturnTypeConversion(converter func(interface{}) ([]protocol.ResourceContents, error)) ResourceOption
- func WithTags(tags ...string) ResourceOption
- func WithTextContent(text string) ResourceOption
- func WithURLContent(url string) ResourceOption
- func WithWildcardParam(paramName string) ResourceOption
- type RootDetails
- type Server
- func (s *Server) AsSSE(addr string, basePath string) *Server
- func (s *Server) AsStdio() *Server
- func (s *Server) AsWebsocket(addr string, path string) *Server
- func (s *Server) Close() error
- func (s *Server) NotifyResourceUpdated(uri string)
- func (s *Server) Prompt(name, description string, messages ...protocol.PromptMessage) *Server
- func (s *Server) Resource(uri string, options ...ResourceOption) *Server
- func (s *Server) Root(root protocol.Root) *Server
- func (s *Server) Run() error
- func (s *Server) Tool(name, desc string, fn any) *Server
- type SubscriptionManager
- func (sm *SubscriptionManager) GetSubscribedConnectionIDs(uri string) []string
- func (sm *SubscriptionManager) IsSubscribed(uri string, connectionID string) bool
- func (sm *SubscriptionManager) Subscribe(uri, connectionID string)
- func (sm *SubscriptionManager) Unsubscribe(uri, connectionID string)
- func (sm *SubscriptionManager) UnsubscribeAll(connectionID string)
- type TransportManager
- func (tm *TransportManager) AsSSE(s *Server, addr string, basePath string) *Server
- func (tm *TransportManager) AsStdio(s *Server) *Server
- func (tm *TransportManager) AsWebsocket(s *Server, addr string, path string) *Server
- func (tm *TransportManager) GetAllSessionIDs() []string
- func (tm *TransportManager) GetSession(sessionID string) (types.ClientSession, *protocol.ClientCapabilities, bool)
- func (tm *TransportManager) RegisterSession(session types.ClientSession, caps *protocol.ClientCapabilities)
- func (tm *TransportManager) RemoveSession(sessionID string)
- func (tm *TransportManager) Run(s *Server) error
- func (tm *TransportManager) SendMessage(sessionID string, message []byte) errordeprecated
- func (tm *TransportManager) Shutdown()
- type TransportType
Constants ¶
const ServerVersion = "0.1.0" // Define server version constant
Variables ¶
This section is empty.
Functions ¶
func Assistant ¶ added in v0.1.11
func Assistant(msg string) protocol.PromptMessage
func NewStdioSession ¶ added in v0.1.11
func NewStdioSession(connectionID string, writer io.Writer, logger types.Logger, transport *stdio.StdioTransport) *stdioSession
NewStdioSession creates a new stdioSession instance.
func System ¶ added in v0.1.11
func System(msg string) protocol.PromptMessage
Define helper functions for prompt messages Note: "system" role is not valid according to MCP schemas - only "user" and "assistant" are allowed
func User ¶ added in v0.1.11
func User(msg string) protocol.PromptMessage
Types ¶
type Context ¶ added in v0.1.11
Context provides access to server capabilities within tool and resource handlers. It also embeds context.Context for cancellation.
func NewContext ¶ added in v0.1.11
func NewContext(parentCtx context.Context, requestID string, session types.ClientSession, progressToken interface{}, srv *Server) *Context
NewContext creates a new Context instance for a request. It requires a parent context (e.g., from context.WithCancel).
func (*Context) CallTool ¶ added in v0.1.11
func (c *Context) CallTool(toolName string, input interface{}) (json.RawMessage, *protocol.ToolError, error)
CallTool sends a 'tools/call' request to the client and waits for the result. This allows a server-side tool to invoke a client-side tool. Input is marshalled to JSON. Returns the raw JSON output from the client tool and any tool execution error reported by the client.
func (*Context) CreateMessage ¶ added in v0.1.11
func (c *Context) CreateMessage(messages []protocol.SamplingMessage, opts *protocol.SamplingRequestParams) (*protocol.SamplingResult, error)
CreateMessage sends a sampling/createMessage request to the connected client and waits for a response. This allows server-side logic (e.g., a tool) to request an LLM completion via the client.
func (*Context) ReadResource ¶ added in v0.1.11
func (c *Context) ReadResource(uri string) (protocol.ResourceContents, error)
ReadResource reads a resource from the server's registry.
func (*Context) ReportProgress ¶ added in v0.1.11
ReportProgress reports the progress of a long-running operation.
type DuplicateHandling ¶ added in v0.1.11
type DuplicateHandling int
DuplicateHandling defines how to handle duplicate resource registrations
const ( // DuplicateError returns an error when attempting to register a duplicate resource DuplicateError DuplicateHandling = iota // DuplicateReplace replaces the existing resource with the new one DuplicateReplace // DuplicateIgnore ignores the new resource and keeps the existing one DuplicateIgnore // DuplicateWarn logs a warning but replaces the existing resource DuplicateWarn )
type LifecycleHandler ¶ added in v0.1.11
type LifecycleHandler struct {
// contains filtered or unexported fields
}
LifecycleHandler provides methods for handling MCP lifecycle messages.
func NewLifecycleHandler ¶ added in v0.1.11
func NewLifecycleHandler(srv *Server) *LifecycleHandler
NewLifecycleHandler creates a new LifecycleHandler instance.
func (*LifecycleHandler) ExitHandler ¶ added in v0.1.11
func (h *LifecycleHandler) ExitHandler()
ExitHandler handles the 'exit' notification.
func (*LifecycleHandler) InitializeHandler ¶ added in v0.1.11
func (h *LifecycleHandler) InitializeHandler(params protocol.InitializeRequestParams) (protocol.InitializeResult, *protocol.ClientCapabilities, error)
InitializeHandler handles the 'initialize' request. It performs version negotiation and returns server capabilities. It now also returns the negotiated client capabilities.
func (*LifecycleHandler) InitializedHandler ¶ added in v0.1.11
func (h *LifecycleHandler) InitializedHandler()
InitializedHandler handles the 'initialized' notification.
func (*LifecycleHandler) ShutdownHandler ¶ added in v0.1.11
func (h *LifecycleHandler) ShutdownHandler() error
ShutdownHandler handles the 'shutdown' request.
type MessageHandler ¶ added in v0.1.11
type MessageHandler struct {
// contains filtered or unexported fields
}
MessageHandler handles incoming and outgoing MCP messages.
func NewMessageHandler ¶ added in v0.1.11
func NewMessageHandler(srv *Server) *MessageHandler
NewMessageHandler creates a new MessageHandler instance.
func (*MessageHandler) AddCancelFuncForTest ¶ added in v0.1.11
func (mh *MessageHandler) AddCancelFuncForTest(requestID string, cancel context.CancelFunc)
AddCancelFuncForTest adds a cancel function to the active cancels map for testing. WARNING: Use only in tests. Does not reflect the actual request handling flow.
func (*MessageHandler) GetCancelFuncForTest ¶ added in v0.1.11
func (mh *MessageHandler) GetCancelFuncForTest(requestID string) (context.CancelFunc, bool)
GetCancelFuncForTest retrieves a cancel function from the active cancels map for testing. WARNING: Use only in tests.
func (*MessageHandler) HandleMessage ¶ added in v0.1.11
func (mh *MessageHandler) HandleMessage(session types.ClientSession, message []byte) error
HandleMessage processes an incoming JSON-RPC message for a specific session. It unmarshals the message, dispatches it to the appropriate handler, and sends a response if necessary.
func (*MessageHandler) RegisterNotificationHandler ¶ added in v0.1.11
func (mh *MessageHandler) RegisterNotificationHandler(method string, handler func(params json.RawMessage))
func (*MessageHandler) SendLoggingMessage ¶ added in v0.1.11
func (mh *MessageHandler) SendLoggingMessage(level protocol.LoggingLevel, message string, logger *string, data interface{})
SendLoggingMessage sends a notifications/message notification to all connected clients. This is used by the server to send log messages to the client. TODO: Implement filtering based on client logging level preferences.
func (*MessageHandler) SendNotificationToConnections ¶ added in v0.1.11
func (mh *MessageHandler) SendNotificationToConnections(connectionIDs []string, notif *protocol.JSONRPCNotification)
SendNotificationToConnections sends a JSON-RPC notification to multiple connection IDs.
func (*MessageHandler) SendProgress ¶ added in v0.1.11
func (mh *MessageHandler) SendProgress(connectionID string, token interface{}, value interface{})
SendProgress sends a $/progress notification to a specific connection. token is the progress token from the request's _meta field. value is the progress data payload.
type Registry ¶ added in v0.1.11
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the registered tools, resources, and prompts.
func NewRegistry ¶ added in v0.1.11
func NewRegistry() *Registry
NewRegistry creates a new Registry instance.
func (*Registry) AddResourceTemplate ¶ added in v0.1.11
AddResourceTemplate is a backward compatibility wrapper for RegisterResourceTemplate. It maintains the old signature for compatibility with existing code. DEPRECATED: Use Resource(uri, WithHandler(handlerFn)) instead.
func (*Registry) GetPrompts ¶ added in v0.1.11
GetPrompts returns a slice of all registered prompts.
func (*Registry) GetRegisteredResource ¶ added in v0.1.11
GetRegisteredResource retrieves the internal registered resource by its URI. This is primarily for internal use to access the resource config.
func (*Registry) GetResource ¶ added in v0.1.11
GetResource retrieves a resource by its URI. It currently only checks static resources registered via the new API.
func (*Registry) GetToolHandler ¶ added in v0.1.11
func (r *Registry) GetToolHandler(name string) (func(ctx *Context, rawArgs json.RawMessage) (interface{}, error), bool)
GetToolHandler retrieves the wrapper handler for a registered tool. This wrapper handles argument parsing/validation and calls the original function. It now accepts a pre-created Context instance.
func (*Registry) GetTools ¶ added in v0.1.11
GetTools returns a slice of all registered tools (protocol.Tool definition).
func (*Registry) RegisterResource ¶ added in v0.1.11
RegisterResource registers a new resource with the registry. DEPRECATED: Use Resource(uri, WithTextContent(...)) or Resource(uri, WithFileContent(...)) instead.
func (*Registry) RegisterResourceTemplate ¶ added in v0.1.11
RegisterResourceTemplate registers a new resource template handler based on the provided config. It parses the URI pattern, validates the handler signature using reflection, and stores the information for later matching and invocation. Handler signature must be func(ctx types.Context, [param1 Type1, ...]) (ResultType, error).
func (*Registry) RegisterStaticResource ¶ added in v0.1.11
RegisterStaticResource registers a new static resource based on the provided config.
func (*Registry) RemovePrompt ¶ added in v0.1.11
RemovePrompt removes a prompt from the registry by name.
func (*Registry) RemoveRoot ¶ added in v0.1.11
RemoveRoot removes a root from the registry.
func (*Registry) RemoveTool ¶ added in v0.1.11
RemoveTool removes a tool from the registry.
func (*Registry) ResourceRegistry ¶ added in v0.1.11
ResourceRegistry returns the map of registered resources (static ones). Note: This currently only returns static resources registered via the new API. Templates are handled separately.
func (*Registry) SetPromptChangedCallback ¶ added in v0.1.11
func (r *Registry) SetPromptChangedCallback(callback func())
SetPromptChangedCallback sets the callback function to be called when prompts change.
func (*Registry) SetResourceChangedCallback ¶ added in v0.1.11
SetResourceChangedCallback sets the callback function to be called when resources change.
func (*Registry) SetToolChangedCallback ¶ added in v0.1.11
func (r *Registry) SetToolChangedCallback(callback func())
SetToolChangedCallback sets the callback function to be called when tools change.
func (*Registry) TemplateRegistry ¶ added in v0.1.11
TemplateRegistry returns the map of registered resource templates.
type ResourceDetails ¶ added in v0.1.11
ResourceDetails holds the details for adding a resource.
type ResourceOption ¶ added in v0.1.11
type ResourceOption func(*resourceConfig)
ResourceOption is a function type that modifies a resourceConfig.
func WithAnnotations ¶ added in v0.1.11
func WithAnnotations(annotations map[string]any) ResourceOption
WithAnnotations adds custom annotations to the resource/template metadata.
func WithAsync ¶ added in v0.1.11
func WithAsync(progressTemplate string) ResourceOption
WithAsync marks a resource handler as asynchronous. Async handlers will be executed in a separate goroutine and can report progress.
func WithBinaryContent ¶ added in v0.1.11
func WithBinaryContent(data []byte) ResourceOption
WithBinaryContent specifies static binary content for a resource.
func WithContentTypeInference ¶ added in v0.1.11
func WithContentTypeInference(enabled bool) ResourceOption
WithContentTypeInference enables or disables automatic content type inference. When enabled (default), the system will try to infer the content type based on file extensions, content patterns, etc.
func WithCustomKey ¶ added in v0.1.11
func WithCustomKey(key string) ResourceOption
WithCustomKey sets a custom key to identify this resource in the registry. By default, the URI is used as the key.
func WithDefaultParamValue ¶ added in v0.1.11
func WithDefaultParamValue(paramName string, defaultValue interface{}) ResourceOption
WithDefaultParamValue sets a default value for a template parameter. If the parameter is not provided in the URI or is empty, this default value will be used.
func WithDescription ¶ added in v0.1.11
func WithDescription(description string) ResourceOption
WithDescription sets a custom description for the resource/template.
func WithDirectoryListing ¶ added in v0.1.11
func WithDirectoryListing(dirPath string) ResourceOption
WithDirectoryListing specifies that the resource should provide a listing of files in a local directory.
func WithDuplicateHandling ¶ added in v0.1.11
func WithDuplicateHandling(handling DuplicateHandling) ResourceOption
WithDuplicateHandling sets how to handle duplicate resource registrations
func WithFileContent ¶ added in v0.1.11
func WithFileContent(filePath string) ResourceOption
WithFileContent specifies that the resource content should be read from a local file path when requested.
func WithHandler ¶ added in v0.1.11
func WithHandler(handlerFn any) ResourceOption
WithHandler specifies the handler function for a dynamic resource or resource template.
func WithMimeType ¶ added in v0.1.11
func WithMimeType(mimeType string) ResourceOption
WithMimeType explicitly sets the MIME type for the resource/template.
func WithMultipleURIs ¶ added in v0.1.11
func WithMultipleURIs(additionalURIs ...string) ResourceOption
WithMultipleURIs registers the same resource under multiple URI patterns. This allows a single resource to be accessible via different URI patterns.
func WithName ¶ added in v0.1.11
func WithName(name string) ResourceOption
WithName sets a custom human-readable name for the resource/template.
func WithReturnTypeConversion ¶ added in v0.1.11
func WithReturnTypeConversion(converter func(interface{}) ([]protocol.ResourceContents, error)) ResourceOption
WithReturnTypeConversion configures how return values from resource handlers are converted to ResourceContents. This is useful for custom type conversions.
func WithTags ¶ added in v0.1.11
func WithTags(tags ...string) ResourceOption
WithTags adds categorization tags to the resource/template.
func WithTextContent ¶ added in v0.1.11
func WithTextContent(text string) ResourceOption
WithTextContent specifies static text content for a resource.
func WithURLContent ¶ added in v0.1.11
func WithURLContent(url string) ResourceOption
WithURLContent specifies that the resource content should be fetched from an HTTP(S) URL when requested.
func WithWildcardParam ¶ added in v0.1.11
func WithWildcardParam(paramName string) ResourceOption
WithWildcardParam enables a wildcard parameter in a resource template. This allows a parameter to match multiple path segments like `/docs/{path*}/edit` which would match `/docs/a/b/c/edit` and extract path="a/b/c". Note: The wildcard syntax is already supported in the wilduri library.
type RootDetails ¶ added in v0.1.11
RootDetails holds the details for adding a root.
type Server ¶
type Server struct {
*Hooks // Embed Hooks struct
// Transport Management
TransportManager *TransportManager
// State Management
Registry *Registry
SubscriptionManager *SubscriptionManager
MessageHandler *MessageHandler
// Capability Flags (reflect server implementation status)
ImplementsResourceSubscription bool
ImplementsResourceListChanged bool
ImplementsPromptListChanged bool
ImplementsToolListChanged bool
ImplementsLogging bool
ImplementsCompletions bool // Tracks if completion/complete (V2024) is implemented
ImplementsSampling bool // Tracks if sampling/createMessage (V2025) can be sent
ImplementsAuthorization bool
// contains filtered or unexported fields
}
Server represents the main MCP server instance.
func (*Server) AsSSE ¶ added in v0.1.11
AsSSE configures the server to use Server-Sent Events as its transport.
func (*Server) AsStdio ¶ added in v0.1.11
AsStdio configures the server to use standard I/O as its transport.
func (*Server) AsWebsocket ¶ added in v0.1.11
AsWebsocket configures the server to use WebSocket as its transport.
func (*Server) NotifyResourceUpdated ¶
NotifyResourceUpdated triggers a resource update notification for subscribers.
func (*Server) Prompt ¶ added in v0.1.11
func (s *Server) Prompt(name, description string, messages ...protocol.PromptMessage) *Server
Prompt registers a new prompt with the server's registry.
func (*Server) Resource ¶ added in v0.1.11
func (s *Server) Resource(uri string, options ...ResourceOption) *Server
Resource registers a new static resource or dynamic resource template with the server's registry. It uses a flexible options pattern for configuration.
Example:
server.Resource("/static/data.txt", WithTextContent("Hello"), WithMimeType("text/plain"))
server.Resource("/api/users/{id}", WithHandler(getUserHandler), WithDescription("Fetches user data"))
type SubscriptionManager ¶ added in v0.1.11
type SubscriptionManager struct {
// contains filtered or unexported fields
}
SubscriptionManager manages resource subscriptions for client connections.
func NewSubscriptionManager ¶ added in v0.1.11
func NewSubscriptionManager() *SubscriptionManager
NewSubscriptionManager creates a new SubscriptionManager.
func (*SubscriptionManager) GetSubscribedConnectionIDs ¶ added in v0.1.11
func (sm *SubscriptionManager) GetSubscribedConnectionIDs(uri string) []string
GetSubscribedConnectionIDs returns a list of connection IDs subscribed to a resource URI.
func (*SubscriptionManager) IsSubscribed ¶ added in v0.1.11
func (sm *SubscriptionManager) IsSubscribed(uri string, connectionID string) bool
IsSubscribed checks if a specific connection ID is subscribed to a given URI.
func (*SubscriptionManager) Subscribe ¶ added in v0.1.11
func (sm *SubscriptionManager) Subscribe(uri, connectionID string)
Subscribe adds a subscription for a given connection ID to a resource URI.
func (*SubscriptionManager) Unsubscribe ¶ added in v0.1.11
func (sm *SubscriptionManager) Unsubscribe(uri, connectionID string)
Unsubscribe removes a subscription for a given connection ID from a resource URI.
func (*SubscriptionManager) UnsubscribeAll ¶ added in v0.1.11
func (sm *SubscriptionManager) UnsubscribeAll(connectionID string)
UnsubscribeAll removes all subscriptions for a given connection ID.
type TransportManager ¶ added in v0.1.11
type TransportManager struct {
// Map to store active client sessions (sessionID -> session)
Sessions map[string]types.ClientSession
// Add a map to store capabilities per session ID
Capabilities map[string]*protocol.ClientCapabilities
// contains filtered or unexported fields
}
TransportManager handles the server's transport mechanisms.
func NewTransportManager ¶ added in v0.1.11
func NewTransportManager() *TransportManager
NewTransportManager creates a new TransportManager.
func (*TransportManager) AsSSE ¶ added in v0.1.11
func (tm *TransportManager) AsSSE(s *Server, addr string, basePath string) *Server
AsSSE configures the server to use Server-Sent Events as its transport.
func (*TransportManager) AsStdio ¶ added in v0.1.11
func (tm *TransportManager) AsStdio(s *Server) *Server
AsStdio configures the server to use standard I/O as its transport.
func (*TransportManager) AsWebsocket ¶ added in v0.1.11
func (tm *TransportManager) AsWebsocket(s *Server, addr string, path string) *Server
AsWebsocket configures the server to use WebSocket as its transport.
func (*TransportManager) GetAllSessionIDs ¶ added in v0.1.11
func (tm *TransportManager) GetAllSessionIDs() []string
GetAllSessionIDs returns a slice of all active session IDs.
func (*TransportManager) GetSession ¶ added in v0.1.11
func (tm *TransportManager) GetSession(sessionID string) (types.ClientSession, *protocol.ClientCapabilities, bool)
GetSession retrieves a client session by its ID. It now also returns the client's capabilities.
func (*TransportManager) RegisterSession ¶ added in v0.1.11
func (tm *TransportManager) RegisterSession(session types.ClientSession, caps *protocol.ClientCapabilities)
RegisterSession adds a new client session to the manager.
func (*TransportManager) RemoveSession ¶ added in v0.1.11
func (tm *TransportManager) RemoveSession(sessionID string)
RemoveSession removes a client session from the manager.
func (*TransportManager) Run ¶ added in v0.1.11
func (tm *TransportManager) Run(s *Server) error
Run starts the selected transport.
func (*TransportManager) SendMessage
deprecated
added in
v0.1.11
func (tm *TransportManager) SendMessage(sessionID string, message []byte) error
Deprecated: SendMessage sends a raw message to a specific connection ID. Prefer using session.SendResponse or session.SendNotification.
func (*TransportManager) Shutdown ¶ added in v0.1.11
func (tm *TransportManager) Shutdown()
Shutdown signals the transport manager to stop accepting new connections.
type TransportType ¶ added in v0.1.11
type TransportType int
TransportType represents the type of transport.
const ( TransportNone TransportType = iota TransportStdio TransportWebsocket TransportSSE )