mcp

package
v0.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 84 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	DefaultLocalhostCallbackPath = "/oauth/callback"
)
View Source
const (
	// HookMutationsMetaKey identifies hook mutation metadata in MCP results.
	HookMutationsMetaKey = "ai.obot.hooks/mutations"
)
View Source
const (
	RuntimeBackendKubernetes = "kubernetes"
)

Variables

View Source
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")
)
View Source
var (
	ErrRPCUnknown = NewRPCError(-32001, "JSON RPC unknown error")
)
View Source
var (
	// ErrServerNotRunning is returned when an MCP server is not running
	ErrServerNotRunning = errors.New("mcp server is not running")
)
View Source
var (

	// ValidPSALevels contains all valid Pod Security Admission levels
	ValidPSALevels = []string{"privileged", "baseline", "restricted"}
)

Functions

func AuthCodeURL added in v0.26.0

func AuthCodeURL(conf *oauth2.Config, urlFromMetadata, resourceURL, state, verifier string) (string, error)

AuthCodeURL returns the authorization code URL for the given configuration and resource URL.

func ComputeK8sSettingsHash added in v0.13.0

func ComputeK8sSettingsHash(
	settings v1.K8sSettingsSpec,
	serverSpecificResources *corev1.ResourceRequirements,
	serverRuntime types.Runtime,
	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 ConfigurationOptionValueValid added in v0.26.0

func ConfigurationOptionValueValid(field types.MCPHeader, values map[string]string) bool

ConfigurationOptionValueValid reports whether a field's configured selection is allowed.

func ConvertTools added in v0.9.0

func ConvertTools(tools []*gomcp.Tool, unsupportedTools []string) ([]otypes.MCPServerTool, error)

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 ExchangeOAuthToken added in v0.26.0

func ExchangeOAuthToken(ctx context.Context, conf *oauth2.Config, code, verifier, resourceURL string) (*oauth2.Token, error)

ExchangeOAuthToken exchanges an OAuth authorization code for a token. The token endpoint is server-supplied, so the request goes through the HTTP client in ctx (see withOAuthHTTPClient) or, without one, through strictEgressClient.

func ExtractStaticConfiguration added in v0.26.2

func ExtractStaticConfiguration(config []types.MCPConfig, previous map[string]string, keepPrevious bool) (map[string]string, error)

ExtractStaticConfiguration removes literal values from config, marks those fields Static, and returns the values keyed by configuration key. A Static field without a value keeps its value from previous when keepPrevious is set; otherwise it is an error, because nothing else can supply it.

func GetOAuthAuthorizationURL added in v0.26.0

func GetOAuthAuthorizationURL(ctx context.Context, callbackHandler CallbackHandler, conf *oauth2.Config, authorizationEndpoint, resourceURL string) (string, <-chan CallbackPayload, string, error)

GetOAuthAuthorizationURL constructs the OAuth authorization URL and callback state for the authorization code flow.

func HasStaticConfiguration added in v0.26.2

func HasStaticConfiguration(config []types.MCPConfig) bool

HasStaticConfiguration reports whether any field's value is stored in a static configuration credential.

func IsKubernetesBackend added in v0.22.0

func IsKubernetesBackend(backend string) bool

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 MMMCPConfig added in v0.26.0

func MMMCPConfig(server ServerConfig, env map[string][]byte) *mmmcpconfig.Config

MMMCPConfig converts a server configuration into mmmcp's runtime configuration.

func MergeBoundCreds added in v0.22.0

func MergeBoundCreds(
	ctx context.Context,
	c kclient.Client,
	obotNamespace string,
	config []types.MCPConfig,
	credEnv map[string]string,
	allowedLabel string,
) (map[string]string, error)

MergeBoundCreds resolves every secretBinding referenced by config 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.Config from a server or catalog-entry manifest.

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 only.

If there are no secretBindings, MergeBoundCreds returns credEnv unchanged (no pool). 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. Pass the local router's cached client so reads hit its watch cache instead of the Kubernetes API server.

func MessageIDString added in v0.26.0

func MessageIDString(id any) string

func OAuthResourceURL added in v0.26.0

func OAuthResourceURL(authorizationEndpoint, resourceURL string) string

OAuthResourceURL returns the protected resource identifier when the authorization server supports the RFC 8707 resource parameter. Microsoft Entra rejects this parameter, so it must be omitted throughout the flow.

func OAuthTargetHash added in v0.28.0

func OAuthTargetHash(server v1.MCPServer, cfg ServerConfig) string

OAuthTargetHash binds a challenge to its current owner and upstream configuration without persisting configured secrets in the challenge or OAuth transaction.

func ParseOAuthResourceURL added in v0.26.0

func ParseOAuthResourceURL(metadata json.RawMessage) (string, error)

ParseOAuthResourceURL returns the resource identifier from protected-resource metadata.

func ReferencesSecret added in v0.27.0

func ReferencesSecret(config []types.MCPConfig, name string) bool

ReferencesSecret reports whether any config entry binds to the named Secret.

func RefreshSecretBindingStatus added in v0.27.0

func RefreshSecretBindingStatus(ctx context.Context, c kclient.Client, obotNamespace string, server *v1.MCPServer, allowedLabel string) error

RefreshSecretBindingStatus makes server's secret binding status describe its current bindings. When the controller has already checked them, the recorded status is kept and no Secret is read. Otherwise the bindings are resolved with c, which should be the local router's cached client. The change is not persisted.

func RequiresStaticOAuth added in v0.26.0

func RequiresStaticOAuth(server v1.MCPServer) bool

RequiresStaticOAuth reports whether a remote MCP server is configured to require static OAuth and has not yet been authenticated by the user.

func ResolveOAuthResourceURL added in v0.26.0

func ResolveOAuthResourceURL(authorizationEndpoint, discoveredResourceURL, connectionURL string) string

ResolveOAuthResourceURL prefers the discovered protected-resource identifier and falls back to the MCP connection URL before applying provider-specific handling.

func ResolveRemoteURLTemplate added in v0.26.0

func ResolveRemoteURLTemplate(manifest types.MCPServerManifest, configuration map[string]string) (string, []string)

ResolveRemoteURLTemplate expands a remote manifest's URL template using the supplied configuration alongside the manifest's own static values, the same way the runtime does when it builds a ServerConfig. It returns the names of every unresolved reference rather than a partially expanded URL.

func ResolveServerStaticConfiguration added in v0.26.2

func ResolveServerStaticConfiguration(ctx context.Context, revealer StaticConfigurationRevealer, server v1.MCPServer) (v1.MCPServer, error)

ResolveServerStaticConfiguration returns a copy of server whose manifest has the values of its Static configuration restored. The result is for building runtime configuration only and must never be persisted.

func ResolveStaticConfiguration added in v0.26.2

func ResolveStaticConfiguration(ctx context.Context, revealer StaticConfigurationRevealer, entryName, revision string, config []types.MCPConfig) ([]types.MCPConfig, error)

ResolveStaticConfiguration returns a copy of config with the values of Static fields restored from the entry's static configuration credential. The result is for building runtime configuration only and must never be persisted.

func RevealStaticConfiguration added in v0.26.2

func RevealStaticConfiguration(ctx context.Context, revealer StaticConfigurationRevealer, entryName, revision string) (map[string]string, error)

RevealStaticConfiguration returns the values of one revision of an entry's static configuration. A missing credential yields no values. Every revision Obot stores holds at least one value, so callers that need the values treat an empty result for a revision as unavailable.

func SecretBindingsCheckHash added in v0.27.0

func SecretBindingsCheckHash(config []types.MCPConfig, allowedLabel string) string

SecretBindingsCheckHash identifies the secret bindings in config and the allow label they are resolved with. It is empty when config has no bindings, so a server without bindings always matches its zero-value status.

func ServerHookConfig added in v0.26.0

func ServerHookConfig(server ServerConfig) (Hooks, HookServerConfigs)

ServerHookConfig returns hook mappings and the MCP server configurations used by the native hook runner. The target MCP server itself is intentionally absent: its traffic continues through the reverse proxy.

func SourceIDForURL added in v0.24.0

func SourceIDForURL(sourceURL string) string

func StaticConfigurationCredentialContext added in v0.26.2

func StaticConfigurationCredentialContext(entryName string) string

StaticConfigurationCredentialContext scopes static configuration to its catalog entry. Every revision of the entry's static configuration is stored in this context.

func StaticConfigurationCredentialName added in v0.26.2

func StaticConfigurationCredentialName(revision string) string

StaticConfigurationCredentialName names the credential holding one revision of static configuration.

func StaticConfigurationRevisionFromCredentialName added in v0.26.2

func StaticConfigurationRevisionFromCredentialName(name string) (string, bool)

StaticConfigurationRevisionFromCredentialName reverses StaticConfigurationCredentialName.

func StoreStaticConfiguration added in v0.26.2

func StoreStaticConfiguration(ctx context.Context, store StaticConfigurationStore, entryName string, manifest *types.MCPServerCatalogEntryManifest, previousRevision string) error

StoreStaticConfiguration moves the literal configuration values of an entry manifest into a credential and records the credential's revision on the manifest. Every Static field must have a value, because nothing else supplies one.

func StoreStaticConfigurationValues added in v0.26.2

func StoreStaticConfigurationValues(ctx context.Context, store StaticConfigurationStore, entryName string, values map[string]string, previousRevision string, previous map[string]string) (string, error)

StoreStaticConfigurationValues stores static configuration values for an entry and returns the revision that holds them. The previous revision is kept when its values are unchanged, so repeated synchronization does not change the entry. Changed values are written to a new revision, so servers and vMCP snapshots of the old manifest keep the values they were created with until they are updated.

func URLTemplateReferences added in v0.26.0

func URLTemplateReferences(urlTemplate string) []string

URLTemplateReferences returns the names referenced by ${VAR} patterns in a remote URL template, in order, without duplicates.

func UnresolvedSecretBindingKeys added in v0.27.0

func UnresolvedSecretBindingKeys(ctx context.Context, c kclient.Client, obotNamespace string, config []types.MCPConfig, allowedLabel string) ([]string, error)

UnresolvedSecretBindingKeys returns the keys of every config entry whose secretBinding does not resolve to a value, sorted. It never returns secret values.

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 ValidateConfiguredOptions added in v0.26.0

func ValidateConfiguredOptions(config []types.MCPConfig, values map[string]string) ([]string, error)

ValidateConfiguredOptions returns missing required selections and rejects values outside catalog-owned options. It does not return an error when returning missing configs.

func ValidateK8sSettingsResourceMaximums added in v0.24.0

func ValidateK8sSettingsResourceMaximums(k8sSettings v1.K8sSettingsSpec, maximums ResourceMaximums) error

func ValidateLocalhostCallbackPath added in v0.27.0

func ValidateLocalhostCallbackPath(value string) error

ValidateLocalhostCallbackPath keeps the provider callback separate from the CLI's completion callback and from URL query/authority components. /oauth/obot/callback is reserved for Obot to signal completion to the CLI after exchanging the provider code; using it for both steps would loop the relay.

func ValidateObotVersionRange added in v0.27.0

func ValidateObotVersionRange(minVersion, maxVersion string, catalogSynced bool) error

ValidateObotVersionRange validates minObotVersion and maxObotVersion. They are only enforced during catalog sync, so they are rejected on entries that are not synced from a catalog source.

func ValidatePSALevel added in v0.17.0

func ValidatePSALevel(level string) bool

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 ValidateSecretBindingsCatalogEntry added in v0.24.0

func ValidateSecretBindingsCatalogEntry(manifest types.MCPServerCatalogEntryManifest, gitManaged, userIsAdmin bool, mcpBackend string) error

ValidateSecretBindingsCatalogEntry validates binding ownership and the catalog-specific restrictions on secret-bound URL template inputs.

func ValidateSecretBindingsVMCP added in v0.26.2

func ValidateSecretBindingsVMCP(manifest types.VMCPManifest, mcpBackend string) error

ValidateSecretBindingsVMCP validates the Secrets selected by vMCP fixed configuration against the component runtimes they are applied to.

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 ValidateTemplateReferencesCatalogEntry added in v0.24.0

func ValidateTemplateReferencesCatalogEntry(manifest types.MCPServerCatalogEntryManifest) error

ValidateTemplateReferencesCatalogEntry enforces that any ${VAR} reference inside a catalog entry manifest's command/args/URL fields points to a declared env entry with Required=true.

Types

type AuthURLHandler added in v0.26.0

type AuthURLHandler interface {
	HandleAuthURL(context.Context, string, string) (bool, error)
}

type AuthorizationServerMetadata added in v0.26.0

type AuthorizationServerMetadata struct {
	// REQUIRED. The authorization server's issuer identifier
	Issuer string `json:"issuer"`

	// URL of the authorization server's authorization endpoint
	AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`

	// URL of the authorization server's token endpoint
	TokenEndpoint string `json:"token_endpoint,omitempty"`

	// OPTIONAL. URL of the authorization server's JWK Set document
	JwksURI string `json:"jwks_uri,omitempty"`

	// OPTIONAL. URL of the authorization server's OAuth 2.0 Dynamic Client Registration endpoint
	RegistrationEndpoint string `json:"registration_endpoint,omitempty"`

	// RECOMMENDED. JSON array containing a list of the OAuth 2.0 scope values
	ScopesSupported []string `json:"scopes_supported,omitempty"`

	// REQUIRED. JSON array containing a list of the OAuth 2.0 response_type values
	ResponseTypesSupported []string `json:"response_types_supported"`

	// OPTIONAL. JSON array containing a list of the OAuth 2.0 response_mode values
	ResponseModesSupported []string `json:"response_modes_supported,omitempty"`

	// OPTIONAL. JSON array containing a list of the OAuth 2.0 grant type values
	GrantTypesSupported []string `json:"grant_types_supported,omitempty"`

	// OPTIONAL. JSON array containing a list of client authentication methods
	TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported,omitempty"`

	// OPTIONAL. JSON array containing a list of the JWS signing algorithms
	TokenEndpointAuthSigningAlgValuesSupported []string `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`

	// OPTIONAL. URL of a page containing human-readable information
	ServiceDocumentation string `json:"service_documentation,omitempty"`

	// OPTIONAL. Languages and scripts supported for the user interface
	UILocalesSupported []string `json:"ui_locales_supported,omitempty"`

	// OPTIONAL. URL for authorization server's requirements on client data usage
	OpPolicyURI string `json:"op_policy_uri,omitempty"`

	// OPTIONAL. URL for authorization server's terms of service
	OpTosURI string `json:"op_tos_uri,omitempty"`

	// OPTIONAL. URL of the authorization server's OAuth 2.0 revocation endpoint
	RevocationEndpoint string `json:"revocation_endpoint,omitempty"`

	// OPTIONAL. JSON array containing client authentication methods for revocation endpoint
	RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported,omitempty"`

	// OPTIONAL. JSON array containing JWS signing algorithms for revocation endpoint
	RevocationEndpointAuthSigningAlgValuesSupported []string `json:"revocation_endpoint_auth_signing_alg_values_supported,omitempty"`

	// OPTIONAL. URL of the authorization server's OAuth 2.0 introspection endpoint
	IntrospectionEndpoint string `json:"introspection_endpoint,omitempty"`

	// OPTIONAL. JSON array containing client authentication methods for introspection endpoint
	IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported,omitempty"`

	// OPTIONAL. JSON array containing JWS signing algorithms for introspection endpoint
	IntrospectionEndpointAuthSigningAlgValuesSupported []string `json:"introspection_endpoint_auth_signing_alg_values_supported,omitempty"`

	// OPTIONAL. JSON array containing PKCE code challenge methods
	CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported,omitempty"`

	// OPTIONAL. Boolean indicating whether the client ID metadata document is supported
	ClientIDMetadataDocumentSupported bool `json:"client_id_metadata_document_supported,omitempty"`
}

AuthorizationServerMetadata represents OAuth 2.0 Authorization Server Metadata as defined in RFC 8414

type CallbackHandler added in v0.26.0

type CallbackHandler interface {
	AuthURLHandler
	NewState(context.Context, *oauth2.Config, string, string) (string, <-chan CallbackPayload, error)
}

type CallbackPayload added in v0.26.0

type CallbackPayload struct {
	Code             string `json:"code"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type Client

type Client struct {
	*gomcp.ClientSession
	// contains filtered or unexported fields
}

func (*Client) Close added in v0.28.0

func (c *Client) Close() error

func (*Client) ID

func (c *Client) ID() string

func (*Client) InitializeResult added in v0.28.0

func (c *Client) InitializeResult() *gomcp.InitializeResult

func (*Client) Wait added in v0.28.0

func (c *Client) Wait() error

Wait follows the cached client's lifetime, rather than an obsolete connection.

type ClientCredLookup added in v0.26.0

type ClientCredLookup interface {
	Lookup(context.Context) (string, string, error)
}

type ClientOption added in v0.26.0

type ClientOption struct {
	// OAuthRedirectURL overrides the hosted callback for a validated loopback flow.
	OAuthRedirectURL string
	// OAuthClientName overrides ClientName only for dynamic client registration.
	OAuthClientName string
	// OAuthClientIDMetadataDocument is empty when CIMD must not be used.
	OAuthClientIDMetadataDocument string
	ClientName                    string
	ClientVersion                 string
	TokenStorage                  TokenStorage
	CallbackHandler               CallbackHandler
	ClientLookup                  ClientCredLookup
}

type ClientRegistrationMetadata added in v0.26.0

type ClientRegistrationMetadata struct {
	// Array of redirection URI strings for use in redirect-based flows
	RedirectURIs []string `json:"redirect_uris,omitempty"`

	// String indicator of the requested authentication method for the token endpoint
	TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"`

	// Array of OAuth 2.0 grant type strings that the client can use at the token endpoint
	GrantTypes []string `json:"grant_types,omitempty"`

	// Array of the OAuth 2.0 response type strings that the client can use at the authorization endpoint
	ResponseTypes []string `json:"response_types,omitempty"`

	// Human-readable string name of the client to be presented to the end-user during authorization
	ClientName string `json:"client_name,omitempty"`

	// URL string of a web page providing information about the client
	ClientURI string `json:"client_uri,omitempty"`

	// URL string that references a logo for the client
	LogoURI string `json:"logo_uri,omitempty"`

	// String containing a space-separated list of scope values
	Scope string `json:"scope,omitempty"`

	// Array of strings representing ways to contact people responsible for this client
	Contacts []string `json:"contacts,omitempty"`

	// URL string that points to a human-readable terms of service document for the client
	TosURI string `json:"tos_uri,omitempty"`

	// URL string that points to a human-readable privacy policy document
	PolicyURI string `json:"policy_uri,omitempty"`

	// URL string referencing the client's JSON Web Key (JWK) Set document
	JwksURI string `json:"jwks_uri,omitempty"`

	// Client's JSON Web Key Set document value
	Jwks any `json:"jwks,omitempty"`

	// A unique identifier string assigned by the client developer or software publisher
	SoftwareID string `json:"software_id,omitempty"`

	// A version identifier string for the client software identified by "software_id"
	SoftwareVersion string `json:"software_version,omitempty"`
}

ClientRegistrationMetadata represents OAuth 2.0 Dynamic Client Registration metadata as defined in RFC 7591, merged from protected resource and authorization server metadata

func AuthServerMetadataToClientRegistration added in v0.26.0

func AuthServerMetadataToClientRegistration(authServer AuthorizationServerMetadata, clientName, redirectURL, scope string) ClientRegistrationMetadata

AuthServerMetadataToClientRegistration converts an AuthorizationServerMetadata to a ClientRegistrationMetadata for dynamic registration.

type ComponentServer added in v0.15.0

type ComponentServer struct {
	MCPServerInstanceID string               `json:"mcpServerInstanceID,omitempty"`
	DisableTools        bool                 `json:"disableTools,omitempty"`
	Name                string               `json:"name"`
	DisplayName         string               `json:"displayName"`
	URL                 string               `json:"url"`
	Tools               []types.ToolOverride `json:"tools"`
	ToolPrefix          string               `json:"toolPrefix"`
}

func (ComponentServer) ConnectID added in v0.26.0

func (c ComponentServer) ConnectID() string

ConnectID identifies the connection while Name identifies its backing server.

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 File

type File struct {
	Data    string `json:"data"`
	EnvKey  string `json:"envKey"`
	Dynamic bool   `json:"dynamic"`
}

type GlobalTokenStore

type GlobalTokenStore interface {
	ForUserAndMCP(userID, mcpID, mcpURL string) TokenStorage
}

func NewGlobalTokenStore added in v0.26.0

func NewGlobalTokenStore(gatewayClient *gateway.Client) GlobalTokenStore

type GuardrailTarget added in v0.28.0

type GuardrailTarget struct {
	// FilterName is the filter's resource name (its ID).
	FilterName string
	Config     types.MCPGuardrailFilterConfig
}

GuardrailTarget is a guardrail filter in a hook chain.

type HTTPClientOptions added in v0.26.0

type HTTPClientOptions struct {
	TokenSource   oauth2.TokenSource
	Timeout       time.Duration
	DirectConnect bool
}

type HookMapping added in v0.26.0

type HookMapping struct {
	Name    string
	Params  map[string]string
	Targets []HookTarget
}

func (HookMapping) Matches added in v0.26.0

func (h HookMapping) Matches(name string, params map[string]string) bool

type HookMutation added in v0.26.0

type HookMutation struct {
	Mutated bool     `json:"mutated"`
	Reasons []string `json:"reasons,omitempty"`
}

type HookRunner added in v0.26.0

type HookRunner interface {
	RunHook(ctx context.Context, servers HookServerConfigs, input SessionMessageHook, target string) (*SessionMessageHook, error)
}

HookRunner executes one configured hook target.

type HookServerConfigs added in v0.26.0

type HookServerConfigs map[string]ServerConfig

HookServerConfigs maps the server portion of a hook target (server/tool) to the MCP server configuration used to call that hook.

type HookTarget added in v0.26.0

type HookTarget struct {
	Target           string
	MutateDisallowed bool
	// Name is the filter's display name, recorded in audit logs.
	Name string
	// Guardrail is set for a guardrail filter, which Obot runs in-process instead of
	// calling Target on a filter MCP server.
	Guardrail *GuardrailTarget
}

type Hooks added in v0.26.0

type Hooks []HookMapping

func (Hooks) GuardrailsOnly added in v0.28.0

func (h Hooks) GuardrailsOnly() Hooks

GuardrailsOnly returns the hooks with only their guardrail filter targets, which need no hook runner.

func (Hooks) HasGuardrails added in v0.28.0

func (h Hooks) HasGuardrails() bool

HasGuardrails reports whether any hook target is a guardrail filter.

type Message added in v0.26.0

type Message struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Params  json.RawMessage `json:"params,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *RPCError       `json:"error,omitempty"`

	HookMutations map[string]HookMutation `json:"-"`
}

Message is the JSON-RPC envelope sent to and returned by MCP hooks.

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

func MissingSecretBindings(ctx context.Context, c kclient.Client, obotNamespace string, config []types.MCPConfig, allowedLabel string) ([]MissingSecretBinding, error)

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 OAuthMetadata added in v0.26.0

type OAuthMetadata struct {
	ProtectedResourceMetadataURL      string          `json:"protectedResourceMetadataUrl,omitempty"`
	ResourceURL                       string          `json:"resourceUrl,omitempty"`
	AuthorizationServerMetadataURL    string          `json:"authorizationServerMetadataUrl,omitempty"`
	ProtectedResourceMetadata         json.RawMessage `json:"protectedResourceMetadata,omitempty"`
	AuthorizationServerMetadata       json.RawMessage `json:"authorizationServerMetadata,omitempty"`
	ClientRegistration                json.RawMessage `json:"clientRegistration,omitempty"`
	DynamicClientRegistration         bool            `json:"dynamicClientRegistration,omitempty"`
	ClientIDMetadataDocumentSupported bool            `json:"clientIdMetadataDocumentSupported,omitempty"`
}

OAuthMetadata contains discovered OAuth metadata for an MCP server.

func GetOAuthMetadataWithClient added in v0.26.0

func GetOAuthMetadataWithClient(ctx context.Context, httpClient *http.Client, server ServerConfig, clientName, redirectURL string) (OAuthMetadata, error)

GetOAuthMetadataWithClient discovers OAuth protected resource and authorization server metadata for an HTTP MCP server using a custom HTTP client. Missing metadata endpoints are not errors.

type OpenAPIValidator added in v0.27.0

type OpenAPIValidator struct {
	RemoteMCPURLValidationConfig RemoteMCPURLValidationConfig
	DevMode                      bool
}

OpenAPIValidator implements RuntimeValidator for hosted OpenAPI runtimes.

func (OpenAPIValidator) ValidateCatalogConfig added in v0.27.0

func (v OpenAPIValidator) ValidateCatalogConfig(ctx context.Context, manifest types.MCPServerCatalogEntryManifest) error

func (OpenAPIValidator) ValidateConfig added in v0.27.0

func (v OpenAPIValidator) ValidateConfig(ctx context.Context, manifest types.MCPServerManifest) error

func (OpenAPIValidator) ValidateSystemConfig added in v0.27.0

type Options

type Options struct {
	MCPOpenAPIImage                   string   `usage:"Container image for the hosted OpenAPI runtime" default:"ghcr.io/obot-platform/mcp-images/openapi-mcp:v0.28.0"`
	MCPBaseImage                      string   `usage:"The base image to use for MCP containers" default:"ghcr.io/obot-platform/mcp-images/stdio-wrapper:v0.28.0"`
	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"`

	// 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)"`
	MCPK8sSettingsRuntimeClassName string `usage:"RuntimeClass name for MCP server pods (e.g., gvisor, kata)"`
	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 RPCError added in v0.26.0

type RPCError struct {
	Code    int             `json:"code,omitempty"`
	Message string          `json:"message,omitempty"`
	Data    json.RawMessage `json:"data,omitempty"`
}

func NewRPCError added in v0.26.0

func NewRPCError(code int, message string) *RPCError

func (*RPCError) WithMessage added in v0.26.0

func (e *RPCError) WithMessage(format string, args ...any) *RPCError

type RemoteMCPURLValidationConfig added in v0.23.0

type RemoteMCPURLValidationConfig struct {
	AllowLocalhostMCP bool
	AllowPrivateIPMCP bool
	AllowLinkLocalMCP bool
}

func (RemoteMCPURLValidationConfig) SafeHTTPOptions added in v0.27.0

func (c RemoteMCPURLValidationConfig) SafeHTTPOptions() safehttp.Options

SafeHTTPOptions applies the remote MCP address policy to HTTP clients and URL checks.

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

type ResourceMaximums added in v0.24.0

type ResourceMaximums struct {
	CPURequest    *resource.Quantity
	CPULimit      *resource.Quantity
	MemoryRequest *resource.Quantity
	MemoryLimit   *resource.Quantity
}

func EffectiveResourceMaximums added in v0.26.0

func EffectiveResourceMaximums(settings v1.K8sSettingsSpec, fallback ResourceMaximums) ResourceMaximums

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.
	LocalhostCallbackEnabled bool               `json:"localhostCallbackEnabled,omitempty"`
	LocalhostCallbackPath    string             `json:"localhostCallbackPath,omitempty"`
	URL                      string             `json:"url"`
	TunnelName               string             `json:"tunnelName,omitempty"`
	Headers                  []string           `json:"headers"`
	InjectObotHeaders        []types.ObotHeader `json:"injectObotHeaders,omitempty"`
	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"`

	// vMCP configuration.
	Components []ComponentServer `json:"components"`
	ConfigHash string            `json:"configHash"`
	ToolSearch bool              `json:"toolSearch,omitempty"`

	Scope                string `json:"scope"`
	UserID               string `json:"userID"`
	OwnerUserID          string `json:"ownerUserID"`
	MCPServerNamespace   string `json:"mcpServerNamespace"`
	MCPServerName        string `json:"mcpServerName"`
	MCPServerInstanceID  string `json:"mcpServerInstanceID,omitempty"`
	MCPCatalogName       string `json:"mcpCatalogName"`
	MCPCatalogEntryName  string `json:"mcpCatalogEntryName"`
	MCPServerDisplayName string `json:"mcpServerDisplayName"`
	ComponentMCPServer   bool   `json:"componentMCPServer"`
	SystemMCPServer      bool   `json:"systemMCPServer"`

	Audiences []string `json:"audiences"`

	AuditLogMetadata map[string]string `json:"auditLogMetadata"`

	StartupTimeout time.Duration                `json:"startupTimeout,omitempty"`
	Resources      *corev1.ResourceRequirements `json:"resources,omitempty"`
	Webhooks       []Webhook                    `json:"webhooks,omitempty"`
}

