Documentation
¶
Overview ¶
Package server implements the Virtual MCP Server that aggregates multiple backend MCP servers into a unified interface.
Package server implements the Virtual MCP Server that aggregates multiple backend MCP servers into a unified interface.
Package server implements the Virtual MCP Server that aggregates multiple backend MCP servers into a unified interface.
The server exposes aggregated capabilities (tools, resources, prompts) and routes incoming MCP protocol requests to appropriate backend workloads.
Package server implements the Virtual MCP Server that aggregates multiple backend MCP servers into a unified interface.
Package server implements the Virtual MCP Server that aggregates multiple backend MCP servers into a unified interface.
Index ¶
- func ConvertConfigToWorkflowDefinitions(compositeTools []*config.CompositeToolConfig) (map[string]*composer.WorkflowDefinition, error)
- type BackendHealthResponse
- type BackendStatus
- type Config
- type Server
- func (s *Server) Address() string
- func (s *Server) GetAllBackendHealthStates() map[string]*health.State
- func (s *Server) GetBackendHealthState(backendID string) (*health.State, error)
- func (s *Server) GetBackendHealthStatus(backendID string) (vmcp.BackendHealthStatus, error)
- func (s *Server) GetHealthSummary() health.Summary
- func (s *Server) Ready() <-chan struct{}
- func (s *Server) SessionManager() *transportsession.Manager
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertConfigToWorkflowDefinitions ¶ added in v0.6.6
func ConvertConfigToWorkflowDefinitions( compositeTools []*config.CompositeToolConfig, ) (map[string]*composer.WorkflowDefinition, error)
ConvertConfigToWorkflowDefinitions converts configuration composite tools to workflow definitions.
This function performs the following transformations:
- Convert config.CompositeToolConfig to composer.WorkflowDefinition
- Validate workflow definitions (basic checks, not full validation)
- Return map of workflow definitions keyed by workflow name
Full validation (cycle detection, tool references) is performed later during server initialization via composer.ValidateWorkflow().
Returns error if any composite tool configuration is invalid or duplicate names exist.
Types ¶
type BackendHealthResponse ¶ added in v0.6.16
type BackendHealthResponse struct {
// MonitoringEnabled indicates if health monitoring is active.
MonitoringEnabled bool `json:"monitoring_enabled"`
// Summary provides aggregate health statistics.
// Only populated if MonitoringEnabled is true.
Summary *health.Summary `json:"summary,omitempty"`
// Backends contains the detailed health state of each backend.
// Only populated if MonitoringEnabled is true.
Backends map[string]*health.State `json:"backends,omitempty"`
}
BackendHealthResponse represents the health status response for all backends.
type BackendStatus ¶ added in v0.6.16
type BackendStatus struct {
Name string `json:"name"`
Health string `json:"health"` // "healthy", "degraded", "unhealthy", "unknown"
Transport string `json:"transport"` // MCP transport protocol
AuthType string `json:"auth_type,omitempty"` // "unauthenticated", "header_injection", "token_exchange"
}
BackendStatus represents the status of a single backend MCP server.
type Config ¶
type Config struct {
// Name is the server name exposed in MCP protocol
Name string
// Version is the server version
Version string
// GroupRef is the name of the MCPGroup containing backend workloads.
// Used for operational visibility in status endpoint and logging.
GroupRef string
// Host is the bind address (default: "127.0.0.1")
Host string
// Port is the bind port (default: 4483)
Port int
// EndpointPath is the MCP endpoint path (default: "/mcp")
EndpointPath string
// SessionTTL is the session time-to-live duration (default: 30 minutes)
// Sessions inactive for this duration will be automatically cleaned up
SessionTTL time.Duration
// AuthMiddleware is the optional authentication middleware to apply to MCP routes.
// If nil, no authentication is required.
// This should be a composed middleware chain (e.g., TokenValidator → IdentityMiddleware).
AuthMiddleware func(http.Handler) http.Handler
// AuthInfoHandler is the optional handler for /.well-known/oauth-protected-resource endpoint.
// Exposes OIDC discovery information about the protected resource.
AuthInfoHandler http.Handler
// TelemetryProvider is the optional telemetry provider.
// If nil, no telemetry is recorded.
TelemetryProvider *telemetry.Provider
// AuditConfig is the optional audit configuration.
// If nil, no audit logging is performed.
// Component should be set to "vmcp-server" to distinguish vMCP audit logs.
AuditConfig *audit.Config
// HealthMonitorConfig is the optional health monitoring configuration.
// If nil, health monitoring is disabled.
HealthMonitorConfig *health.MonitorConfig
}
Config holds the Virtual MCP Server configuration.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the Virtual MCP Server that aggregates multiple backends.
func New ¶
func New( ctx context.Context, cfg *Config, rt router.Router, backendClient vmcp.BackendClient, discoveryMgr discovery.Manager, backends []vmcp.Backend, workflowDefs map[string]*composer.WorkflowDefinition, ) (*Server, error)
New creates a new Virtual MCP Server instance.
func (*Server) Address ¶
Address returns the server's actual listen address. If the server is started with port 0, this returns the actual bound port.
func (*Server) GetAllBackendHealthStates ¶ added in v0.6.16
GetAllBackendHealthStates returns the health states of all backends. Returns empty map if health monitoring is disabled.
func (*Server) GetBackendHealthState ¶ added in v0.6.16
GetBackendHealthState returns the full health state of a specific backend. Returns error if health monitoring is disabled or backend not found.
func (*Server) GetBackendHealthStatus ¶ added in v0.6.16
func (s *Server) GetBackendHealthStatus(backendID string) (vmcp.BackendHealthStatus, error)
GetBackendHealthStatus returns the health status of a specific backend. Returns error if health monitoring is disabled or backend not found.
func (*Server) GetHealthSummary ¶ added in v0.6.16
GetHealthSummary returns a summary of backend health across all backends. Returns zero-valued summary if health monitoring is disabled.
func (*Server) Ready ¶
func (s *Server) Ready() <-chan struct{}
Ready returns a channel that is closed when the server is ready to accept connections. This is useful for testing and synchronization.
func (*Server) SessionManager ¶
func (s *Server) SessionManager() *transportsession.Manager
SessionManager returns the session manager instance. This is useful for testing and monitoring.
type StatusResponse ¶ added in v0.6.16
type StatusResponse struct {
Backends []BackendStatus `json:"backends"`
Healthy bool `json:"healthy"`
Version string `json:"version"`
GroupRef string `json:"group_ref"`
}
StatusResponse represents the vMCP server's operational status.