mcp

package
v1.33.53 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParseError     = -32700
	InvalidRequest = -32600
	MethodNotFound = -32601
	InvalidParams  = -32602
	InternalError  = -32603
)

Standard MCP error codes

View Source
const ExternalToolSeparator = "__"

ExternalToolSeparator is the character used to separate server name from tool name Using double underscore to avoid conflicts with tool names that might contain single underscore

View Source
const MCPProtocolVersion = "2025-03-26"

Current MCP protocol version

Variables

This section is empty.

Functions

func BuildClaudeNativeSkills

func BuildClaudeNativeSkills(skills []Skill) []map[string]interface{}

BuildClaudeNativeSkills converts skills to Claude native skills format

func BuildSkillsPromptSection

func BuildSkillsPromptSection(skills []Skill) string

BuildSkillsPromptSection builds the system prompt section for skills (for non-Claude providers)

func CheckMCPConnection

func CheckMCPConnection(cfg *config.MCPConfig) error

CheckMCPConnection checks if MCP server is reachable

func ConvertMCPToolsToAnthropicFormat

func ConvertMCPToolsToAnthropicFormat(mcpTools []MCPTool) []map[string]interface{}

ConvertMCPToolsToAnthropicFormat converts MCP tools to Anthropic's tool format

func ConvertMCPToolsToOpenAIFormat

func ConvertMCPToolsToOpenAIFormat(mcpTools []MCPTool) []map[string]interface{}

ConvertMCPToolsToOpenAIFormat converts MCP tools to OpenAI's function format

func ConvertMCPToolsToToolDefinitions

func ConvertMCPToolsToToolDefinitions(mcpTools []MCPTool) []tools.ToolDefinition

ConvertMCPToolsToToolDefinitions converts MCP tools to the format expected by providers

func ExecuteTool

func ExecuteTool(toolName string, params map[string]interface{}, cfg *config.MCPConfig, sessionID string) (interface{}, error)

ExecuteTool is a convenience function to execute an MCP tool

func GetMCPToolsForProvider

func GetMCPToolsForProvider(mcpConfig *config.MCPConfig, provider string) interface{}

GetMCPToolsForProvider returns MCP tools formatted for the specified provider

func GetSkillTools

func GetSkillTools(skills []Skill) []string

GetSkillTools returns all MCP tools referenced by enabled skills

func GetToolDisplayName

func GetToolDisplayName(toolName string) string

GetToolDisplayName returns the display name for an MCP tool Returns empty string if tool not found

func InitializeExternalServers

func InitializeExternalServers(servers []config.ExternalMCPServer) error

InitializeFromConfig loads all external servers from config

func IsExternalTool

func IsExternalTool(toolName string) bool

IsExternalTool checks if a tool name is from an external server (contains __)

func IsMCPTool

func IsMCPTool(toolName string, mcpConfig *config.MCPConfig) bool

IsMCPTool checks if a tool name corresponds to an MCP tool

func MakeExternalToolName

func MakeExternalToolName(serverName, toolName string) string

MakeExternalToolName creates a full tool name from server and tool names

func ParseExternalToolName

func ParseExternalToolName(fullName string) (serverName, toolName string)

ParseExternalToolName splits "server__tool" into parts

func RefreshMCPCache

func RefreshMCPCache(cfg *config.MCPConfig) error

RefreshMCPCache refreshes the MCP cache

Types

type ClientCapabilities

type ClientCapabilities struct {
	Roots    *RootsCapability    `json:"roots,omitempty"`
	Sampling *SamplingCapability `json:"sampling,omitempty"`
}

ClientCapabilities declares what the client supports

type ClientInfo

type ClientInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ClientInfo identifies the client

type ContentBlock

type ContentBlock struct {
	Type        string                 `json:"type"` // "text", "image", "resource"
	Text        string                 `json:"text,omitempty"`
	Data        string                 `json:"data,omitempty"`     // base64 for images
	MimeType    string                 `json:"mimeType,omitempty"` // for images
	Resource    *ResourceReference     `json:"resource,omitempty"` // for embedded resources
	Annotations map[string]interface{} `json:"annotations,omitempty"`
}

ContentBlock in tool results

type ExternalClientInterface added in v1.33.30