func ServerToServerConfig

func ServerToServerConfig(mcpServer v1.MCPServer, audiences []string, userID, scope, mcpCatalogName string, credEnv map[string]string, devMode bool) (ServerConfig, []string, error)

ServerToServerConfig resolves a manifest into runtime configuration. Hosted runtime images are selected by the deployment backend.

func SystemServerToServerConfig added in v0.15.0

func SystemServerToServerConfig(systemServer v1.SystemMCPServer, audiences []string, userID string, credEnv map[string]string) (ServerConfig, []string, error)

SystemServerToServerConfig converts a v1.SystemMCPServer to a ServerConfig for deployment

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

func NewSessionManager

func NewSessionManager(ctx context.Context, authEnabled, devMode 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 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) EffectiveKubernetesResourceMaximums added in v0.26.0

func (sm *SessionManager) EffectiveKubernetesResourceMaximums(
	ctx context.Context,
	storageClient kclient.Client,
) (ResourceMaximums, error)

func (*SessionManager) EffectiveKubernetesResourceMaximumsForSettings added in v0.26.0

func (sm *SessionManager) EffectiveKubernetesResourceMaximumsForSettings(
	settings v1.K8sSettingsSpec,
) ResourceMaximums

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) GetCapacityInfoForServers added in v0.26.0

