Documentation
¶
Overview ¶
Package server assembles the single HTTP listener: health endpoints, the Prometheus exposition, the REST API, and the MCP streamable-HTTP endpoint (the latter two optionally behind OAuth).
Index ¶
Constants ¶
const ( ProviderDex = "dex" ProviderGoogle = "google" )
OAuth providers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Addr string
MCPPath string
// OAuth, when set, makes the server an OAuth 2.1 resource server: the MCP
// endpoint and the REST API require a bearer token the platform IdP
// issued (forwarded by muster / sent by the portal) or this server's own,
// and every call carries the caller's identity. Off: anonymous — only for
// a listener nothing but a trusted proxy or the local user can reach.
OAuth *OAuthConfig
// Metrics, when set, is served at GET /metrics outside the OAuth guard
// like the probes: Prometheus scrapers do not do OAuth flows, and the
// exposition holds no secrets (VM ids, names, states, counters).
// Operators who need it private firewall the path or disable it with
// --metrics-enabled=false.
Metrics http.Handler
}
Config configures the listener.
type OAuthConfig ¶
type OAuthConfig struct {
// BaseURL is the public URL of this server: the OAuth issuer identifier
// of its own authorization-server metadata (https, or http on loopback).
BaseURL string
// Provider is the IdP: dex (default) or google.
Provider string
// Dex provider (Provider == dex).
DexIssuerURL string
DexClientID string
DexClientSecret string
// DexCAFile is a PEM CA bundle for an IdP with a private certificate;
// verifies discovery, token and JWKS calls. Empty: system trust.
DexCAFile string
// Google provider (Provider == google).
GoogleClientID string
GoogleClientSecret string
// TrustedAudiences are the OAuth client ids whose IdP id_tokens are
// accepted as bearer tokens (SSO token forwarding): the platform client
// MCP clients and the muster CLI log in with. Empty: only tokens this
// server issued itself.
TrustedAudiences []string
// AllowPrivateIPJWKSHosts lists the hosts, other than the issuer's own,
// whose JWKS may resolve to RFC 1918 and RFC 4193 addresses: a jwks_uri
// the IdP's discovery document puts on another host. The issuer host needs
// no entry. Loopback, link-local and metadata addresses stay refused.
AllowPrivateIPJWKSHosts []string
// AllowPublicClientRegistration lets MCP clients register over DCR
// without a token (labs only).
AllowPublicClientRegistration bool
}
OAuthConfig makes vm-manager an OAuth 2.1 resource server (mcp-oauth) in front of the MCP endpoint and the REST API. The platform's identity provider is the authority: on the Agent Platform, muster forwards the session's IdP id_token byte-identical (MCPServer auth.forwardToken) and the portal sends the signed-in user's id_token through the gateway; both are validated here against the IdP's JWKS when their audience is one of TrustedAudiences (the platform's OAuth client). The caller's identity then travels with the request (identity package).
func (OAuthConfig) Validate ¶
func (c OAuthConfig) Validate() error
Validate checks required fields.