type ExternalClientInterface interface {
	Initialize() error
	ListTools() ([]MCPToolDefinition, error)
	CallTool(name string, arguments map[string]interface{}) (*ToolCallResult, error)
	Name() string
}

ExternalClientInterface for both HTTP and stdio external MCP clients

type ExternalMCPTool

type ExternalMCPTool struct {
	ServerName        string                 `json:"server_name"`
	ServerDisplayName string                 `json:"server_display_name"` // From MCP server's ServerInfo.Name
	Name              string                 `json:"name"`
	Title             string                 `json:"title"`     // Human-readable title (e.g., "Add email for auth user")
	FullName          string                 `json:"full_name"` // "server__tool"
	Description       string                 `json:"description"`
	InputSchema       map[string]interface{} `json:"inputSchema"`
}

ExternalMCPTool represents a tool from an external MCP server

type ExternalServerManager

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

ExternalServerManager manages connections to external standard MCP servers

func GetExternalServerManager

func GetExternalServerManager() *ExternalServerManager

GetExternalServerManager returns the global external server manager

func (*ExternalServerManager) AddServer

AddServer adds and initializes a new HTTP-based external MCP server

func (*ExternalServerManager) AddStdioServer added in v1.33.30

func (m *ExternalServerManager) AddStdioServer(cfg StdioMCPServerConfig) error

AddStdioServer adds and initializes a new stdio-based MCP server

func (*ExternalServerManager) CallTool

func (m *ExternalServerManager) CallTool(fullName string, arguments map[string]interface{}) (*ToolCallResult, error)

CallTool executes a tool on the appropriate external server

func (*ExternalServerManager) GetServerNames

func (m *ExternalServerManager) GetServerNames() []string

GetServerNames returns list of connected server names

func (*ExternalServerManager) GetTool

func (m *ExternalServerManager) GetTool(fullName string) *ExternalMCPTool

GetTool returns a specific tool by full name (server:tool) Also handles reverse lookup for sanitized names from Claude

func (*ExternalServerManager) GetTools

func (m *ExternalServerManager) GetTools() []ExternalMCPTool

GetTools returns all tools from all external servers

func (*ExternalServerManager) RefreshServer

func (m *ExternalServerManager) RefreshServer(name string) error

RefreshServer refreshes tools from a specific server

func (*ExternalServerManager) RemoveServer

func (m *ExternalServerManager) RemoveServer(name string) error

RemoveServer removes an external MCP server

type InitializeParams

type InitializeParams struct {
	ProtocolVersion string             `json:"protocolVersion"`
	Capabilities    ClientCapabilities `json:"capabilities"`
	ClientInfo      ClientInfo         `json:"clientInfo"`
}

InitializeParams for the initialize request

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string             `json:"protocolVersion"`
	Capabilities    ServerCapabilities `json:"capabilities"`
	ServerInfo      ServerInfo         `json:"serverInfo"`
	Instructions    string             `json:"instructions,omitempty"`
}

InitializeResult from the initialize response

type JSONRPCError

type JSONRPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

JSONRPCError represents a JSON-RPC 2.0 error

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      int         `json:"id"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params,omitempty"`
}