func (sm *SessionManager) GetCapacityInfoForServers(ctx context.Context, serverNames []string) (types.MCPCapacityInfo, error)

GetCapacityInfoForServers returns capacity information for the given MCP server deployments. Only available when using the Kubernetes backend.

func (*SessionManager) GetOAuthMetadata added in v0.26.0

func (m *SessionManager) GetOAuthMetadata(ctx context.Context, serverConfig ServerConfig, clientName, redirectURL string, assumeOAuthRequired bool) (OAuthMetadata, error)

GetOAuthMetadata discovers OAuth metadata for a remote MCP server. When assumeOAuthRequired is true, discovery proceeds even if initialize succeeds. This supports servers that defer their OAuth challenge until tools/call.

func (*SessionManager) GetPrompt

func (sm *SessionManager) GetPrompt(ctx context.Context, serverConfig ServerConfig, name string, args map[string]string) ([]*gomcp.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, opts HTTPClientOptions) (*http.Client, error)

HTTPClientForServer returns an HTTP client that follows the server's configured network path, including its tunnel when present.

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) ([]*gomcp.Prompt, error)

func (*SessionManager) ListResources

func (sm *SessionManager) ListResources(ctx context.Context, serverConfig ServerConfig) ([]*gomcp.Resource, error)

func (*SessionManager) ListTools

