Documentation
¶
Index ¶
- func NewProxyElicitationHandler() client.ElicitationHandler
- func NewProxySamplingHandler() client.SamplingHandler
- type Capabilities
- type McpConfig
- type McpHost
- func (h *McpHost) AllTools(ctx context.Context) ([]server.ServerTool, error)
- func (h *McpHost) Hooks() *server.Hooks
- func (h *McpHost) ServerTools(ctx context.Context, serverName string) ([]server.ServerTool, error)
- func (h *McpHost) Servers() []string
- func (h *McpHost) SetProxyServer(server *server.MCPServer)
- func (h *McpHost) SetSession(session server.ClientSession)
- func (h *McpHost) Start(ctx context.Context) error
- func (h *McpHost) Stop() error
- type McpHostOption
- type ProxyElicitationHandler
- type ProxySamplingHandler
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProxyElicitationHandler ¶
func NewProxyElicitationHandler() client.ElicitationHandler
func NewProxySamplingHandler ¶
func NewProxySamplingHandler() client.SamplingHandler
NewProxySamplingHandler creates a new ProxySamplingHandler with the given MCP server.
Types ¶
type Capabilities ¶
type Capabilities struct {
Sampling client.SamplingHandler
Elicitation client.ElicitationHandler
}
type McpConfig ¶
type McpConfig struct {
// Servers maps server names to their configurations
Servers map[string]*ServerConfig `json:"servers"`
}
McpConfig represents the overall MCP configuration structure
type McpHost ¶
type McpHost struct {
// contains filtered or unexported fields
}
McpHost manages multiple MCP (Model Context Protocol) servers and their tools
func NewMcpHost ¶
func NewMcpHost(options ...McpHostOption) *McpHost
NewMcpHost creates a new McpHost with the provided options
func (*McpHost) ServerTools ¶
GetServerTools retrieves all tools from all connected MCP servers
func (*McpHost) SetProxyServer ¶
func (*McpHost) SetSession ¶
func (h *McpHost) SetSession(session server.ClientSession)
type McpHostOption ¶
type McpHostOption func(*McpHost)
McpHostOption defines a functional option for configuring the McpHost
func WithCapabilities ¶
func WithCapabilities(capabilities Capabilities) McpHostOption
WithServer adds a single server configuration to the MCP host
func WithServers ¶
func WithServers(servers map[string]*ServerConfig) McpHostOption
WithServers configures the MCP host with a set of server configurations
type ProxyElicitationHandler ¶
type ProxyElicitationHandler struct {
// contains filtered or unexported fields
}
ProxyElicitationHandler is a proxy handler that forwards elicitation requests to an MCP server.
func (*ProxyElicitationHandler) Elicit ¶
func (p *ProxyElicitationHandler) Elicit( ctx context.Context, request mcp.ElicitationRequest, ) (*mcp.ElicitationResult, error)
Elicit sends the elicitation request to the MCP server and returns the result.
type ProxySamplingHandler ¶
type ProxySamplingHandler struct {
// contains filtered or unexported fields
}
ProxySamplingHandler is a proxy handler that forwards sampling requests to an MCP server.
func (*ProxySamplingHandler) CreateMessage ¶
func (p *ProxySamplingHandler) CreateMessage( ctx context.Context, request mcp.CreateMessageRequest, ) (*mcp.CreateMessageResult, error)
CreateMessage sends the sampling request to the MCP server and returns the result.
type ServerConfig ¶
type ServerConfig struct {
// Type specifies the type of MCP server (e.g., "stdio", "http")
Type string `json:"type"`
// Url is the HTTP url of the MCP server
Url string `json:"url"`
// Command is the executable path or command to run the MCP server
Command string `json:"command"`
// Args are optional command-line arguments for the server command
Args []string `json:"args,omitempty"`
// Env are optional environment variables for the server process
Env []string `json:"env,omitempty"`
}
ServerConfig represents an individual server configuration