JSONRPCRequest represents a JSON-RPC 2.0 request

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      int           `json:"id"`
	Result  interface{}   `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
}

JSONRPCResponse represents a JSON-RPC 2.0 response

type LoggingCapability

type LoggingCapability struct{}

LoggingCapability for logging support

type MCPCache

type MCPCache struct {
	Servers     map[int]MCPServer        `json:"servers"`
	Tools       map[string]MCPTool       `json:"tools"`     // key: "server_name:tool_name"
	Resources   map[string][]MCPResource `json:"resources"` // key: server_name, value: list of resources
	LastRefresh time.Time                `json:"last_refresh"`
	// contains filtered or unexported fields
}

MCPCache represents the in-memory cache

func GetMCPCache

func GetMCPCache() *MCPCache

GetMCPCache returns the global MCP cache instance

func (*MCPCache) GetResourceServers

func (cache *MCPCache) GetResourceServers() []string

GetResourceServers returns list of server names that have resources

func (*MCPCache) GetResources

func (cache *MCPCache) GetResources(serverName string) []MCPResource

GetResources returns cached resources, optionally filtered by server name

func (*MCPCache) GetServers

func (cache *MCPCache) GetServers() []MCPServer

GetServers returns all cached servers

func (*MCPCache) GetTools

func (cache *MCPCache) GetTools(serverName string) []MCPTool

GetTools returns cached tools, optionally filtered by server name

func (*MCPCache) UpdateCache

func (cache *MCPCache) UpdateCache(servers []MCPServer, tools []MCPTool)

UpdateCache updates the cache with new servers and tools

func (*MCPCache) UpdateResources

func (cache *MCPCache) UpdateResources(resourcesByServer map[string][]MCPResource)

UpdateResources updates the cached resources for servers

type MCPClient

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

MCPClient handles communication with MCP servers

func NewMCPClient

func NewMCPClient(cfg *config.MCPConfig) *MCPClient

NewMCPClient creates a new MCP client

func (*MCPClient) FetchSkills

func (c *MCPClient) FetchSkills(names []string) ([]Skill, error)

FetchSkills fetches skills by names from MCP server

func (*MCPClient) HealthCheck

func (c *MCPClient) HealthCheck() error

HealthCheck verifies connection to MCP server

func (*MCPClient) ListAllResources

func (c *MCPClient) ListAllResources() ([]MCPResource, error)

ListAllResources fetches resources from all servers that support resources (DEPRECATED - use ListAllResourcesFromAPI)

func (*MCPClient) ListAllResourcesFromAPI

func (c *MCPClient) ListAllResourcesFromAPI() ([]MCPResource, error)

ListAllResourcesFromAPI fetches all resources in a single API call to /resources/list

func (*MCPClient) ListResources

func (c *MCPClient) ListResources(serverID int) ([]MCPResource, error)

ListResources fetches available resources from an MCP server

func (*MCPClient) ListWebhooks

func (c *MCPClient) ListWebhooks() ([]map[string]interface{}, error)

ListWebhooks fetches available webhook events from MCP servers

func (*MCPClient) LoadServers

func (c *MCPClient) LoadServers() ([]MCPServer, error)

LoadServers fetches available servers from MCP endpoint

func (*MCPClient) LoadTools

func (c *MCPClient) LoadTools() ([]MCPTool, error)

LoadTools fetches available tools from MCP endpoint

func (*MCPClient) ReadResource

func (c *MCPClient) ReadResource(serverID int, uri string) (*ResourceContent, error)

ReadResource fetches the content of a specific resource

func (*MCPClient) Subscribe

func (c *MCPClient) Subscribe(serverID int, uri string) error

Subscribe subscribes to updates for a specific resource

func (*MCPClient) Unsubscribe

func (c *MCPClient) Unsubscribe(serverID int, uri string) error

Unsubscribe unsubscribes from updates for a specific resource

type MCPPromptDefinition

type MCPPromptDefinition struct {
	Name        string           `json:"name"`
	Description string           `json:"description,omitempty"`
	Arguments   []PromptArgument `json:"arguments,omitempty"`
}

MCPPromptDefinition represents a prompt in standard MCP format

type MCPResource

type MCPResource struct {
	URI         string               `json:"uri"`
	Name        string               `json:"name"`
	Title       string               `json:"title,omitempty"`
	Description string               `json:"description,omitempty"`
	MimeType    string               `json:"mimeType,omitempty"`
	Size        int64                `json:"size,omitempty"`
	Annotations *ResourceAnnotations `json:"annotations,omitempty"`
	ServerID    int                  `json:"serverId"`    // MCP server returns camelCase
	ServerName  string               `json:"server_name"` // Set by agent
	LoadedAt    time.Time            `json:"loaded_at"`   // Set by agent
}

MCPResource represents a resource from an MCP server

type MCPResourceDefinition

type MCPResourceDefinition struct {
	URI         string `json:"uri"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	MimeType    string `json:"mimeType,omitempty"`
}

MCPResourceDefinition represents a resource in standard MCP format

type MCPServer

type MCPServer struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name"`
	Description string    `json:"description"`
	IconURL     string    `json:"icon_url,omitempty"`
	Version     string    `json:"version"`
	Status      string    `json:"status"`
	LoadedAt    time.Time `json:"loaded_at"`
}

MCPServer represents a cached MCP server

type MCPServerResponse

type MCPServerResponse struct {
	Success bool        `json:"success"`
	Servers []MCPServer `json:"servers"`
}

API Response structures

type MCPTool