func (sm *SessionManager) ListTools(ctx context.Context, serverConfig ServerConfig) ([]*gomcp.Tool, error)

func (*SessionManager) MCPRuntimeBackend added in v0.22.0

func (sm *SessionManager) MCPRuntimeBackend() string

func (*SessionManager) OAuthClientForServer added in v0.27.0

func (sm *SessionManager) OAuthClientForServer(server ServerConfig) (*http.Client, error)

OAuthClientForServer returns the client for the server's OAuth requests: metadata discovery, dynamic client registration, and token exchange and refresh. Those URLs come from the server's own metadata, so the client follows the server's tunnel when present and otherwise applies the admin's egress policy. Unlike HTTPClientForServer it carries no configured headers, grants no backend-specific exceptions, and has a timeout.

func (*SessionManager) PingServer

func (sm *SessionManager) PingServer(ctx context.Context, serverConfig ServerConfig) error

func (*SessionManager) ReadResource

func (sm *SessionManager) ReadResource(ctx context.Context, serverConfig ServerConfig, uri string) ([]*gomcp.ResourceContents, 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) (*gomcp.ServerCapabilities, error)

func (*SessionManager) ServerConfigForDeployment added in v0.28.0

func (sm *SessionManager) ServerConfigForDeployment(ctx context.Context, server v1.MCPServer) (ServerConfig, error)

