Documentation
¶
Index ¶
- Constants
- func BuildClaudeNativeSkills(skills []Skill) []map[string]interface{}
- func BuildSkillsPromptSection(skills []Skill) string
- func ConvertMCPToolsToAnthropicFormat(mcpTools []MCPTool) []map[string]interface{}
- func ConvertMCPToolsToOpenAIFormat(mcpTools []MCPTool) []map[string]interface{}
- func ConvertMCPToolsToToolDefinitions(mcpTools []MCPTool) []tools.ToolDefinition
- func ExecuteTool(toolName string, params map[string]interface{}, cfg *config.MCPConfig, ...) (interface{}, error)
- func ExecuteToolStreamingWithContext(ctx context.Context, toolName string, params map[string]interface{}, ...) (interface{}, error)
- func ExecuteToolWithContext(ctx context.Context, toolName string, params map[string]interface{}, ...) (interface{}, error)
- func GetMCPToolsForProvider(mcpConfig *config.MCPConfig, provider string) interface{}
- func GetSkillTools(skills []Skill) []string
- func GetToolDisplayName(toolName string) string
- func InitializeExternalServers(servers []config.ExternalMCPServer) error
- func IsExternalTool(toolName string) bool
- func IsMCPTool(toolName string, mcpConfig *config.MCPConfig) bool
- func MakeExternalToolName(serverName, toolName string) string
- func ParseExternalToolName(fullName string) (serverName, toolName string)
- type ClientCapabilities
- type ClientInfo
- type ContentBlock
- type ExternalClientInterface
- type ExternalMCPTool
- type ExternalServerManager
- func (m *ExternalServerManager) AddServer(cfg StandardMCPServerConfig) error
- func (m *ExternalServerManager) AddStdioServer(cfg StdioMCPServerConfig) error
- func (m *ExternalServerManager) CallTool(fullName string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (m *ExternalServerManager) CallToolStreaming(fullName string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (m *ExternalServerManager) CallToolStreamingWithContext(ctx context.Context, fullName string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (m *ExternalServerManager) CallToolWithContext(ctx context.Context, fullName string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (m *ExternalServerManager) GetServerNames() []string
- func (m *ExternalServerManager) GetTool(fullName string) *ExternalMCPTool
- func (m *ExternalServerManager) GetTools() []ExternalMCPTool
- func (m *ExternalServerManager) RefreshServer(name string) error
- func (m *ExternalServerManager) RemoveServer(name string) error
- type InitializeParams
- type InitializeResult
- type JSONRPCError
- type JSONRPCMessage
- type JSONRPCNotification
- type JSONRPCRequest
- type JSONRPCResponse
- type LogNotificationParams
- type LoggingCapability
- type MCPNotification
- type MCPNotificationCallback
- type MCPPromptDefinition
- type MCPResourceDefinition
- type MCPTool
- type MCPToolDefinition
- type MCPToolExecutor
- type ProgressNotificationParams
- type PromptArgument
- type PromptsCapability
- type PromptsListResult
- type ResourceReference
- type ResourcesCapability
- type ResourcesListResult
- type RootsCapability
- type SamplingCapability
- type ServerCapabilities
- type ServerInfo
- type Skill
- type StandardMCPClient
- func (c *StandardMCPClient) CallTool(name string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (c *StandardMCPClient) CallToolStreaming(name string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (c *StandardMCPClient) CallToolStreamingWithContext(ctx context.Context, name string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (c *StandardMCPClient) CallToolWithContext(ctx context.Context, name string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (c *StandardMCPClient) Close() error
- func (c *StandardMCPClient) Initialize() error
- func (c *StandardMCPClient) IsInitialized() bool
- func (c *StandardMCPClient) ListPrompts() ([]MCPPromptDefinition, error)
- func (c *StandardMCPClient) ListResources() ([]MCPResourceDefinition, error)
- func (c *StandardMCPClient) ListTools() ([]MCPToolDefinition, error)
- func (c *StandardMCPClient) Name() string
- func (c *StandardMCPClient) ServerInfo() *ServerInfo
- type StandardMCPServerConfig
- type StdioMCPClient
- func (c *StdioMCPClient) CallTool(name string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (c *StdioMCPClient) CallToolStreaming(name string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (c *StdioMCPClient) CallToolStreamingWithContext(ctx context.Context, name string, arguments map[string]interface{}, ...) (*ToolCallResult, error)
- func (c *StdioMCPClient) CallToolWithContext(ctx context.Context, name string, arguments map[string]interface{}) (*ToolCallResult, error)
- func (c *StdioMCPClient) GetServerInfo() *ServerInfo
- func (c *StdioMCPClient) Initialize() error
- func (c *StdioMCPClient) IsInitialized() bool
- func (c *StdioMCPClient) ListTools() ([]MCPToolDefinition, error)
- func (c *StdioMCPClient) Name() string
- func (c *StdioMCPClient) ServerInfo() *ServerInfo
- func (c *StdioMCPClient) Start() error
- func (c *StdioMCPClient) Stop() error
- type StdioMCPServerConfig
- type StreamingExternalClient
- type ToolCallMeta
- type ToolCallParams
- type ToolCallResult
- type ToolsCapability
- type ToolsListResult
Constants ¶
const ( ParseError = -32700 InvalidRequest = -32600 MethodNotFound = -32601 InvalidParams = -32602 InternalError = -32603 )
Standard MCP error codes
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
const MCPProtocolVersion = "2025-11-25"
Current MCP protocol version
Variables ¶
This section is empty.
Functions ¶
func BuildClaudeNativeSkills ¶
BuildClaudeNativeSkills converts skills to Claude native skills format
func BuildSkillsPromptSection ¶
BuildSkillsPromptSection builds the system prompt section for skills (for non-Claude providers)
func ConvertMCPToolsToAnthropicFormat ¶
ConvertMCPToolsToAnthropicFormat converts MCP tools to Anthropic's tool format
func ConvertMCPToolsToOpenAIFormat ¶
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 ExecuteToolStreamingWithContext ¶ added in v1.37.0
func ExecuteToolStreamingWithContext(ctx context.Context, toolName string, params map[string]interface{}, cfg *config.MCPConfig, sessionID string, callback MCPNotificationCallback) (interface{}, error)
ExecuteToolStreamingWithContext executes an MCP tool with notification streaming support.
func ExecuteToolWithContext ¶ added in v1.34.0
func ExecuteToolWithContext(ctx context.Context, toolName string, params map[string]interface{}, cfg *config.MCPConfig, sessionID string) (interface{}, error)
ExecuteToolWithContext executes an MCP tool with cancellation support
func GetMCPToolsForProvider ¶
GetMCPToolsForProvider returns MCP tools formatted for the specified provider
func GetSkillTools ¶
GetSkillTools returns all MCP tools referenced by enabled skills
func GetToolDisplayName ¶
GetToolDisplayName returns the display name for an MCP tool. Checks external tools for Title, then falls back to cleaned tool name.
func InitializeExternalServers ¶
func InitializeExternalServers(servers []config.ExternalMCPServer) error
InitializeFromConfig loads all external servers from config
func IsExternalTool ¶
IsExternalTool checks if a tool name is from an external server (contains __)
func MakeExternalToolName ¶
MakeExternalToolName creates a full tool name from server and tool names
func ParseExternalToolName ¶
ParseExternalToolName splits "server__tool" into parts
Types ¶
type ClientCapabilities ¶
type ClientCapabilities struct {
Roots *RootsCapability `json:"roots,omitempty"`
Sampling *SamplingCapability `json:"sampling,omitempty"`
}
ClientCapabilities declares what the client supports
type ClientInfo ¶
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 ¶
func (m *ExternalServerManager) AddServer(cfg StandardMCPServerConfig) error
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) CallToolStreaming ¶ added in v1.37.0
func (m *ExternalServerManager) CallToolStreaming(fullName string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreaming executes a tool on the appropriate external server with streaming notification support. If callback is nil, falls back to CallTool.
func (*ExternalServerManager) CallToolStreamingWithContext ¶ added in v1.40.0
func (m *ExternalServerManager) CallToolStreamingWithContext(ctx context.Context, fullName string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreamingWithContext executes a tool with streaming and context for cancellation
func (*ExternalServerManager) CallToolWithContext ¶ added in v1.40.0
func (m *ExternalServerManager) CallToolWithContext(ctx context.Context, fullName string, arguments map[string]interface{}) (*ToolCallResult, error)
CallToolWithContext executes a tool with context for cancellation support
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 (sorted for cache stability)
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 JSONRPCMessage ¶ added in v1.37.0
type JSONRPCMessage struct {
JSONRPC string `json:"jsonrpc"`
ID *int `json:"id,omitempty"` // nil for notifications, present for responses
Method string `json:"method,omitempty"` // present for notifications/requests
Params json.RawMessage `json:"params,omitempty"` // for notifications
Result json.RawMessage `json:"result,omitempty"` // for responses
Error *JSONRPCError `json:"error,omitempty"` // for error responses
}
JSONRPCMessage is a raw JSON-RPC message used for routing. It can represent either a response (has ID) or a notification (has Method, no ID). Used in the transport layer to distinguish message types before routing.
func (*JSONRPCMessage) IsNotification ¶ added in v1.37.0
func (m *JSONRPCMessage) IsNotification() bool
IsNotification returns true if this message is a notification (no id, has method).
func (*JSONRPCMessage) IsResponse ¶ added in v1.37.0
func (m *JSONRPCMessage) IsResponse() bool
IsResponse returns true if this message is a response (has id).
type JSONRPCNotification ¶ added in v1.37.0
type JSONRPCNotification struct {
JSONRPC string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
JSONRPCNotification represents a JSON-RPC 2.0 notification (no id field). Servers send these for progress, log, and resource change events.
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 LogNotificationParams ¶ added in v1.37.0
type LogNotificationParams struct {
Level string `json:"level"` // "debug", "info", "warning", "error"
Logger string `json:"logger,omitempty"` // source logger name
Data interface{} `json:"data"` // log content
}
LogNotificationParams represents params for notifications/message (server log)
type MCPNotification ¶ added in v1.37.0
type MCPNotification struct {
Type string // "progress", "log"
Message string // human-readable message
Progress float64 // 0.0-1.0 for progress notifications
Total float64 // total units if applicable
Level string // for log notifications: "debug", "info", "warning", "error"
}
MCPNotification is a parsed server notification ready for consumption. This is the bridge type between the MCP transport layer and external streaming systems.
func ParseNotification ¶ added in v1.37.0
func ParseNotification(msg JSONRPCMessage) MCPNotification
ParseNotification converts a raw JSONRPCMessage notification into an MCPNotification.
type MCPNotificationCallback ¶ added in v1.37.0
type MCPNotificationCallback func(notification MCPNotification)
MCPNotificationCallback is called when the server sends a notification during a tool call. The mcp package defines this type; the stream/processor package provides the implementation.
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 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 MCPTool ¶
type MCPTool struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
InputSchema map[string]interface{} `json:"inputSchema"`
ServerName string `json:"server_name"`
}
MCPTool represents an MCP tool in our internal format
func ConvertExternalToolsToToolDefinitions ¶
func ConvertExternalToolsToToolDefinitions(tools []ExternalMCPTool) []MCPTool
ConvertExternalToolsToToolDefinitions converts external MCP tools to our internal format
func GetEnabledMCPTools ¶
GetEnabledMCPTools returns MCP tools from external servers
func GetMCPToolByName ¶
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
DisplayName string `json:"displayName,omitempty"` // Alternative display name field
Description string `json:"description,omitempty"`
InputSchema map[string]interface{} `json:"inputSchema"`
OutputSchema map[string]interface{} `json:"outputSchema,omitempty"` // 2025-06-18 spec: structured output schema
}
MCPToolDefinition represents a tool in standard MCP format
type MCPToolExecutor ¶
type MCPToolExecutor struct{}
MCPToolExecutor handles execution of MCP tools via external standard MCP servers
func GetMCPExecutor ¶
func GetMCPExecutor(cfg *config.MCPConfig) *MCPToolExecutor
GetMCPExecutor returns the global MCP tool executor
func NewMCPToolExecutor ¶
func NewMCPToolExecutor() *MCPToolExecutor
NewMCPToolExecutor creates a new MCP tool executor
type ProgressNotificationParams ¶ added in v1.37.0
type ProgressNotificationParams struct {
ProgressToken interface{} `json:"progressToken"` // matches the token sent in _meta
Progress float64 `json:"progress"` // current progress value
Total float64 `json:"total,omitempty"` // total units (if known)
Message string `json:"message,omitempty"` // human-readable status
}
ProgressNotificationParams represents params for notifications/progress
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 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 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 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 ¶
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"`
}
Skill represents a skill with tools and instructions
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) CallToolStreaming ¶ added in v1.37.0
func (c *StandardMCPClient) CallToolStreaming(name string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreaming executes a tool with streaming notification support. Progress and log notifications from the server are routed to the callback. If callback is nil, behaves identically to CallTool.
func (*StandardMCPClient) CallToolStreamingWithContext ¶ added in v1.40.0
func (c *StandardMCPClient) CallToolStreamingWithContext(ctx context.Context, name string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreamingWithContext executes a tool with streaming and context for cancellation
func (*StandardMCPClient) CallToolWithContext ¶ added in v1.40.0
func (c *StandardMCPClient) CallToolWithContext(ctx context.Context, name string, arguments map[string]interface{}) (*ToolCallResult, error)
CallToolWithContext executes a tool with context for cancellation
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 (with pagination)
func (*StandardMCPClient) ListTools ¶
func (c *StandardMCPClient) ListTools() ([]MCPToolDefinition, error)
ListTools fetches available tools from the server (with pagination)
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) CallToolStreaming ¶ added in v1.37.0
func (c *StdioMCPClient) CallToolStreaming(name string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreaming executes a tool with streaming notification support. Progress and log notifications from the server are routed to the callback. If callback is nil, behaves identically to CallTool.
func (*StdioMCPClient) CallToolStreamingWithContext ¶ added in v1.40.0
func (c *StdioMCPClient) CallToolStreamingWithContext(ctx context.Context, name string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
CallToolStreamingWithContext executes a tool with streaming and context for cancellation
func (*StdioMCPClient) CallToolWithContext ¶ added in v1.40.0
func (c *StdioMCPClient) CallToolWithContext(ctx context.Context, name string, arguments map[string]interface{}) (*ToolCallResult, error)
CallToolWithContext executes a tool with context for cancellation
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 (with pagination)
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 StreamingExternalClient ¶ added in v1.37.0
type StreamingExternalClient interface {
ExternalClientInterface
CallToolStreaming(name string, arguments map[string]interface{}, callback MCPNotificationCallback) (*ToolCallResult, error)
}
StreamingExternalClient extends ExternalClientInterface with streaming support. Clients that implement this can stream progress/log notifications during tool calls.
type ToolCallMeta ¶ added in v1.37.0
type ToolCallMeta struct {
ProgressToken interface{} `json:"progressToken,omitempty"` // string or int per MCP spec
}
ToolCallMeta holds request metadata for tool calls
type ToolCallParams ¶
type ToolCallParams struct {
Name string `json:"name"`
Arguments map[string]interface{} `json:"arguments,omitempty"`
Meta *ToolCallMeta `json:"_meta,omitempty"`
}
ToolCallParams for tools/call request
type ToolCallResult ¶
type ToolCallResult struct {
Content []ContentBlock `json:"content"`
IsError bool `json:"isError,omitempty"`
StructuredContent map[string]interface{} `json:"structuredContent,omitempty"` // 2025-06-18 spec
}
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