Documentation
¶
Index ¶
Constants ¶
const ( TransportStdio = "stdio" TransportHTTPSSE = "http_sse" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
ListTools(ctx context.Context) ([]ToolDefinition, error)
CallTool(ctx context.Context, toolName, argsJSON string) (any, error)
}
Client is the MCP client abstraction used by the manager.
type Connector ¶
type Connector interface {
Connect(ctx context.Context, serverName string, cfg config.MCPServerConfig) (Client, error)
}
Connector dials a server and returns a client implementation.
type Connectors ¶
Connectors groups supported transport connectors.
func DefaultConnectors ¶
func DefaultConnectors() Connectors
DefaultConnectors returns production connectors for stdio and HTTP/SSE transports.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns configured MCP servers and dynamic tool registration.
func NewManager ¶
func NewManager(servers map[string]config.MCPServerConfig, connectors Connectors) *Manager
NewManager constructs a manager from config.MCP.Servers.
func (*Manager) CallTool ¶
func (m *Manager) CallTool(ctx context.Context, serverName, toolName, argsJSON string) (string, error)
CallTool routes a raw tool call to the selected MCP server client. When the server is degraded or a tool call fails, CallTool attempts bounded reconnect with backoff.
func (*Manager) Connect ¶
Connect discovers tools from each configured server. Failures are tracked as degraded states and do not fail the entire manager.
func (*Manager) RegisterTools ¶
RegisterTools registers discovered MCP tools into the given registry.
func (*Manager) Statuses ¶
func (m *Manager) Statuses() []ServerStatus
Statuses returns per-server connection/discovery status.
type ServerStatus ¶
type ServerStatus struct {
Name string
Transport string
Connected bool
Degraded bool
ToolCount int
Message string
}
ServerStatus represents current manager state for one configured server.
type ToolDefinition ¶
ToolDefinition describes a tool discovered from an MCP server.