ServerConfigForDeployment builds configuration without requiring a personal connection. The caller must authorize management access to the server before calling this method.

func (*SessionManager) ServerConfigForVMCP added in v0.26.0

func (sm *SessionManager) ServerConfigForVMCP(ctx context.Context, vmcpID string, user kuser.Info) (ServerConfig, error)

ServerConfigForVMCP resolves the component servers for a VMCP instance into the aggregate configuration consumed by the MCP gateway. VMCPs are backed by the MCPServers created by the VMCPInstance controller; the VMCP itself never gets launched as a runtime.

func (*SessionManager) ServerForAction added in v0.24.0

func (sm *SessionManager) ServerForAction(ctx context.Context, id string, user kuser.Info) (v1.MCPServer, ServerConfig, error)

func (*SessionManager) ServerForActionWithConnectID added in v0.24.0

func (sm *SessionManager) ServerForActionWithConnectID(ctx context.Context, id string, user kuser.Info) (string, v1.MCPServer, ServerConfig, error)

func (*SessionManager) ServerForActionWithConnectIDAllowMissingConfig added in v0.24.0

func (sm *SessionManager) ServerForActionWithConnectIDAllowMissingConfig(ctx context.Context, id string, user kuser.Info) (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) StartOAuthFromChallenge added in v0.28.0

