Documentation
¶
Overview ¶
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Name is the server name exposed in MCP protocol
Name string
// Version is the server version
Version 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
}
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( cfg *Config, rt router.Router, backendClient vmcp.BackendClient, discoveryMgr discovery.Manager, backends []vmcp.Backend, ) *Server
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) 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.