type MCPTool struct {
	Name                 string                 `json:"name"`
	DisplayName          string                 `json:"display_name"`
	Description          string                 `json:"description"`
	InputSchema          map[string]interface{} `json:"inputSchema"`
	RequiresCredentials  bool                   `json:"requires_credentials"`
	ServerID             int                    `json:"server_id"`
	ServerName           string                 `json:"server_name"`
	CredentialProviderID int                    `json:"credential_provider_id,omitempty"`
	LoadedAt             time.Time              `json:"loaded_at"`
	LastUsed             time.Time              `json:"last_used,omitempty"`
}

MCPTool represents a cached MCP tool

func ConvertExternalToolsToToolDefinitions

func ConvertExternalToolsToToolDefinitions(tools []ExternalMCPTool) []MCPTool

ConvertExternalToolsToToolDefinitions converts external MCP tools to our internal format

func GetAllMCPTools

func GetAllMCPTools(mcpConfig *config.MCPConfig) []MCPTool

GetAllMCPTools returns all tools including external MCP server tools

func GetEnabledMCPTools

func GetEnabledMCPTools(mcpConfig *config.MCPConfig) []MCPTool

GetEnabledMCPTools returns MCP tools that are enabled in the configuration

func GetMCPToolByName

func GetMCPToolByName(toolName string) *MCPTool

GetMCPToolByName retrieves a specific MCP tool by name

type MCPToolDefinition