func (m *SessionManager) StartOAuthFromChallenge(ctx context.Context, server ServerConfig, opt ClientOption, resourceMetadata, scope string) (string, error)

StartOAuthFromChallenge starts OAuth from an actual challenge without issuing any MCP operation.

func (*SessionManager) StartupKubernetesResourceMaximums added in v0.26.0

func (sm *SessionManager) StartupKubernetesResourceMaximums(
	ctx context.Context,
	storageClient kclient.Client,
) (ResourceMaximums, error)

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

func (*SessionManager) ValidationOptions added in v0.27.0

func (sm *SessionManager) ValidationOptions() ValidationOptions

ValidationOptions returns the startup destination validation settings.

type SessionManagerHookRunner added in v0.26.0

type SessionManagerHookRunner struct {
	// contains filtered or unexported fields
}

SessionManagerHookRunner invokes hook tools through Obot's MCP session manager.

func NewHookRunner added in v0.26.0

func NewHookRunner(sessionManager *SessionManager) *SessionManagerHookRunner

func (*SessionManagerHookRunner) RunHook added in v0.26.0

type SessionMessageHook added in v0.26.0

type SessionMessageHook struct {
	Accept  bool     `json:"accept"`
	Mutated bool     `json:"mutated"`
	Message *Message `json:"message"`
	Reason  string   `json:"reason"`
}

