Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyToolOverrides(tools []otypes.MCPServerTool, toolOverrides []otypes.ToolOverride, ...) []otypes.MCPServerTool
- func ComputeK8sSettingsHash(settings v1.K8sSettingsSpec, ...) string
- func ConvertTools(tools []mcp.Tool, unsupportedTools []string) ([]otypes.MCPServerTool, error)
- func CoreResourceRequirements(resources *types.MCPResourceRequirements) (*corev1.ResourceRequirements, error)
- func CurrentImagePullSecretNames(ctx context.Context, client kclient.Client, mcpRuntimeBackend string, ...) ([]string, error)
- func EffectiveDefaultMCPResourceRequirements(k8sSettings v1.K8sSettingsSpec) corev1.ResourceRequirements
- func EffectiveDefaultMCPResourceRequirementsWithMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) corev1.ResourceRequirements
- func IsKubernetesBackend(backend string) bool
- func ListAllowedSecretBindingTargets(ctx context.Context, c kclient.Client, obotNamespace, allowedLabel string) ([]types.MCPAllowedSecretBindingTarget, error)
- func MergeBoundCreds(ctx context.Context, c kclient.Client, obotNamespace string, ...) (map[string]string, error)
- func OTELEnv(serviceName string, hostBaseURL string) map[string][]byte
- func ServerNanobotConfig(server ServerConfig, isComposite bool) ntypes.Config
- func SourceIDForURL(sourceURL string) string
- func ValidateCatalogEntryForRoute(manifest types.MCPServerCatalogEntryManifest, catalogID, workspaceID string) error
- func ValidateCatalogEntryManifest(ctx context.Context, manifest types.MCPServerCatalogEntryManifest, ...) error
- func ValidateConfiguredK8sSettingsResourceMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) error
- func ValidateK8sSettingsResourceMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) error
- func ValidatePSALevel(level string) bool
- func ValidateRemoteMCPURL(ctx context.Context, rawURL string, config RemoteMCPURLValidationConfig) error
- func ValidateSecretBindings(manifest types.MCPServerManifest, gitManaged, adminManaged bool, ...) error
- func ValidateSecretBindingsAvailable(ctx context.Context, c kclient.Client, obotNamespace string, ...) error
- func ValidateSecretBindingsCatalogEntry(manifest types.MCPServerCatalogEntryManifest, gitManaged, userIsAdmin bool, ...) error
- func ValidateServerManifest(ctx context.Context, manifest types.MCPServerManifest, isMultiUser bool, ...) error
- func ValidateSystemMCPServerCatalogEntryManifest(ctx context.Context, manifest types.SystemMCPServerCatalogEntryManifest, ...) error
- func ValidateSystemMCPServerManifest(ctx context.Context, manifest types.SystemMCPServerManifest, ...) error
- func ValidateTemplateReferences(manifest types.MCPServerManifest) error
- func ValidateTemplateReferencesCatalogEntry(manifest types.MCPServerCatalogEntryManifest) error
- type Client
- type ComponentServer
- type CompositeValidator
- func (v CompositeValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
- func (v CompositeValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
- func (v CompositeValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
- type Config
- type ContainerizedValidator
- func (v ContainerizedValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
- func (v ContainerizedValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
- func (v ContainerizedValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
- type ErrNotSupportedByBackend
- type File
- type GlobalTokenStore
- type MissingSecretBinding
- type NPXValidator
- func (v NPXValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
- func (v NPXValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
- func (v NPXValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
- type Options
- type PSAEnforceLevel
- type RemoteMCPURLValidationConfig
- type RemoteValidator
- func (v RemoteValidator) ValidateCatalogConfig(ctx context.Context, manifest types.MCPServerCatalogEntryManifest) error
- func (v RemoteValidator) ValidateConfig(ctx context.Context, manifest types.MCPServerManifest) error
- func (v RemoteValidator) ValidateSystemConfig(ctx context.Context, manifest types.SystemMCPServerManifest) error
- type ResourceMaximumExceededError
- type ResourceMaximums
- type RuntimeValidator
- type RuntimeValidators
- type ServerConfig
- func CompositeServerToServerConfig(mcpServer v1.MCPServer, components []v1.MCPServer, ...) (ServerConfig, []string, error)
- func ServerToServerConfig(mcpServer v1.MCPServer, audiences []string, ...) (ServerConfig, []string, error)
- func SystemServerToServerConfig(systemServer v1.SystemMCPServer, audiences []string, userID string, ...) (ServerConfig, []string, error)
- type SessionManager
- func (sm *SessionManager) ClientForMCPServerForOAuthCheck(ctx context.Context, serverConfig ServerConfig, opt nmcp.ClientOption) (*Client, error)
- func (sm *SessionManager) Close()
- func (sm *SessionManager) CloseClient(server ServerConfig, clientScope string)
- func (sm *SessionManager) GenerateToolPreviews(ctx context.Context, tempMCPServer v1.MCPServer, serverConfig ServerConfig) ([]types.MCPServerTool, error)
- func (sm *SessionManager) GetCapacityInfo(ctx context.Context) (types.MCPCapacityInfo, error)
- func (sm *SessionManager) GetPrompt(ctx context.Context, serverConfig ServerConfig, name string, ...) ([]mcp.PromptMessage, string, error)
- func (sm *SessionManager) GetServerDetails(ctx context.Context, serverConfig ServerConfig) (types.MCPServerDetails, error)
- func (sm *SessionManager) HTTPClientForServer(server ServerConfig, timeout time.Duration) (*http.Client, error)
- func (sm *SessionManager) IDAndAudienceFromConnectURL(ctx context.Context, id, userID string) (string, string, error)
- func (sm *SessionManager) KubernetesResourceMaximums() ResourceMaximums
- func (sm *SessionManager) LaunchServer(ctx context.Context, serverConfig ServerConfig) (ServerConfig, error)
- func (sm *SessionManager) ListPrompts(ctx context.Context, serverConfig ServerConfig) ([]mcp.Prompt, error)
- func (sm *SessionManager) ListResources(ctx context.Context, serverConfig ServerConfig) ([]mcp.Resource, error)
- func (sm *SessionManager) ListTools(ctx context.Context, serverConfig ServerConfig) ([]mcp.Tool, error)
- func (sm *SessionManager) MCPRuntimeBackend() string
- func (sm *SessionManager) PingServer(ctx context.Context, serverConfig ServerConfig) (*nmcp.PingResult, error)
- func (sm *SessionManager) ReadResource(ctx context.Context, serverConfig ServerConfig, uri string) ([]mcp.ResourceContent, error)
- func (sm *SessionManager) RemoteConfigForBackend() (RemoteMCPURLValidationConfig, []string)
- func (sm *SessionManager) RemoteMCPURLValidationConfig() RemoteMCPURLValidationConfig
- func (sm *SessionManager) ResourceMaximums() ResourceMaximums
- func (sm *SessionManager) RestartServerDeployment(ctx context.Context, server ServerConfig) error
- func (sm *SessionManager) ServerCapabilities(ctx context.Context, serverConfig ServerConfig) (nmcp.ServerCapabilities, error)
- func (sm *SessionManager) ServerForAction(ctx context.Context, id, userID string) (v1.MCPServer, ServerConfig, error)
- func (sm *SessionManager) ServerForActionWithConnectID(ctx context.Context, id, userID string) (string, v1.MCPServer, ServerConfig, error)
- func (sm *SessionManager) ServerForActionWithConnectIDAllowMissingConfig(ctx context.Context, id, userID string) (string, v1.MCPServer, ServerConfig, []string, error)
- func (sm *SessionManager) ShutdownIdleServer(ctx context.Context, serverName string) error
- func (sm *SessionManager) ShutdownServer(ctx context.Context, serverName string) error
- func (sm *SessionManager) StreamServerLogs(ctx context.Context, serverConfig ServerConfig) (io.ReadCloser, error)
- func (sm *SessionManager) TransformObotHostname(hostname string) string
- type UVXValidator
- func (v UVXValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
- func (v UVXValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
- func (v UVXValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
- type ValidationOptions
- type Webhook
- type WebhookHelper
Constants ¶
const ( // MaxMCPServerStartupTimeout is the maximum value allowed to be used in ServerConfig.StartupTimeout MaxMCPServerStartupTimeout = 10 * time.Minute // AuditLogIgnore is a metadata field that tells the audit log persistence layer to ignore audit logs for this server AuditLogIgnore = "obot.mcp.ignoreAuditLog" )
const (
RuntimeBackendKubernetes = "kubernetes"
)
Variables ¶
var ( ErrHealthCheckTimeout = errors.New("timed out waiting for MCP server to be ready") ErrHealthCheckFailed = errors.New("MCP server is not healthy") ErrPodCrashLoopBackOff = errors.New("pod is in CrashLoopBackOff state") ErrImagePullFailed = errors.New("failed to pull container image") ErrPodSchedulingFailed = errors.New("pod could not be scheduled") ErrPodConfigurationFailed = errors.New("pod configuration is invalid") ErrInsufficientCapacity = errors.New("insufficient cluster capacity to deploy MCP server") )
var ErrServerNotRunning = errors.New("mcp server is not running")
ErrServerNotRunning is returned when an MCP server is not running
var ValidPSALevels = []string{"privileged", "baseline", "restricted"}
ValidPSALevels contains all valid Pod Security Admission levels
Functions ¶
func ApplyToolOverrides ¶ added in v0.15.0
func ApplyToolOverrides(tools []otypes.MCPServerTool, toolOverrides []otypes.ToolOverride, toolPrefix string) []otypes.MCPServerTool
ApplyToolOverrides applies ToolOverrides to a component's tool array, filtering out disabled tools and applying name/description overrides. If overrides are present, they act as an allowlist - only tools explicitly listed are included. toolPrefix, if non-empty, is prepended to every returned tool's Name so previews match what the composite server will expose via nanobot at runtime.
func ComputeK8sSettingsHash ¶ added in v0.13.0
func ComputeK8sSettingsHash(settings v1.K8sSettingsSpec, serverSpecificResources *corev1.ResourceRequirements, serverRuntime types.Runtime, nanobotAgentServer bool, maximums ResourceMaximums, imagePullSecretNames []string) string
ComputeK8sSettingsHash computes the hash used to decide whether an MCP Deployment needs to be updated. The API/status field is still named K8sSettingsHash, but managed image pull secret names are part of the same v1 drift path.
func ConvertTools ¶ added in v0.9.0
func CoreResourceRequirements ¶ added in v0.22.0
func CoreResourceRequirements(resources *types.MCPResourceRequirements) (*corev1.ResourceRequirements, error)
func CurrentImagePullSecretNames ¶ added in v0.22.0
func CurrentImagePullSecretNames(ctx context.Context, client kclient.Client, mcpRuntimeBackend string, staticPullSecrets []string) ([]string, error)
CurrentImagePullSecretNames returns the effective image pull secret names for MCP Deployments. Static startup configuration takes precedence over managed ImagePullSecret resources.
func EffectiveDefaultMCPResourceRequirements ¶ added in v0.23.0
func EffectiveDefaultMCPResourceRequirements(k8sSettings v1.K8sSettingsSpec) corev1.ResourceRequirements
func EffectiveDefaultMCPResourceRequirementsWithMaximums ¶ added in v0.24.0
func EffectiveDefaultMCPResourceRequirementsWithMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) corev1.ResourceRequirements
func IsKubernetesBackend ¶ added in v0.22.0
func ListAllowedSecretBindingTargets ¶ added in v0.24.0
func ListAllowedSecretBindingTargets(ctx context.Context, c kclient.Client, obotNamespace, allowedLabel string) ([]types.MCPAllowedSecretBindingTarget, error)
ListAllowedSecretBindingTargets returns labeled Kubernetes Secrets and data keys that admins may select for MCP secret bindings.
func MergeBoundCreds ¶ added in v0.22.0
func MergeBoundCreds( ctx context.Context, c kclient.Client, obotNamespace string, envs []types.MCPEnv, remoteConfig *types.RemoteRuntimeConfig, credEnv map[string]string, allowedLabel string, ) (map[string]string, error)
MergeBoundCreds resolves every secretBinding referenced by envs and (for remote runtime) remoteConfig.Headers from the obot namespace and returns a NEW map containing credEnv merged with the resolved values:
- env bindings → out[env.Key] = <secret value>
- header bindings → out[header.Key] = <secret value>
Pass `manifest.Env, manifest.RemoteConfig` from any of MCPServerManifest, SystemMCPServerManifest, or a synthesized shape — they share the same MCPEnv / RemoteRuntimeConfig field types.
Bound values overwrite any pre-existing credEnv entry for the same key. The validator rejects the bound-and-literal combination at write-time, so collisions only happen via a misbehaving caller; we drop the stale credEnv value defensively.
IMPORTANT: This function never mutates the caller's credEnv. The caller's credEnv reflects only user-supplied credential-store values and is safe to return to API reveal endpoints. The returned merged map carries bound secret VALUES and MUST NOT be returned to API callers — pass it to ServerToServerConfig / ConvertMCPServer only.
If there are no secretBindings, MergeBoundCreds returns credEnv unchanged (no allocation). If c is nil (docker backend), bindings cannot be resolved and the returned map omits them — the downstream missing-required gate then fires for required bindings.
Secrets must have the configured secret-binding allow label. A Secret without that label is treated as unavailable, the same as a missing Secret/key.
Lookups are cached per-call by Secret name so a manifest with N bindings against the same Secret performs one Get. Reads hit nah's watch cache, so calling this from API request paths is cheap.
func OTELEnv ¶ added in v0.24.0
OTELEnv returns OTEL environment variables to inject into Nanobot containers. It copies all OTEL_* variables from the current process, optionally rewriting OTLP endpoint URLs for the target runtime, and sets the service name so spans are distinguishable.
func ServerNanobotConfig ¶ added in v0.24.0
func ServerNanobotConfig(server ServerConfig, isComposite bool) ntypes.Config
func SourceIDForURL ¶ added in v0.24.0
func ValidateCatalogEntryForRoute ¶ added in v0.24.0
func ValidateCatalogEntryForRoute(manifest types.MCPServerCatalogEntryManifest, catalogID, workspaceID string) error
ValidateCatalogEntryForRoute checks that a catalog entry is compatible with the route used to create a server. catalogID and workspaceID come from the URL path.
func ValidateCatalogEntryManifest ¶ added in v0.24.0
func ValidateCatalogEntryManifest(ctx context.Context, manifest types.MCPServerCatalogEntryManifest, gitManaged bool, options ValidationOptions) error
func ValidateConfiguredK8sSettingsResourceMaximums ¶ added in v0.24.0
func ValidateConfiguredK8sSettingsResourceMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) error
func ValidateK8sSettingsResourceMaximums ¶ added in v0.24.0
func ValidateK8sSettingsResourceMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) error
func ValidatePSALevel ¶ added in v0.17.0
ValidatePSALevel checks if a PSA level value is valid
func ValidateRemoteMCPURL ¶ added in v0.23.0
func ValidateRemoteMCPURL(ctx context.Context, rawURL string, config RemoteMCPURLValidationConfig) error
ValidateRemoteMCPURL rejects remote MCP URLs that resolve to blocked local address ranges.
func ValidateSecretBindings ¶ added in v0.24.0
func ValidateSecretBindings(manifest types.MCPServerManifest, gitManaged, adminManaged bool, mcpBackend string) error
ValidateSecretBindings enforces the rules for secretBinding references on env vars and headers. Bindings may appear on git-managed catalog entries, multi-user catalog entries, or admin-managed multi-user servers. They require the kubernetes MCP runtime backend, are mutually exclusive with a static value, require non-empty name/key, and are rejected in unsupported combinations (env bindings under remote runtime).
func ValidateSecretBindingsAvailable ¶ added in v0.24.0
func ValidateSecretBindingsAvailable(ctx context.Context, c kclient.Client, obotNamespace string, envs []types.MCPEnv, remoteConfig *types.RemoteRuntimeConfig, allowedLabel string) error
ValidateSecretBindingsAvailable verifies secret-bound config can be resolved before creating/updating/launching a server that users cannot fix.
func ValidateSecretBindingsCatalogEntry ¶ added in v0.24.0
func ValidateSecretBindingsCatalogEntry(manifest types.MCPServerCatalogEntryManifest, gitManaged, userIsAdmin bool, mcpBackend string) error
ValidateSecretBindingsCatalogEntry is a thin wrapper around ValidateSecretBindings that adapts a catalog-entry manifest (which does not carry the runtime/env shape of MCPServerManifest directly) by extracting the fields that matter for binding validation. The catalog-entry manifest uses the same MCPEnv/MCPHeader types, so we reuse the core logic.
func ValidateServerManifest ¶ added in v0.24.0
func ValidateServerManifest(ctx context.Context, manifest types.MCPServerManifest, isMultiUser bool, options ValidationOptions) error
func ValidateSystemMCPServerCatalogEntryManifest ¶ added in v0.24.0
func ValidateSystemMCPServerCatalogEntryManifest(ctx context.Context, manifest types.SystemMCPServerCatalogEntryManifest, options ValidationOptions) error
func ValidateSystemMCPServerManifest ¶ added in v0.24.0
func ValidateSystemMCPServerManifest(ctx context.Context, manifest types.SystemMCPServerManifest, options ValidationOptions) error
func ValidateTemplateReferences ¶ added in v0.24.0
func ValidateTemplateReferences(manifest types.MCPServerManifest) error
ValidateTemplateReferences enforces that any ${VAR} reference inside a server manifest's command/args/URL fields points to an env entry with Required=true. Undeclared references are tolerated here because addExtractedEnvVars in the server-create path auto-stamps a Required=true entry for them; this validator catches the case where the user pre-supplied the same key with Required=false, which today produces a literal "${VAR}" string at runtime instead of a substituted value.
func ValidateTemplateReferencesCatalogEntry ¶ added in v0.24.0
func ValidateTemplateReferencesCatalogEntry(manifest types.MCPServerCatalogEntryManifest) error
ValidateTemplateReferencesCatalogEntry is the catalog-entry counterpart. Catalog entries don't get the auto-extraction fixup, so undeclared ${VAR} references are an error.
Types ¶
type ComponentServer ¶ added in v0.15.0
type ComponentServer struct {
Name string `json:"name"`
URL string `json:"url"`
Tools []types.ToolOverride `json:"tools"`
ToolPrefix string `json:"toolPrefix"`
// contains filtered or unexported fields
}
type CompositeValidator ¶ added in v0.24.0
type CompositeValidator struct{}
CompositeValidator implements RuntimeValidator for composite runtime
func (CompositeValidator) ValidateCatalogConfig ¶ added in v0.24.0
func (v CompositeValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
func (CompositeValidator) ValidateConfig ¶ added in v0.24.0
func (v CompositeValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
func (CompositeValidator) ValidateSystemConfig ¶ added in v0.24.0
func (v CompositeValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
type Config ¶
type Config struct {
MCPServers map[string]ServerConfig `json:"mcpServers"`
}
type ContainerizedValidator ¶ added in v0.24.0
type ContainerizedValidator struct{}
ContainerizedValidator implements RuntimeValidator for containerized runtime
func (ContainerizedValidator) ValidateCatalogConfig ¶ added in v0.24.0
func (v ContainerizedValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
func (ContainerizedValidator) ValidateConfig ¶ added in v0.24.0
func (v ContainerizedValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
func (ContainerizedValidator) ValidateSystemConfig ¶ added in v0.24.0
func (v ContainerizedValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
type ErrNotSupportedByBackend ¶ added in v0.9.0
type ErrNotSupportedByBackend struct {
Feature, Backend string
}
func (*ErrNotSupportedByBackend) Error ¶ added in v0.9.0
func (e *ErrNotSupportedByBackend) Error() string
type GlobalTokenStore ¶
type GlobalTokenStore interface {
ForUserAndMCP(userID, mcpID string) nmcp.TokenStorage
}
type MissingSecretBinding ¶ added in v0.24.0
type MissingSecretBinding struct {
Kind string
Header types.MCPHeader
Binding *types.MCPSecretBinding
}
func MissingSecretBindings ¶ added in v0.24.0
type NPXValidator ¶ added in v0.24.0
type NPXValidator struct{}
NPXValidator implements RuntimeValidator for NPX runtime
func (NPXValidator) ValidateCatalogConfig ¶ added in v0.24.0
func (v NPXValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
func (NPXValidator) ValidateConfig ¶ added in v0.24.0
func (v NPXValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
func (NPXValidator) ValidateSystemConfig ¶ added in v0.24.0
func (v NPXValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
type Options ¶
type Options struct {
MCPBaseImage string `usage:"The base image to use for MCP containers" default:"ghcr.io/obot-platform/mcp-images/stdio-wrapper:v0.24.2"`
MCPHTTPWebhookBaseImage string `` /* 145-byte string literal not displayed */
MCPNamespace string `usage:"The namespace to use for MCP containers" default:"obot-mcp"`
MCPClusterDomain string `usage:"The cluster domain to use for MCP containers" default:"cluster.local"`
DisallowLocalhostMCP bool `usage:"Disallow MCP containers from connecting to localhost" default:"true"`
DisallowPrivateIPMCP bool `usage:"Disallow MCP containers from connecting to private IPs" default:"true"`
DisallowLinkLocalMCP bool `usage:"Disallow MCP containers from connecting to link-local addresses" default:"true"`
MCPRuntimeBackend string `usage:"The runtime backend to use for running MCP servers: docker, kubernetes, or k8s. Defaults to docker" default:"docker"`
MCPSecretBindingAllowedLabel string `` /* 148-byte string literal not displayed */
MCPImagePullSecrets []string `usage:"The name of the image pull secret to use for pulling MCP images"`
SingleUserIdleServerShutdownHours int `` /* 150-byte string literal not displayed */
MultiUserIdleServerShutdownHours int `usage:"The interval in hours to check for idle multi-user MCP servers and shut them down, set to -1 to disable" default:"168"`
IdleAgentShutdownHours int `usage:"The interval in hours to check for idle agents and shut them down, set to -1 to disable" default:"72"`
// Kubernetes settings from Helm
MCPK8sSettingsAffinity string `usage:"Affinity rules for MCP server pods (JSON)"`
MCPK8sSettingsTolerations string `usage:"Tolerations for MCP server pods (JSON)"`
MCPK8sSettingsResources string `usage:"Resource requests/limits for MCP server pods (JSON)"`
MCPK8sSettingsNanobotAgentResources string `usage:"Resource requests/limits for NanobotAgent pods (JSON)"`
MCPK8sSettingsRuntimeClassName string `usage:"RuntimeClass name for MCP server pods (e.g., gvisor, kata)"`
MCPK8sSettingsStorageClassName string `usage:"StorageClass name for nanobot workspace volumes"`
MCPK8sSettingsNanobotWorkspaceSize string `usage:"Nanobot workspace size for MCP server pods (e.g., 1Gi)"`
MCPK8sMaxCPURequest string `usage:"Maximum CPU request allowed for normal MCP server pods"`
MCPK8sMaxCPULimit string `usage:"Maximum CPU limit allowed for normal MCP server pods"`
MCPK8sMaxMemoryRequest string `usage:"Maximum memory request allowed for normal MCP server pods"`
MCPK8sMaxMemoryLimit string `usage:"Maximum memory limit allowed for normal MCP server pods"`
// Obot service configuration for constructing internal service FQDN
ServiceName string `usage:"The Kubernetes service name for the obot server"`
ServiceNamespace string `usage:"The Kubernetes namespace where the obot server runs"`
// Auto-populated by the Helm chart - used for network policy provider deployment
ServiceAccountName string `usage:"The Kubernetes service account name for the obot server"`
// Audit log configuration
MCPAuditLogPersistIntervalSeconds int `usage:"The interval in seconds to persist MCP audit logs to the database" default:"5"`
MCPAuditLogsPersistBatchSize int `usage:"The number of MCP audit logs to persist in a single batch" default:"1000"`
MCPAuditLogRetentionDays int `usage:"The number of days to retain MCP audit logs (0 to disable cleanup)" default:"90"`
// Pod Security Admission configuration for MCP namespace
MCPPodSecurityEnabled bool `usage:"Enable Pod Security Admission labels on the MCP namespace" default:"true"`
MCPPodSecurityEnforce string `usage:"Pod Security Standards level to enforce (privileged, baseline, or restricted)" default:"restricted"`
MCPPodSecurityEnforceVersion string `usage:"Kubernetes version for the enforce policy" default:"latest"`
MCPPodSecurityAudit string `usage:"Pod Security Standards level to audit (privileged, baseline, or restricted)" default:"restricted"`
MCPPodSecurityAuditVersion string `usage:"Kubernetes version for the audit policy" default:"latest"`
MCPPodSecurityWarn string `usage:"Pod Security Standards level to warn about (privileged, baseline, or restricted)" default:"restricted"`
MCPPodSecurityWarnVersion string `usage:"Kubernetes version for the warn policy" default:"latest"`
}
type PSAEnforceLevel ¶ added in v0.17.0
type PSAEnforceLevel string
PSAEnforceLevel represents the Pod Security Admission enforce level
const ( // PSAPrivileged allows all pod configurations (no restrictions) PSAPrivileged PSAEnforceLevel = "privileged" // PSABaseline provides minimal restrictions that prevent known privilege escalations PSABaseline PSAEnforceLevel = "baseline" // PSARestricted heavily restricts pod configurations following security best practices PSARestricted PSAEnforceLevel = "restricted" )
func GetPSAEnforceLevelFromSpec ¶ added in v0.17.0
func GetPSAEnforceLevelFromSpec(settings v1.K8sSettingsSpec) PSAEnforceLevel
GetPSAEnforceLevelFromSpec extracts the PSA enforce level from K8sSettingsSpec
type RemoteMCPURLValidationConfig ¶ added in v0.23.0
type RemoteValidator ¶ added in v0.24.0
type RemoteValidator struct {
AllowMissingURL bool
RemoteMCPURLValidationConfig RemoteMCPURLValidationConfig
}
RemoteValidator implements RuntimeValidator for remote runtime
func (RemoteValidator) ValidateCatalogConfig ¶ added in v0.24.0
func (v RemoteValidator) ValidateCatalogConfig(ctx context.Context, manifest types.MCPServerCatalogEntryManifest) error
func (RemoteValidator) ValidateConfig ¶ added in v0.24.0
func (v RemoteValidator) ValidateConfig(ctx context.Context, manifest types.MCPServerManifest) error
func (RemoteValidator) ValidateSystemConfig ¶ added in v0.24.0
func (v RemoteValidator) ValidateSystemConfig(ctx context.Context, manifest types.SystemMCPServerManifest) error
type ResourceMaximumExceededError ¶ added in v0.24.0
type ResourceMaximumExceededError struct {
Field string
Actual resource.Quantity
Maximum resource.Quantity
}
func (*ResourceMaximumExceededError) Error ¶ added in v0.24.0
func (e *ResourceMaximumExceededError) Error() string
type ResourceMaximums ¶ added in v0.24.0
type ResourceMaximums struct {
CPURequest *resource.Quantity
CPULimit *resource.Quantity
MemoryRequest *resource.Quantity
MemoryLimit *resource.Quantity
}
func ParseResourceMaximums ¶ added in v0.24.0
func ParseResourceMaximums(opts Options) (ResourceMaximums, error)
func (ResourceMaximums) Empty ¶ added in v0.24.0
func (m ResourceMaximums) Empty() bool
func (ResourceMaximums) Validate ¶ added in v0.24.0
func (m ResourceMaximums) Validate(resources corev1.ResourceRequirements) error
type RuntimeValidator ¶ added in v0.24.0
type RuntimeValidator interface {
ValidateConfig(ctx context.Context, manifest types.MCPServerManifest) error
ValidateCatalogConfig(ctx context.Context, manifest types.MCPServerCatalogEntryManifest) error
ValidateSystemConfig(ctx context.Context, manifest types.SystemMCPServerManifest) error
}
RuntimeValidator defines the interface for validating runtime-specific configurations
type RuntimeValidators ¶ added in v0.24.0
type RuntimeValidators map[types.Runtime]RuntimeValidator
RuntimeValidators is a map type for storing validators by runtime type
type ServerConfig ¶
type ServerConfig struct {
Runtime types.Runtime `json:"runtime"`
// uvx/npx based configuration.
Command string `json:"command"`
Args []string `json:"args"`
Env []string `json:"env"`
Files []File `json:"files"`
// Remote configuration.
URL string `json:"url"`
TunnelName string `json:"tunnelName,omitempty"`
Headers []string `json:"headers"`
PassthroughHeaderNames []string `json:"passthroughHeaderNames"`
PassthroughHeaderValues []string `json:"passthroughHeaderValues"`
// Containerized configuration.
ContainerImage string `json:"containerImage"`
ContainerPort int `json:"containerPort"`
ContainerPath string `json:"containerPath"`
HealthzPath string `json:"healthzPath,omitempty"`
// Composite configuration.
Components []ComponentServer `json:"components"`
Scope string `json:"scope"`
UserID string `json:"userID"`
OwnerUserID string `json:"ownerUserID"`
MCPServerNamespace string `json:"mcpServerNamespace"`
MCPServerName string `json:"mcpServerName"`
MCPCatalogName string `json:"mcpCatalogName"`
MCPCatalogEntryName string `json:"mcpCatalogEntryName"`
MCPServerDisplayName string `json:"mcpServerDisplayName"`
NanobotAgentName string `json:"nanobotAgentName"`
ComponentMCPServer bool `json:"componentMCPServer"`
SystemMCPServer bool `json:"systemMCPServer"`
Audiences []string `json:"audiences"`
TokenExchangeClientID string `json:"tokenExchangeClientID"`
TokenExchangeClientSecret string `json:"tokenExchangeClientSecret"`
AuditLogMetadata map[string]string `json:"auditLogMetadata"`
StartupTimeout time.Duration `json:"startupTimeout,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
Webhooks []Webhook `json:"webhooks,omitempty"`
}
func CompositeServerToServerConfig ¶ added in v0.15.0
func ServerToServerConfig ¶
func SystemServerToServerConfig ¶ added in v0.15.0
func SystemServerToServerConfig(systemServer v1.SystemMCPServer, audiences []string, userID string, credEnv, secretsCred map[string]string) (ServerConfig, []string, error)
SystemServerToServerConfig converts a v1.SystemMCPServer to a ServerConfig for deployment
func (ServerConfig) IsNanobotAgentServer ¶ added in v0.24.0
func (s ServerConfig) IsNanobotAgentServer() bool
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
func NewSessionManager ¶
func NewSessionManager(ctx context.Context, authEnabled bool, globalTokenStore GlobalTokenStore, tokenService *persistent.TokenService, baseURL string, httpListenPort int, opts Options, webhookHelper *WebhookHelper, localK8sConfig *rest.Config, client, cachedClient, obotStorageClient kclient.WithWatch, gatewayClient *gateway.Client, obotNamespace string, tunnelManager *tunnel.Manager) (*SessionManager, error)
func (*SessionManager) ClientForMCPServerForOAuthCheck ¶ added in v0.15.0
func (sm *SessionManager) ClientForMCPServerForOAuthCheck(ctx context.Context, serverConfig ServerConfig, opt nmcp.ClientOption) (*Client, error)
func (*SessionManager) Close ¶
func (sm *SessionManager) Close()
Close does nothing with the deployments and services. It just closes the local session.
func (*SessionManager) CloseClient ¶
func (sm *SessionManager) CloseClient(server ServerConfig, clientScope string)
CloseClient will close the client for this MCP server, but leave the deployment running.
func (*SessionManager) GenerateToolPreviews ¶ added in v0.9.0
func (sm *SessionManager) GenerateToolPreviews(ctx context.Context, tempMCPServer v1.MCPServer, serverConfig ServerConfig) ([]types.MCPServerTool, error)
GenerateToolPreviews creates a temporary MCP server from a catalog entry, lists its tools, then shuts it down and returns the tool preview data.
func (*SessionManager) GetCapacityInfo ¶ added in v0.16.0
func (sm *SessionManager) GetCapacityInfo(ctx context.Context) (types.MCPCapacityInfo, error)
GetCapacityInfo returns capacity information for the MCP namespace. Only available when using the Kubernetes backend.
func (*SessionManager) GetPrompt ¶
func (sm *SessionManager) GetPrompt(ctx context.Context, serverConfig ServerConfig, name string, args map[string]string) ([]mcp.PromptMessage, string, error)
func (*SessionManager) GetServerDetails ¶
func (sm *SessionManager) GetServerDetails(ctx context.Context, serverConfig ServerConfig) (types.MCPServerDetails, error)
GetServerDetails will get the details of a specific MCP server based on its configuration, if the backend supports it. If the backend does not support the operation, it will return an ErrNotSupportedByBackend error.
func (*SessionManager) HTTPClientForServer ¶ added in v0.25.0
func (sm *SessionManager) HTTPClientForServer(server ServerConfig, timeout time.Duration) (*http.Client, error)
HTTPClientForServer returns an HTTP client that follows the server's configured network path, including its tunnel when present.
func (*SessionManager) IDAndAudienceFromConnectURL ¶ added in v0.24.0
func (sm *SessionManager) IDAndAudienceFromConnectURL(ctx context.Context, id, userID string) (string, string, error)
IDAndAudienceFromConnectURL returns the MCP server or instance name and audience based on the provided connect URL. The connect URL could have an MCP server ID, server instance ID, or MCP catalog entry ID.
func (*SessionManager) KubernetesResourceMaximums ¶ added in v0.24.0
func (sm *SessionManager) KubernetesResourceMaximums() ResourceMaximums
func (*SessionManager) LaunchServer ¶ added in v0.15.0
func (sm *SessionManager) LaunchServer(ctx context.Context, serverConfig ServerConfig) (ServerConfig, error)
LaunchServer will ensure that the server is deployed
func (*SessionManager) ListPrompts ¶
func (sm *SessionManager) ListPrompts(ctx context.Context, serverConfig ServerConfig) ([]mcp.Prompt, error)
func (*SessionManager) ListResources ¶
func (sm *SessionManager) ListResources(ctx context.Context, serverConfig ServerConfig) ([]mcp.Resource, error)
func (*SessionManager) ListTools ¶
func (sm *SessionManager) ListTools(ctx context.Context, serverConfig ServerConfig) ([]mcp.Tool, error)
func (*SessionManager) MCPRuntimeBackend ¶ added in v0.22.0
func (sm *SessionManager) MCPRuntimeBackend() string
func (*SessionManager) PingServer ¶
func (sm *SessionManager) PingServer(ctx context.Context, serverConfig ServerConfig) (*nmcp.PingResult, error)
func (*SessionManager) ReadResource ¶
func (sm *SessionManager) ReadResource(ctx context.Context, serverConfig ServerConfig, uri string) ([]mcp.ResourceContent, error)
func (*SessionManager) RemoteConfigForBackend ¶ added in v0.24.0
func (sm *SessionManager) RemoteConfigForBackend() (RemoteMCPURLValidationConfig, []string)
func (*SessionManager) RemoteMCPURLValidationConfig ¶ added in v0.23.0
func (sm *SessionManager) RemoteMCPURLValidationConfig() RemoteMCPURLValidationConfig
func (*SessionManager) ResourceMaximums ¶ added in v0.24.0
func (sm *SessionManager) ResourceMaximums() ResourceMaximums
func (*SessionManager) RestartServerDeployment ¶ added in v0.9.0
func (sm *SessionManager) RestartServerDeployment(ctx context.Context, server ServerConfig) error
RestartServerDeployment restarts the server in the currently used backend, if the backend supports it. If the backend does not support restarts, then an ErrNotSupportedByBackend error is returned.
func (*SessionManager) ServerCapabilities ¶
func (sm *SessionManager) ServerCapabilities(ctx context.Context, serverConfig ServerConfig) (nmcp.ServerCapabilities, error)
func (*SessionManager) ServerForAction ¶ added in v0.24.0
func (sm *SessionManager) ServerForAction(ctx context.Context, id, userID string) (v1.MCPServer, ServerConfig, error)
func (*SessionManager) ServerForActionWithConnectID ¶ added in v0.24.0
func (sm *SessionManager) ServerForActionWithConnectID(ctx context.Context, id, userID string) (string, v1.MCPServer, ServerConfig, error)
func (*SessionManager) ServerForActionWithConnectIDAllowMissingConfig ¶ added in v0.24.0
func (sm *SessionManager) ServerForActionWithConnectIDAllowMissingConfig(ctx context.Context, id, userID string) (string, v1.MCPServer, ServerConfig, []string, error)
func (*SessionManager) ShutdownIdleServer ¶ added in v0.19.2
func (sm *SessionManager) ShutdownIdleServer(ctx context.Context, serverName string) error
ShutdownIdleServer will close the connections to the MCP server and remove all of the resources except for the volumes.
func (*SessionManager) ShutdownServer ¶
func (sm *SessionManager) ShutdownServer(ctx context.Context, serverName string) error
ShutdownServer will close the connections to the MCP server and remove all of the resources.
func (*SessionManager) StreamServerLogs ¶
func (sm *SessionManager) StreamServerLogs(ctx context.Context, serverConfig ServerConfig) (io.ReadCloser, error)
StreamServerLogs will stream the logs of a specific MCP server based on its configuration, if the backend supports it. If the backend does not support the operation, it will return an ErrNotSupportedByBackend error.
func (*SessionManager) TransformObotHostname ¶ added in v0.17.0
func (sm *SessionManager) TransformObotHostname(hostname string) string
type UVXValidator ¶ added in v0.24.0
type UVXValidator struct{}
UVXValidator implements RuntimeValidator for UVX runtime
func (UVXValidator) ValidateCatalogConfig ¶ added in v0.24.0
func (v UVXValidator) ValidateCatalogConfig(_ context.Context, manifest types.MCPServerCatalogEntryManifest) error
func (UVXValidator) ValidateConfig ¶ added in v0.24.0
func (v UVXValidator) ValidateConfig(_ context.Context, manifest types.MCPServerManifest) error
func (UVXValidator) ValidateSystemConfig ¶ added in v0.24.0
func (v UVXValidator) ValidateSystemConfig(_ context.Context, manifest types.SystemMCPServerManifest) error
type ValidationOptions ¶ added in v0.24.0
type ValidationOptions struct {
AllowMissingURL bool
RemoteMCPURLValidationConfig RemoteMCPURLValidationConfig
ResourceMaximums ResourceMaximums
}
Options configures runtime validation behavior.
type WebhookHelper ¶
type WebhookHelper struct {
// contains filtered or unexported fields
}
func NewWebhookHelper ¶
func NewWebhookHelper(indexer cache.Indexer, baseURL string) *WebhookHelper
func (*WebhookHelper) GetWebhooksForMCPServer ¶
func (wh *WebhookHelper) GetWebhooksForMCPServer(serverConfig ServerConfig) ([]Webhook, error)