type MCPToolDefinition struct {
	Name        string                 `json:"name"`
	Title       string                 `json:"title,omitempty"`       // Human-readable title (e.g., "Add email for auth user")
	DisplayName string                 `json:"displayName,omitempty"` // Alternative display name field
	Description string                 `json:"description,omitempty"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

MCPToolDefinition represents a tool in standard MCP format

type MCPToolExecutor

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

MCPToolExecutor handles execution of MCP tools

func GetMCPExecutor

func GetMCPExecutor(cfg *config.MCPConfig) *MCPToolExecutor

GetMCPExecutor returns the global MCP tool executor

func NewMCPToolExecutor

func NewMCPToolExecutor(cfg *config.MCPConfig) *MCPToolExecutor

NewMCPToolExecutor creates a new MCP tool executor

func (*MCPToolExecutor) ExecuteMCPTool

func (e *MCPToolExecutor) ExecuteMCPTool(toolName string, params map[string]interface{}, sessionID string) (interface{}, error)

ExecuteMCPTool executes an MCP tool with the given parameters

func (*MCPToolExecutor) ExecuteMCPToolWithConfig

func (e *MCPToolExecutor) ExecuteMCPToolWithConfig(toolName string, params map[string]interface{}, cfg *config.MCPConfig, sessionID string) (interface{}, error)

ExecuteMCPToolWithConfig executes an MCP tool with the given parameters and config

type MCPToolResponse

type MCPToolResponse struct {
	Success bool      `json:"success"`
	Data    []MCPTool `json:"data"`
}

type MCPWebhookEvent

type MCPWebhookEvent struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

MCPWebhookEvent represents a single webhook event

type MCPWebhookServer

type MCPWebhookServer struct {
	Server      string            `json:"server"`
	DisplayName string            `json:"display_name"`
	Events      []MCPWebhookEvent `json:"events"`
}

MCPWebhookServer represents webhooks available from an MCP server

type MCPWebhooksResponse

type MCPWebhooksResponse struct {
	Success  bool               `json:"success"`
	Webhooks []MCPWebhookServer `json:"webhooks"`
	Count    int                `json:"count"`
}

MCPWebhooksResponse is the response from /webhooks/list

type PromptArgument

type PromptArgument struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
}

PromptArgument for prompt parameters

type PromptsCapability

type PromptsCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
}

PromptsCapability for prompt support

type PromptsListResult

type PromptsListResult struct {
	Prompts    []MCPPromptDefinition `json:"prompts"`
	NextCursor string                `json:"nextCursor,omitempty"`
}

PromptsListResult from prompts/list response

type ResourceAnnotations

type ResourceAnnotations struct {
	Audience     []string `json:"audience,omitempty"`     // "user", "assistant"
	Priority     float64  `json:"priority,omitempty"`     // 0.0-1.0
	LastModified string   `json:"lastModified,omitempty"` // ISO 8601
}

ResourceAnnotations contains optional hints about resource usage

type ResourceContent

type ResourceContent struct {
	URI      string `json:"uri"`
	MimeType string `json:"mimeType,omitempty"`
	Text     string `json:"text,omitempty"`
	Blob     string `json:"blob,omitempty"` // Base64 encoded binary
}

ResourceContent represents the content of a resource

type ResourceListRequest

type ResourceListRequest struct {
	ServerID int    `json:"server_id"`
	Cursor   string `json:"cursor,omitempty"`
}

type ResourceListResponse

type ResourceListResponse struct {
	Success    bool          `json:"success"`
	Resources  []MCPResource `json:"resources"` // Legacy field
	Data       []MCPResource `json:"data"`      // Current MCP server format
	NextCursor string        `json:"nextCursor,omitempty"`
	Error      string        `json:"error,omitempty"`
}

func (*ResourceListResponse) GetResources

func (r *ResourceListResponse) GetResources() []MCPResource

GetResources returns resources from either field (data or resources)

type ResourceReadRequest

type ResourceReadRequest struct {
	ServerID int    `json:"server_id"`
	URI      string `json:"uri"`
}

type ResourceReadResponse

type ResourceReadResponse struct {
	Success  bool              `json:"success"`
	Contents []ResourceContent `json:"contents"`
	Error    string            `json:"error,omitempty"`
}

type ResourceReference

type ResourceReference struct {
	URI      string `json:"uri"`
	MimeType string `json:"mimeType,omitempty"`
	Text     string `json:"text,omitempty"`
	Blob     string `json:"blob,omitempty"` // base64
}

ResourceReference for embedded resources in content

type ResourceSubscribeRequest

type ResourceSubscribeRequest struct {
	ServerID int    `json:"server_id"`
	URI      string `json:"uri"`
}

type ResourceSubscribeResponse

type ResourceSubscribeResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

type ResourceSyncer

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

ResourceSyncer manages syncing MCP resources to memory

func NewResourceSyncer

func NewResourceSyncer(mcpClient *MCPClient, memoryManager *memory.MemoryManager, resources []string, cfg *config.MCPResourceConfig, eventBus *events.EventBus) *ResourceSyncer

NewResourceSyncer creates a new resource syncer resources: list of resource URIs to sync (e.g., ["notion://page/123", "github://repo/abc"]) cfg: resource sync settings (auto_sync, interval, filters, etc.)

func (*ResourceSyncer) GetSyncStatus

func (s *ResourceSyncer) GetSyncStatus() map[string]interface{}

GetSyncStatus returns current sync status

func (*ResourceSyncer) GetSyncedResources

func (s *ResourceSyncer) GetSyncedResources() []SyncedResource

GetSyncedResources returns list of synced resources

func (*ResourceSyncer) HandleResourceUpdate

func (s *ResourceSyncer) HandleResourceUpdate(serverID int, uri string) error

HandleResourceUpdate handles a resource update notification

func (*ResourceSyncer) Start

func (s *ResourceSyncer) Start() error

Start begins background sync if configured

func (*ResourceSyncer) Stop

func (s *ResourceSyncer) Stop()

Stop stops background sync and cleans up subscriptions

func (*ResourceSyncer) SyncAll

func (s *ResourceSyncer) SyncAll() (*SyncStats, error)

SyncAll syncs all configured resource URIs

func (*ResourceSyncer) SyncResource

func (s *ResourceSyncer) SyncResource(serverID int, serverName string, resource MCPResource) (bool, error)

SyncResource syncs a single resource to memory Returns true if this is a new resource, false if updated

func (*ResourceSyncer) SyncServer

func (s *ResourceSyncer) SyncServer(serverID int, serverName string) (*SyncStats, error)

SyncServer syncs all resources from a specific server

type ResourceTemplate

type ResourceTemplate struct {
	URITemplate string `json:"uriTemplate"`
	Name        string `json:"name"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	MimeType    string `json:"mimeType,omitempty"`
}

ResourceTemplate represents a parameterized resource template

type ResourcesCapability

type ResourcesCapability struct {
	Subscribe   bool `json:"subscribe,omitempty"`
	ListChanged bool `json:"listChanged,omitempty"`
}

ResourcesCapability for resource support

type ResourcesListResult

type ResourcesListResult struct {
	Resources  []MCPResourceDefinition `json:"resources"`
	NextCursor string                  `json:"nextCursor,omitempty"`
}

ResourcesListResult from resources/list response

type RootsCapability

type RootsCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
}

RootsCapability for filesystem roots

type SamplingCapability

type SamplingCapability struct{}

SamplingCapability for LLM sampling

type ServerCapabilities

type ServerCapabilities struct {
	Tools     *ToolsCapability     `json:"tools,omitempty"`
	Resources *ResourcesCapability `json:"resources,omitempty"`
	Prompts   *PromptsCapability   `json:"prompts,omitempty"`
	Logging   *LoggingCapability   `json:"logging,omitempty"`
}

ServerCapabilities declares what the server supports

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ServerInfo identifies the server

type Skill

type Skill struct {
	Name         string                 `json:"name"`
	DisplayName  string                 `json:"display_name"`
	Description  string                 `json:"description"`
	Version      string                 `json:"version"`
	Instructions string                 `json:"instructions"`
	Tools        []string               `json:"tools"`
	ClaudeNative map[string]interface{} `json:"claude_native,omitempty"`
	Category     string                 `json:"category"`
	Tags         []string               `json:"tags"`
	Icon         string                 `json:"icon"`
	LoadedAt     time.Time              `json:"loaded_at"`
}

Skill represents a skill fetched from MCP server

func GetEnabledSkills

func GetEnabledSkills(skillsCfg *config.SkillsConfig) []Skill

GetEnabledSkills returns the currently enabled skills from cache

func LoadSkills

func LoadSkills(cfg *config.MCPConfig, skillsCfg *config.SkillsConfig) ([]Skill, error)

LoadSkills loads skills from MCP server and updates cache

type SkillsCache

type SkillsCache struct {
	Skills      map[string]Skill // key: skill name
	LastRefresh time.Time
	// contains filtered or unexported fields
}

SkillsCache caches skills in memory

func GetSkillsCache

func GetSkillsCache() *SkillsCache

GetSkillsCache returns the global skills cache instance

func (*SkillsCache) GetSkills

func (cache *SkillsCache) GetSkills(names []string) []Skill

GetSkills returns cached skills by names

func (*SkillsCache) UpdateSkills

func (cache *SkillsCache) UpdateSkills(skills []Skill)

UpdateSkills updates the skills cache

type SkillsResponse

type SkillsResponse struct {
	Success bool    `json:"success"`
	Skills  []Skill `json:"skills"`
	Count   int     `json:"count"`
}

SkillsResponse represents the API response from skill-list

type StandardMCPClient

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

StandardMCPClient connects to standard MCP servers using Streamable HTTP transport

func NewStandardMCPClient

func NewStandardMCPClient(cfg StandardMCPServerConfig) *StandardMCPClient

NewStandardMCPClient creates a new standard MCP client

func (*StandardMCPClient) CallTool

func (c *StandardMCPClient) CallTool(name string, arguments map[string]interface{}) (*ToolCallResult, error)

CallTool executes a tool on the server

func (*StandardMCPClient) Close

func (c *StandardMCPClient) Close() error

Close closes the client connection

func (*StandardMCPClient) Initialize

func (c *StandardMCPClient) Initialize() error

Initialize performs the MCP handshake with the server

func (*StandardMCPClient) IsInitialized

func (c *StandardMCPClient) IsInitialized() bool

IsInitialized returns true if the client has been initialized

func (*StandardMCPClient) ListPrompts

func (c *StandardMCPClient) ListPrompts() ([]MCPPromptDefinition, error)

ListPrompts fetches available prompts from the server

func (*StandardMCPClient) ListResources

func (c *StandardMCPClient) ListResources() ([]MCPResourceDefinition, error)

ListResources fetches available resources from the server

func (*StandardMCPClient) ListTools

func (c *StandardMCPClient) ListTools() ([]MCPToolDefinition, error)

ListTools fetches available tools from the server

func (*StandardMCPClient) Name

func (c *StandardMCPClient) Name() string

Name returns the server name

func (*StandardMCPClient) ServerInfo

func (c *StandardMCPClient) ServerInfo() *ServerInfo

ServerInfo returns the server info (after initialization)

type StandardMCPServerConfig

type StandardMCPServerConfig struct {
	Name    string            `json:"name"`              // Unique name for this server
	URL     string            `json:"url"`               // Server endpoint URL
	Headers map[string]string `json:"headers,omitempty"` // Optional headers (for auth, etc.)
	Timeout time.Duration     `json:"timeout,omitempty"` // Request timeout
	Enabled bool              `json:"enabled"`
}