type StaticConfigurationRevealer added in v0.26.2

type StaticConfigurationRevealer interface {
	RevealCredential(ctx context.Context, contexts []string, name string) (gatewaytypes.Credential, error)
}

StaticConfigurationRevealer reads the credentials holding catalog entry static configuration.

type StaticConfigurationStore added in v0.26.2

type StaticConfigurationStore interface {
	StaticConfigurationRevealer
	UpsertCredential(ctx context.Context, credential gatewaytypes.Credential) error
}

StaticConfigurationStore reads and writes the credentials holding catalog entry static configuration.

type TokenStorage added in v0.26.0

type TokenStorage interface {
	GetTokenConfig(context.Context) (*oauth2.Config, *oauth2.Token, error)
	SetTokenConfig(context.Context, *oauth2.Config, *oauth2.Token) error
	RefreshTokenConfig(context.Context, *oauth2.Config, *oauth2.Token, *oauth2.Token) error
	DeleteTokenConfig(context.Context) error
	TokenSource(context.Context) (oauth2.TokenSource, error)
}

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 {
	DevMode                      bool
	AllowMissingURL              bool
	RemoteMCPURLValidationConfig RemoteMCPURLValidationConfig
	ResourceMaximums             ResourceMaximums
}

Options configures runtime validation behavior.

type Webhook

type Webhook struct {
	Name, DisplayName string
	URL               string
	Audience          string
	ToolName          string
	Definitions       types.MCPSelectors
	MutateAllowed     bool
	// Guardrail is set for a guardrail filter, which runs in-process: it has no URL,
	// audience or tool.
	Guardrail *types.MCPGuardrailFilterConfig `json:",omitempty"`
}

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, transformHostname func(string) string) ([]Webhook, error)

Directories

Path Synopsis
Package attribution owns MCP caller attribution and reserves its header names.
Package attribution owns MCP caller attribution and reserves its header names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL