Versions in this module Expand all Collapse all v0 v0.0.4 Jul 28, 2025 Changes in this version + const AuthenticationError + const AuthorizationError + const CapabilityError + const ConfigurationError + const ExecutionError + const InternalError + const InvalidParams + const InvalidRequest + const MCPVersion + const MethodCompletionComplete + const MethodInitialize + const MethodInitialized + const MethodLoggingSetLevel + const MethodNotFound + const MethodPing + const MethodPromptsGet + const MethodPromptsList + const MethodResourcesList + const MethodResourcesRead + const MethodResourcesSubscribe + const MethodResourcesUnsubscribe + const MethodRootsList + const MethodSamplingCreate + const MethodToolsCall + const MethodToolsList + const NotificationCancelled + const NotificationProgress + const NotificationPromptsListChanged + const NotificationResourcesListChanged + const NotificationResourcesUpdated + const NotificationRootsListChanged + const NotificationToolsListChanged + const ParseError + const ProtocolError + const RateLimitError + const RequestCancelled + const RequestFailed + const RequestTimeout + const ResourceError + const SessionError + const StateError + const TransportError + const ValidationError + func CreatePingResponse() map[string]interface + func IsProgressSupported(method string) bool + func IsStandardMethod(method string) bool + func ValidateCapabilities(serverCapabilities CapabilitiesOpts, requiredCapabilities []string) error + func ValidateInitializeRequest(params InitializeParams) error + func ValidateMessage(msg MCPMessage) error + func ValidateProgressParams(params ProgressParams) error + type BatchInfo struct + BatchID string + Current int + LastBatch bool + Total int + type CacheConfig struct + Enabled bool + Key string + Refreshable bool + TTL time.Duration + Tags []string + type CachedResource struct + AccessCount int64 + CachedAt time.Time + ExpiresAt time.Time + LastAccess time.Time + Resource *Resource + Tags []string + type CapabilitiesOpts struct + Logging *LoggingOpts + Prompts *PromptsOpts + Resources *ResourcesOpts + Roots *RootsOpts + Sampling *SamplingOpts + Tools *ToolsOpts + func CapabilityOptsFromConfig(capOpt interface{}) CapabilitiesOpts + type Capability string + const LoggingCapability + const PromptsCapability + const ResourcesCapability + const RootsCapability + const SamplingCapability + const ToolsCapability + type ChangeNotification struct + JSONRPC string + Method string + Params ChangeParams + type ChangeNotificationManager struct + func NewChangeNotificationManager() *ChangeNotificationManager + func (cnm *ChangeNotificationManager) CleanupInactiveSubscribers(maxAge time.Duration) + func (cnm *ChangeNotificationManager) ForceNotifyPromptChanges() error + func (cnm *ChangeNotificationManager) ForceNotifyToolChanges() error + func (cnm *ChangeNotificationManager) GetPromptSubscribers() map[string]*ChangeSubscriber + func (cnm *ChangeNotificationManager) GetToolSubscribers() map[string]*ChangeSubscriber + func (cnm *ChangeNotificationManager) SubscribeToPromptChanges(clientID, sessionID string, notifyFunc func(*ChangeNotification) error) + func (cnm *ChangeNotificationManager) SubscribeToToolChanges(clientID, sessionID string, notifyFunc func(*ChangeNotification) error) + func (cnm *ChangeNotificationManager) UnsubscribeFromPromptChanges(clientID string) + func (cnm *ChangeNotificationManager) UnsubscribeFromToolChanges(clientID string) + func (cnm *ChangeNotificationManager) UpdatePrompts(serverName string, prompts []PromptDefinition) error + func (cnm *ChangeNotificationManager) UpdateTools(serverName string, tools []ToolDefinition) error + type ChangeParams struct + type ChangeSubscriber struct + ClientID string + LastNotify time.Time + NotifyFunc func(*ChangeNotification) error + SessionID string + Subscribed time.Time + type ClientInfo struct + Name string + Version string + type ClientSubscriptions struct + ClientID string + LastSeen time.Time + NotifyFunc func(*ResourceUpdateNotification) error + SessionID string + Subscriptions map[string]*ResourceSubscription + type DefaultTextTransformer struct + func (dt *DefaultTextTransformer) GetSupportedFormats() []string + func (dt *DefaultTextTransformer) GetTransformationOptions(fromFormat, toFormat string) map[string]interface{} + func (dt *DefaultTextTransformer) Transform(resource *Resource, targetFormat string, options map[string]interface{}) (*ResourceContentData, error) + type EmbeddedPromptResource struct + Context map[string]interface{} + Inline bool + Resource *Resource + Transform string + Type string + type EmbeddedResource struct + Content string + Description string + Metadata map[string]interface{} + Name string + URI string + type HTTPTransport struct + func NewHTTPTransport(baseURL string) *HTTPTransport + func (h *HTTPTransport) Close() error + func (h *HTTPTransport) GetLastActivity() time.Time + func (h *HTTPTransport) GetType() string + func (h *HTTPTransport) IsConnected() bool + func (h *HTTPTransport) Receive() (MCPMessage, error) + func (h *HTTPTransport) Send(msg MCPMessage) error + func (h *HTTPTransport) SendProgress(notification *ProgressNotification) error + func (h *HTTPTransport) SupportsProgress() bool + type HumanControlConfig struct + AllowedModels []string + AutoApprovePatterns []string + BlockPatterns []string + MaxTokens int + RequireApproval bool + TimeoutSeconds int + type HumanReviewResult struct + Approved bool + Comments string + Modifications map[string]interface{} + ReviewTime time.Time + Reviewer string + type IndexingConfig struct + Enabled bool + FullText bool + Keywords []string + Searchable bool + Summary string + type InitializeParams struct + Capabilities CapabilitiesOpts + ClientInfo ClientInfo + ProtocolVersion string + Roots []Root + type InitializeResult struct + Capabilities CapabilitiesOpts + Instructions string + ProtocolVersion string + Roots []Root + ServerInfo ServerInfo + func CreateInitializeResponse(serverInfo ServerInfo, capabilities CapabilitiesOpts, roots []Root) InitializeResult + type LoggingOpts struct + type MCPError struct + Code int + Data map[string]interface{} + Message string + func NewAuthenticationError(details string) *MCPError + func NewAuthorizationError(resource string, action string) *MCPError + func NewCapabilityError(capability string, details string) *MCPError + func NewConfigurationError(component string, details string) *MCPError + func NewExecutionError(tool string, details string) *MCPError + func NewInternalError(details string) *MCPError + func NewInvalidParams(details string, params interface{}) *MCPError + func NewInvalidRequest(details string) *MCPError + func NewMCPError(code int, message string, data ...map[string]interface{}) *MCPError + func NewMethodNotFound(method string) *MCPError + func NewParseError(details string) *MCPError + func NewProtocolError(expectedVersion string, actualVersion string) *MCPError + func NewRateLimitError(limit string, window string) *MCPError + func NewRequestTimeout(operation string, timeout string) *MCPError + func NewResourceError(resource string, operation string, details string) *MCPError + func NewSessionError(sessionId string, details string) *MCPError + func NewStateError(expectedState string, actualState string) *MCPError + func NewTransportError(transport string, details string) *MCPError + func NewValidationError(field string, value interface{}, constraint string) *MCPError + func (e *MCPError) Error() string + func (e *MCPError) GetRetryDelay() int + func (e *MCPError) IsRetryable() bool + func (e *MCPError) IsTemporary() bool + type MCPMessage struct + Error *MCPError + ID interface{} + JSONRPC string + Method string + Params json.RawMessage + ProgressToken string + Result json.RawMessage + type MCPNotification struct + JSONRPC string + Method string + Params json.RawMessage + func NewNotification(method string, params interface{}) (*MCPNotification, error) + type MCPRequest struct + ID interface{} + JSONRPC string + Method string + Params json.RawMessage + ProgressToken string + func NewRequest(id interface{}, method string, params interface{}, progressToken ...string) (*MCPRequest, error) + type MCPResponse struct + Error *MCPError + ID interface{} + JSONRPC string + ProgressToken string + Result json.RawMessage + func NewResponse(id interface{}, result interface{}, err *MCPError, progressToken ...string) (*MCPResponse, error) + type MCPTransport interface + GetLastActivity func() time.Time + GetType func() string + IsConnected func() bool + type MessageType string + const Notification + const Request + const Response + type ModelHint struct + Name string + type ModelPreferences struct + CostPriority string + Hints []ModelHint + IntelligencePriority string + SpeedPriority string + type ProgressListener func(token string, progress ProgressParams) + type ProgressManager struct + func NewProgressManager() *ProgressManager + func (pm *ProgressManager) AddProgressListener(token string, listener ProgressListener) + func (pm *ProgressManager) CompleteProgress(token string, message string) error + func (pm *ProgressManager) FailProgress(token string, err error) error + func (pm *ProgressManager) GenerateProgressToken(requestID interface{}) string + func (pm *ProgressManager) IsValidToken(token string) bool + func (pm *ProgressManager) UpdateDetailedProgress(token string, current, total int64, message string, details interface{}) error + func (pm *ProgressManager) UpdateProgress(token string, progress float64, message string, details interface{}) error + type ProgressNotification struct + JSONRPC string + Method string + Params ProgressParams + func CreateProgressNotification(params ProgressParams) *ProgressNotification + func ParseProgressNotification(data []byte) (*ProgressNotification, error) + type ProgressParams struct + Current *int64 + Details interface{} + Message string + Progress float64 + ProgressToken string + Total *int64 + type ProgressToken struct + Created time.Time + RequestID interface{} + Token string + type PromptArgument struct + Description string + Name string + Required bool + type PromptContentItem struct + ImageURL string + Resource *EmbeddedPromptResource + Text string + Type string + type PromptDefinition struct + Arguments []PromptArgument + Description string + Name string + type PromptMessage struct + Content []PromptContentItem + Metadata map[string]interface{} + Resources []*EmbeddedPromptResource + Role string + type PromptsOpts struct + ListChanged bool + type Resource struct + Accessed time.Time + Annotations map[string]interface{} + Cache *CacheConfig + Content *ResourceContentData + Created time.Time + Description string + Embedding *ResourceEmbedding + Metadata *ResourceMetadata + MimeType string + Modified time.Time + Name string + Size int64 + Template *URITemplate + URI string + type ResourceContent struct + Data string + Encoding string + MimeType string + Size int64 + Type string + type ResourceContentData struct + Compression string + Data string + Encoding string + Hash string + LastModified time.Time + Type string + type ResourceEmbedding struct + Context map[string]interface{} + Fallback string + MaxSize int64 + Strategy string + Transform string + type ResourceFilter struct + Pattern string + Property string + Type string + Value interface{} + type ResourceManager struct + func NewResourceManager() *ResourceManager + func (rm *ResourceManager) AddResource(resource *Resource) error + func (rm *ResourceManager) CleanupCache() + func (rm *ResourceManager) EmbedResourceInPrompt(uri string, strategy string, options map[string]interface{}) (*EmbeddedPromptResource, error) + func (rm *ResourceManager) GetCacheStats() map[string]interface{} + func (rm *ResourceManager) GetResource(uri string) (*Resource, error) + func (rm *ResourceManager) RegisterTransformer(name string, transformer ResourceTransformer) + func (rm *ResourceManager) Search(query string, filters map[string]interface{}) []*Resource + func (rm *ResourceManager) TransformResource(uri string, targetFormat string, options map[string]interface{}) (*ResourceContentData, error) + type ResourceMetadata struct + Author string + ContentType string + Custom map[string]interface{} + Encoding string + Indexing *IndexingConfig + Language string + Permissions *ResourcePermissions + Tags []string + Version string + type ResourcePermissions struct + Delete bool + Execute bool + Read bool + Roles []string + Share bool + Users []string + Write bool + type ResourceSubscription struct + ClientID string + Created time.Time + Filters []ResourceFilter + ID string + IsTemplate bool + LastNotified time.Time + Options SubscriptionOptions + SessionID string + URI string + type ResourceTemplate struct + Annotations map[string]interface{} + Description string + Examples []TemplateExample + MimeType string + Name string + URI string + Variables []TemplateVariable + type ResourceTransformer interface + GetSupportedFormats func() []string + GetTransformationOptions func(fromFormat, toFormat string) map[string]interface{} + Transform func(resource *Resource, targetFormat string, options map[string]interface{}) (*ResourceContentData, error) + type ResourceUpdate struct + Content *ResourceContent + Metadata map[string]interface{} + Timestamp time.Time + Type string + URI string + type ResourceUpdateNotification struct + JSONRPC string + Method string + Params ResourceUpdateParams + type ResourceUpdateParams struct + BatchInfo *BatchInfo + Resources []ResourceUpdate + type ResourcesOpts struct + ListChanged bool + Subscribe bool + type Root struct + Name string + URI string + type RootEntry struct + Added time.Time + LastUsed time.Time + Permissions *RootPermissions + Root Root + type RootManager struct + func NewRootManager() *RootManager + func (rm *RootManager) AddRoot(root Root, permissions *RootPermissions) error + func (rm *RootManager) CheckRootAccess(path string, operation string) (*RootEntry, error) + func (rm *RootManager) CreateDefaultRoots() error + func (rm *RootManager) GetRoot(uri string) (*RootEntry, error) + func (rm *RootManager) GetRootStats() map[string]interface{} + func (rm *RootManager) ListRoots() []Root + func (rm *RootManager) NotifyRootChange(uri string, event string) + func (rm *RootManager) RemoveRoot(uri string) error + func (rm *RootManager) UnwatchRoot(uri string) error + func (rm *RootManager) WatchRoot(uri string, callback func(uri string, event string)) error + type RootPermissions struct + List bool + Read bool + Watch bool + Write bool + type RootWatcher struct + Active bool + Callback func(uri string, event string) + LastChange time.Time + RootURI string + type RootsListRequest struct + type RootsListResponse struct + Roots []Root + type RootsOpts struct + ListChanged bool + type SSETransport struct + func NewSSETransport(sseURL string) *SSETransport + func (s *SSETransport) Close() error + func (s *SSETransport) GetLastActivity() time.Time + func (s *SSETransport) GetType() string + func (s *SSETransport) Initialize() error + func (s *SSETransport) IsConnected() bool + func (s *SSETransport) Receive() (MCPMessage, error) + func (s *SSETransport) Send(msg MCPMessage) error + func (s *SSETransport) SendProgress(notification *ProgressNotification) error + func (s *SSETransport) SupportsProgress() bool + type SamplingCapabilities struct + MaxTokens int + Models []string + SupportsImages bool + SupportsStreaming bool + SupportsTools bool + type SamplingContent struct + ImageData string + MimeType string + Resource *EmbeddedResource + Text string + Type string + type SamplingContext struct + ResourceContext []string + ServerInfo map[string]interface{} + SessionContext map[string]interface{} + ToolContext []string + type SamplingHandler interface + GetCapabilities func() SamplingCapabilities + GetSupportedModels func() []string + HandleSamplingRequest func(request *SamplingRequest) (*SamplingResponse, error) + type SamplingManager struct + func NewSamplingManager() *SamplingManager + func (sm *SamplingManager) ApproveRequest(requestID, reviewer, comments string) error + func (sm *SamplingManager) CleanupOldRequests(maxAge time.Duration) + func (sm *SamplingManager) CreateSamplingRequest(serverName string, messages []SamplingMessage, prefs ModelPreferences, ...) (*SamplingRequest, error) + func (sm *SamplingManager) GetPendingRequests() []*SamplingRequest + func (sm *SamplingManager) GetRequestStatus(requestID string) (string, error) + func (sm *SamplingManager) ProcessSamplingRequest(requestID string) (*SamplingResponse, error) + func (sm *SamplingManager) RegisterHandler(name string, handler SamplingHandler) + func (sm *SamplingManager) RejectRequest(requestID, reviewer, reason string) error + func (sm *SamplingManager) SetHumanControls(serverName string, config *HumanControlConfig) + type SamplingMessage struct + Content SamplingContent + Metadata map[string]interface{} + Role string + type SamplingOpts struct + type SamplingRequest struct + Context SamplingContext + Created time.Time + HumanReview *HumanReviewResult + ID string + MaxTokens int + Messages []SamplingMessage + ModelPrefs ModelPreferences + ServerName string + Status string + StopSequence []string + Temperature float64 + type SamplingResponse struct + Content SamplingContent + Metadata map[string]interface{} + Model string + StopReason string + Usage SamplingUsage + type SamplingUsage struct + InputTokens int + OutputTokens int + TotalTokens int + type ServerInfo struct + Name string + Version string + type StandardMethodHandler struct + func NewStandardMethodHandler(serverInfo ServerInfo, capabilities CapabilitiesOpts, logger *logging.Logger) *StandardMethodHandler + func (h *StandardMethodHandler) GetCapabilities() CapabilitiesOpts + func (h *StandardMethodHandler) GetRootManager() *RootManager + func (h *StandardMethodHandler) GetServerInfo() ServerInfo + func (h *StandardMethodHandler) HandleStandardMethod(method string, params json.RawMessage, requestID interface{}) (*MCPResponse, error) + func (h *StandardMethodHandler) HandleStandardNotification(method string, params json.RawMessage) error + func (h *StandardMethodHandler) IsInitialized() bool + func (h *StandardMethodHandler) SetCapability(capability string, enabled bool, options interface{}) error + type StdioTransport struct + func NewStdioTransport(r io.Reader, w io.Writer) *StdioTransport + func (t *StdioTransport) Close() error + func (t *StdioTransport) GetProgressManager() *ProgressManager + func (t *StdioTransport) Receive() (MCPMessage, error) + func (t *StdioTransport) Send(msg MCPMessage) error + func (t *StdioTransport) SendProgress(notification *ProgressNotification) error + func (t *StdioTransport) SupportsProgress() bool + type SubscribeRequest struct + Filters []ResourceFilter + Options SubscriptionOptions + URI string + type SubscribeResponse struct + SubscriptionID string + type SubscriptionManager struct + func NewSubscriptionManager() *SubscriptionManager + func (sm *SubscriptionManager) CleanupExpiredSubscriptions(maxAge time.Duration) + func (sm *SubscriptionManager) GetSubscriptions(clientID string) []*ResourceSubscription + func (sm *SubscriptionManager) NotifyResourceUpdate(uri string, updateType string, content *ResourceContent, ...) error + func (sm *SubscriptionManager) Subscribe(clientID, sessionID string, req SubscribeRequest, ...) (*SubscribeResponse, error) + func (sm *SubscriptionManager) Unsubscribe(clientID string, req UnsubscribeRequest) error + type SubscriptionOptions struct + BatchSize int + ContentTypes []string + Debounce int + IncludeContent bool + IncludeMetadata bool + MaxSize int64 + type TemplateExample struct + Description string + Result string + Variables map[string]interface{} + type TemplateExpression struct + EndPos int + Operator string + Raw string + StartPos int + Variables []VariableSpec + type TemplateVariable struct + Default interface{} + Description string + Enum []string + Name string + Pattern string + Required bool + Type string + type ToolDefinition struct + Description string + InputSchema map[string]interface{} + Name string + type ToolsOpts struct + ListChanged bool + type Transport interface + Close func() error + Receive func() (MCPMessage, error) + Send func(msg MCPMessage) error + SendProgress func(notification *ProgressNotification) error + SupportsProgress func() bool + type URITemplate struct + Expressions []TemplateExpression + Template string + func ParseURITemplate(template string) (*URITemplate, error) + func (ut *URITemplate) Expand(variables map[string]interface{}) (string, error) + func (ut *URITemplate) GetVariableNames() []string + func (ut *URITemplate) Validate() error + type UnsubscribeRequest struct + SubscriptionID string + type VariableSpec struct + MaxLength int + Modifier string + Name string + type WebSocketConnection struct + Capabilities *CapabilitiesOpts + ClientInfo *ClientInfo + Context map[string]interface{} + ID string + Initialized bool + LastActivity time.Time + ServerInfo *ServerInfo + Transport *WebSocketTransport + type WebSocketHandler interface + OnConnect func(transport *WebSocketTransport) error + OnDisconnect func(transport *WebSocketTransport) error + OnMessage func(transport *WebSocketTransport, message MCPMessage) error + type WebSocketServer struct + func NewWebSocketServer() *WebSocketServer + func (ws *WebSocketServer) Close() error + func (ws *WebSocketServer) GetConnections() map[string]*WebSocketTransport + func (ws *WebSocketServer) GetHandler(name string) (WebSocketHandler, bool) + func (ws *WebSocketServer) RegisterHandler(name string, handler WebSocketHandler) + func (ws *WebSocketServer) UpgradeHTTP(w http.ResponseWriter, r *http.Request, handler WebSocketHandler) (*WebSocketTransport, error) + type WebSocketTransport struct + func NewWebSocketTransport(url string) *WebSocketTransport + func (wst *WebSocketTransport) Close() error + func (wst *WebSocketTransport) GetLastActivity() time.Time + func (wst *WebSocketTransport) GetType() string + func (wst *WebSocketTransport) IsConnected() bool + func (wst *WebSocketTransport) Receive() (MCPMessage, error) + func (wst *WebSocketTransport) Send(msg MCPMessage) error + func (wst *WebSocketTransport) SendProgress(notification *ProgressNotification) error + func (wst *WebSocketTransport) Start() error + func (wst *WebSocketTransport) SupportsProgress() bool