StandardMCPServerConfig configures a standard MCP server connection

type StdioMCPClient added in v1.33.30

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

StdioMCPClient connects to MCP servers using stdio transport (stdin/stdout)

func NewStdioMCPClient added in v1.33.30

func NewStdioMCPClient(cfg StdioMCPServerConfig) *StdioMCPClient

NewStdioMCPClient creates a new stdio MCP client

func (*StdioMCPClient) CallTool added in v1.33.30

func (c *StdioMCPClient) CallTool(name string, arguments map[string]interface{}) (*ToolCallResult, error)

CallTool executes a tool on the server

func (*StdioMCPClient) GetServerInfo added in v1.33.30

func (c *StdioMCPClient) GetServerInfo() *ServerInfo

GetServerInfo returns server info

func (*StdioMCPClient) Initialize added in v1.33.30

func (c *StdioMCPClient) Initialize() error

Initialize initializes the MCP connection

func (*StdioMCPClient) IsInitialized added in v1.33.30

func (c *StdioMCPClient) IsInitialized() bool

IsInitialized returns whether the client is initialized

func (*StdioMCPClient) ListTools added in v1.33.30

func (c *StdioMCPClient) ListTools() ([]MCPToolDefinition, error)

ListTools fetches available tools from the server

func (*StdioMCPClient) Name added in v1.33.30

func (c *StdioMCPClient) Name() string

Name returns the server name

func (*StdioMCPClient) ServerInfo added in v1.33.41

func (c *StdioMCPClient) ServerInfo() *ServerInfo

ServerInfo returns server info (alias for GetServerInfo for interface consistency)

func (*StdioMCPClient) Start added in v1.33.30

func (c *StdioMCPClient) Start() error

Start starts the MCP server process

func (*StdioMCPClient) Stop added in v1.33.30

func (c *StdioMCPClient) Stop() error

Stop stops the MCP server process

type StdioMCPServerConfig added in v1.33.30

type StdioMCPServerConfig struct {
	Name    string            `json:"name"`          // Unique name for this server
	Command []string          `json:"command"`       // Command to run (e.g., ["npx", "-y", "@dangahagan/weather-mcp"])
	Env     map[string]string `json:"env,omitempty"` // Environment variables
	Enabled bool              `json:"enabled"`
}

StdioMCPServerConfig configures a stdio MCP server

type SyncStats

type SyncStats struct {
	TotalResources   int       `json:"total_resources"`
	NewResources     int       `json:"new_resources"`
	UpdatedResources int       `json:"updated_resources"`
	DeletedResources int       `json:"deleted_resources"`
	SkippedResources int       `json:"skipped_resources"`
	Errors           int       `json:"errors"`
	ErrorMessages    []string  `json:"error_messages,omitempty"`
	Duration         string    `json:"duration"`
	SyncedAt         time.Time `json:"synced_at"`
}

SyncStats contains statistics about a sync operation

type SyncedResource

type SyncedResource struct {
	URI        string    `json:"uri"`
	Name       string    `json:"name"`
	ServerID   int       `json:"server_id"`
	ServerName string    `json:"server_name"`
	MimeType   string    `json:"mime_type"`
	Checksum   string    `json:"checksum"`
	ChunkCount int       `json:"chunk_count"`
	SyncedAt   time.Time `json:"synced_at"`
}

SyncedResource represents a resource that has been synced

type ToolCallParams

type ToolCallParams struct {
	Name      string                 `json:"name"`
	Arguments map[string]interface{} `json:"arguments,omitempty"`
}

ToolCallParams for tools/call request

type ToolCallResult

type ToolCallResult struct {
	Content []ContentBlock `json:"content"`
	IsError bool           `json:"isError,omitempty"`
}

ToolCallResult from tools/call response

type ToolsCapability

type ToolsCapability struct {
	ListChanged bool `json:"listChanged,omitempty"`
}

ToolsCapability for tool support

type ToolsListResult

type ToolsListResult struct {
	Tools      []MCPToolDefinition `json:"tools"`
	NextCursor string              `json:"nextCursor,omitempty"`
}

ToolsListResult from tools/list response

Jump to

Keyboard shortcuts

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