Documentation
¶
Index ¶
- type Aggregator
- func (a *Aggregator) Backends() *BackendManager
- func (a *Aggregator) CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
- func (a *Aggregator) Config() *Config
- func (a *Aggregator) Namespace() *Namespace
- func (a *Aggregator) Run(ctx context.Context) error
- func (a *Aggregator) Start(ctx context.Context) error
- func (a *Aggregator) Stop() error
- func (a *Aggregator) ToolCount() int
- func (a *Aggregator) Tools() []mcp.Tool
- type AggregatorConfig
- type Backend
- type BackendConfig
- type BackendError
- type BackendManager
- type Config
- type ConfigError
- type ConnectionConfig
- type Namespace
- type NamespacedTool
- type RoutingError
- type Server
- type ToolFilterConfig
- type ToolNotFoundError
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator orchestrates backend connections, namespacing, and the MCP server.
func New ¶
func New(cfg *Config) (*Aggregator, error)
New creates a new Aggregator from configuration.
func NewFromFile ¶
func NewFromFile(path string) (*Aggregator, error)
NewFromFile creates a new Aggregator by loading configuration from a YAML file.
func (*Aggregator) Backends ¶
func (a *Aggregator) Backends() *BackendManager
Backends returns the backend manager for inspection.
func (*Aggregator) CallTool ¶
func (a *Aggregator) CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
CallTool invokes a tool by its namespaced name.
func (*Aggregator) Config ¶
func (a *Aggregator) Config() *Config
Config returns the aggregator configuration.
func (*Aggregator) Namespace ¶
func (a *Aggregator) Namespace() *Namespace
Namespace returns the aggregator's namespace for inspection.
func (*Aggregator) Run ¶
func (a *Aggregator) Run(ctx context.Context) error
Run starts the MCP server on stdio transport.
func (*Aggregator) Start ¶
func (a *Aggregator) Start(ctx context.Context) error
Start initializes connections to all backends and builds the tool namespace. this is where structural enforcement happens: tools are filtered during initialization.
func (*Aggregator) Stop ¶
func (a *Aggregator) Stop() error
Stop gracefully shuts down the aggregator.
func (*Aggregator) ToolCount ¶
func (a *Aggregator) ToolCount() int
ToolCount returns the number of registered tools.
func (*Aggregator) Tools ¶
func (a *Aggregator) Tools() []mcp.Tool
Tools returns all aggregated, namespaced tools.
type AggregatorConfig ¶
type AggregatorConfig struct {
Name string
Version string
Separator string
Connection ConnectionConfig
}
AggregatorConfig contains settings for the aggregator itself.
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend represents a connection to a single backend MCP server.
func (*Backend) CallTool ¶
func (b *Backend) CallTool(ctx context.Context, name string, args map[string]any) (*mcp.CallToolResult, error)
CallTool invokes a tool on this backend.
type BackendConfig ¶
type BackendConfig struct {
ID string
Name string
Transport TransportConfig
Tools ToolFilterConfig
}
BackendConfig defines a single backend MCP server.
type BackendError ¶
BackendError represents an error related to a backend MCP server.
func (*BackendError) Error ¶
func (e *BackendError) Error() string
func (*BackendError) Unwrap ¶
func (e *BackendError) Unwrap() error
type BackendManager ¶
type BackendManager struct {
// contains filtered or unexported fields
}
BackendManager manages connections to multiple backend MCP servers.
func NewBackendManager ¶
func NewBackendManager(cfg *Config) *BackendManager
NewBackendManager creates a new manager for backend connections.
func (*BackendManager) Close ¶
func (m *BackendManager) Close() error
Close closes all backend connections.
func (*BackendManager) Connect ¶
func (m *BackendManager) Connect(ctx context.Context) error
Connect establishes connections to all configured backends. implements fail-fast: returns error if any backend fails to connect.
func (*BackendManager) GetBackend ¶
func (m *BackendManager) GetBackend(id string) (*Backend, bool)
GetBackend returns a backend by ID.
type Config ¶
type Config struct {
Aggregator AggregatorConfig
Backends []BackendConfig
}
Config represents the top-level aggregator configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with all defaults pre-populated.
func LoadConfig ¶
LoadConfig loads configuration from a YAML file, merging into defaults.
type ConfigError ¶
ConfigError represents a configuration validation error.
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type ConnectionConfig ¶
ConnectionConfig defines timeout settings.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace manages the aggregated tool registry with namespacing.
func NewNamespace ¶
NewNamespace creates a new namespace manager.
func (*Namespace) AddTools ¶
func (n *Namespace) AddTools(backendID string, tools []*mcp.Tool, filter *ToolFilterConfig)
AddTools adds tools from a backend, applying the filter and namespace prefix. this implements structural enforcement: only permitted tools are added.
type NamespacedTool ¶
NamespacedTool represents a tool with its namespace information.
type RoutingError ¶
RoutingError indicates a failure in routing a tool call.
func (*RoutingError) Error ¶
func (e *RoutingError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an MCP server with aggregation capabilities.
func NewServer ¶
func NewServer(cfg *Config, namespace *Namespace, backends *BackendManager) *Server
NewServer creates a new aggregator MCP server.
func (*Server) CallTool ¶
func (s *Server) CallTool(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error)
CallTool invokes a tool by its namespaced name.
type ToolFilterConfig ¶
ToolFilterConfig defines which tools are permitted.
type ToolNotFoundError ¶
type ToolNotFoundError struct {
Name string
}
ToolNotFoundError indicates a requested tool does not exist.
func (*ToolNotFoundError) Error ¶
func (e *ToolNotFoundError) Error() string