Documentation
¶
Index ¶
- Constants
- func AuthRequiredError(err error) error
- func HasPlatformClient() bool
- func NormalizeBaseURL(raw string) string
- type AdapterCertificate
- type AdapterCertificateRequest
- type AdapterPreflight
- type AdapterPreflightRequest
- type AdapterSession
- type AdapterSessionRequest
- type Agent
- type AgentPage
- type ImagePublishRecord
- type LiveInventory
- type LivePrompt
- type LivePromptArgument
- type LiveResource
- type LiveTool
- type PlatformClient
- func (c *PlatformClient) ApplyAccessFromYAMLFile(ctx context.Context, path string) error
- func (c *PlatformClient) ApplyRuntimeServer(ctx context.Context, name, namespace string, spec mcpv1alpha1.MCPServerSpec) (ServerListItem, error)
- func (c *PlatformClient) ApplyRuntimeServerWithScope(ctx context.Context, name, namespace, scope string, ...) (ServerListItem, error)
- func (c *PlatformClient) ApplyRuntimeServerWithScopeUpdate(ctx context.Context, name, namespace, scope string, ...) (ServerListItem, error)
- func (c *PlatformClient) CheckRegistryAdmin(ctx context.Context) error
- func (c *PlatformClient) CleanupAdapterSession(ctx context.Context, namespace, session string) error
- func (c *PlatformClient) CreateAdapterSession(ctx context.Context, req AdapterSessionRequest) (AdapterSession, error)
- func (c *PlatformClient) CreateAgent(ctx context.Context, teamSlug, name string) (Agent, error)
- func (c *PlatformClient) CreateRegistryPullCredential(ctx context.Context, scope registryauth.PullScope) (RegistryPullCredential, error)
- func (c *PlatformClient) CreateTeam(ctx context.Context, slug, name string) (Team, error)
- func (c *PlatformClient) CreateTeamUser(ctx context.Context, slug, email, password, role string) (TeamMembership, error)
- func (c *PlatformClient) CreateUser(ctx context.Context, email, password, role string) (PlatformUser, error)
- func (c *PlatformClient) CredentialMetadata(ctx context.Context, method, namespace, kind, name string, ...) (json.RawMessage, error)
- func (c *PlatformClient) CurrentPrincipal(ctx context.Context) (Principal, error)
- func (c *PlatformClient) DeactivateUser(ctx context.Context, userID string) (apikit.UserDeactivationResult, error)
- func (c *PlatformClient) DeleteGrant(ctx context.Context, namespace, name string) error
- func (c *PlatformClient) DeleteRuntimeServer(ctx context.Context, namespace, name string) error
- func (c *PlatformClient) DeleteSession(ctx context.Context, namespace, name string) error
- func (c *PlatformClient) DeleteTeamMember(ctx context.Context, slug, userID string) error
- func (c *PlatformClient) GetAgent(ctx context.Context, id string) (Agent, error)
- func (c *PlatformClient) GetGrant(ctx context.Context, namespace, name string) (mcpaccess.GrantSummary, error)
- func (c *PlatformClient) GetRuntimePolicy(ctx context.Context, namespace, server string) ([]byte, error)
- func (c *PlatformClient) GetRuntimeServer(ctx context.Context, namespace, name string) (ServerListItem, error)
- func (c *PlatformClient) GetSession(ctx context.Context, namespace, name string) (mcpaccess.SessionSummary, error)
- func (c *PlatformClient) GetTeam(ctx context.Context, slug string) (Team, error)
- func (c *PlatformClient) IssueAdapterCertificate(ctx context.Context, req AdapterCertificateRequest) (AdapterCertificate, error)
- func (c *PlatformClient) ListAgents(ctx context.Context, teamSlug, status, query, cursor string, limit int) (AgentPage, error)
- func (c *PlatformClient) ListGrants(ctx context.Context, namespace string) ([]mcpaccess.GrantSummary, error)
- func (c *PlatformClient) ListNamespaces(ctx context.Context) ([]namespaceListItem, error)
- func (c *PlatformClient) ListRuntimeServers(ctx context.Context, namespace string) ([]ServerListItem, error)
- func (c *PlatformClient) ListRuntimeTools(ctx context.Context, filters map[string]string) ([]RuntimeToolRow, error)
- func (c *PlatformClient) ListSessions(ctx context.Context, namespace string) ([]mcpaccess.SessionSummary, error)
- func (c *PlatformClient) ListTeamMembers(ctx context.Context, slug string) ([]TeamMembership, error)
- func (c *PlatformClient) ListTeams(ctx context.Context) ([]Team, error)
- func (c *PlatformClient) PatchGrant(ctx context.Context, namespace, name string, disabled bool) error
- func (c *PlatformClient) PatchSession(ctx context.Context, namespace, name string, revoked bool) error
- func (c *PlatformClient) PreflightAdapter(ctx context.Context, req AdapterPreflightRequest) (AdapterPreflight, error)
- func (c *PlatformClient) PushRegistryImage(ctx context.Context, tarPath, target, scope string) error
- func (c *PlatformClient) RecordImagePublish(ctx context.Context, record ImagePublishRecord) error
- func (c *PlatformClient) RenameAgent(ctx context.Context, id, name string) (Agent, error)
- func (c *PlatformClient) RevokeGrantSessions(ctx context.Context, namespace, name string) (int, error)
- func (c *PlatformClient) SetAgentActive(ctx context.Context, id string, active bool) (Agent, error)
- func (c *PlatformClient) UpsertTeamMember(ctx context.Context, slug, userID, role string) (TeamMembership, error)
- func (c *PlatformClient) ValidateCredentials(ctx context.Context) error
- func (c *PlatformClient) WaitRegistryAdminReady(ctx context.Context, onRetry func(reason string)) error
- type PlatformUser
- type Principal
- type RegistryPullCredential
- type RuntimeToolRow
- type ServerListItem
- type Team
- type TeamMembership
- type ToolConfig
Constants ¶
const PlatformAuthRequiredMessage = "" /* 234-byte string literal not displayed */
PlatformAuthRequiredMessage tells users how to use the platform-backed CLI path.
Variables ¶
This section is empty.
Functions ¶
func AuthRequiredError ¶
AuthRequiredError wraps platform credential errors with user-facing mode guidance.
func HasPlatformClient ¶
func HasPlatformClient() bool
func NormalizeBaseURL ¶
NormalizeBaseURL trims whitespace, trailing slashes, and an optional trailing /api suffix from a platform base URL.
Types ¶
type AdapterCertificate ¶
type AdapterPreflight ¶
type AdapterPreflight struct {
Ready bool `json:"ready"`
AdapterCertificates bool `json:"adapterCertificatesEnabled"`
Issuer string `json:"issuer,omitempty"`
IssuerReady bool `json:"issuerReady"`
TrustDomain string `json:"trustDomain,omitempty"`
RouteEligible bool `json:"routeEligible"`
RouteReady bool `json:"routeReady"`
Reason string `json:"reason,omitempty"`
}
type AdapterPreflightRequest ¶
type AdapterPreflightRequest struct {
ServerName string `json:"serverName"`
Namespace string `json:"namespace,omitempty"`
AgentID string `json:"agentID"`
}
AdapterPreflightRequest asks whether the selected server is ready for session-bound client-certificate enrollment. It has no side effects.
type AdapterSession ¶
type AdapterSession struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
HumanID string `json:"humanID"`
AgentID string `json:"agentID"`
TeamID string `json:"teamID,omitempty"`
ServerName string `json:"serverName"`
ConsentedTrust string `json:"consentedTrust"`
PolicyVersion string `json:"policyVersion"`
ExpiresAt time.Time `json:"expiresAt"`
Reused bool `json:"reused"`
TrustDomain string `json:"trustDomain,omitempty"`
}
AdapterSession captures the identity the adapter must inject into runtime requests. ExpiresAt is absolute (server-side time); callers should refresh before it elapses.
type AdapterSessionRequest ¶
type AdapterSessionRequest struct {
ServerName string `json:"serverName"`
Namespace string `json:"namespace,omitempty"`
AgentID string `json:"agentID"`
RequestedTrust string `json:"requestedTrust,omitempty"`
RequestedTTL string `json:"requestedTTL,omitempty"`
}
AdapterSessionRequest is the input contract for the platform API endpoint POST /api/v1/runtime/adapter/sessions. RequestedTTL/Trust are optional; empty values fall back to platform-side defaults.
type ImagePublishRecord ¶
type LiveInventory ¶
type LiveInventory struct {
FetchedAt string `json:"fetchedAt"`
ProtocolVersion string `json:"protocolVersion,omitempty"`
Tools []LiveTool `json:"tools"`
Prompts []LivePrompt `json:"prompts"`
Resources []LiveResource `json:"resources"`
// Extensions are the protocol extensions the server advertised, keyed by
// identifier, with their settings.
Extensions map[string]json.RawMessage `json:"extensions,omitempty"`
}
LiveInventory is the latest tools/list, prompts/list and resources/list result observed by the platform runtime API. It is cached and may be absent until the first probe completes.
type LivePrompt ¶
type LivePrompt struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Arguments []LivePromptArgument `json:"arguments,omitempty"`
}
type LivePromptArgument ¶
type LiveResource ¶
type LiveTool ¶
type LiveTool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema,omitempty"`
}
type PlatformClient ¶
type PlatformClient struct {
// contains filtered or unexported fields
}
PlatformClient calls the platform API with an API key.
func NewCredentialClient ¶
func NewCredentialClient(baseURL, token string) (*PlatformClient, error)
NewCredentialClient binds a client to one explicitly selected identity. Unlike NewPlatformClient it never reads or changes process-wide login selection.
func NewPlatformClient ¶
func NewPlatformClient() (*PlatformClient, error)
NewPlatformClient returns a client when platform credentials and API base URL are configured. If the user is not logged in, returns authfile.ErrNotFound.
func NewPlatformClientWithAPIKey ¶
func NewPlatformClientWithAPIKey(baseURL, apiKey string) (*PlatformClient, error)
NewPlatformClientWithAPIKey returns a client for setup-time administration that authenticates with a cluster-held service key instead of a CLI login. The base URL must be an HTTPS origin without credentials, query, or fragment.
func ResolvePlatformOrKube ¶
func ResolvePlatformOrKube(useKube bool) (*PlatformClient, bool, error)
ResolvePlatformOrKube returns direct Kubernetes mode only when useKube is explicit. Otherwise it requires platform API credentials and does not fall back to kubeconfig.
func (*PlatformClient) ApplyAccessFromYAMLFile ¶
func (c *PlatformClient) ApplyAccessFromYAMLFile(ctx context.Context, path string) error
func (*PlatformClient) ApplyRuntimeServer ¶
func (c *PlatformClient) ApplyRuntimeServer(ctx context.Context, name, namespace string, spec mcpv1alpha1.MCPServerSpec) (ServerListItem, error)
func (*PlatformClient) ApplyRuntimeServerWithScope ¶
func (c *PlatformClient) ApplyRuntimeServerWithScope(ctx context.Context, name, namespace, scope string, spec mcpv1alpha1.MCPServerSpec) (ServerListItem, error)
func (*PlatformClient) ApplyRuntimeServerWithScopeUpdate ¶
func (c *PlatformClient) ApplyRuntimeServerWithScopeUpdate(ctx context.Context, name, namespace, scope string, spec mcpv1alpha1.MCPServerSpec, update bool) (ServerListItem, error)
func (*PlatformClient) CheckRegistryAdmin ¶
func (c *PlatformClient) CheckRegistryAdmin(ctx context.Context) error
func (*PlatformClient) CleanupAdapterSession ¶
func (c *PlatformClient) CleanupAdapterSession(ctx context.Context, namespace, session string) error
CleanupAdapterSession deletes a newly-created, still-pending enrollment session after certificate issuance fails. The server verifies ownership and refuses to delete reused or completed sessions.
func (*PlatformClient) CreateAdapterSession ¶
func (c *PlatformClient) CreateAdapterSession(ctx context.Context, req AdapterSessionRequest) (AdapterSession, error)
CreateAdapterSession asks the platform to issue (or reuse) an MCPAgentSession for the calling principal. The returned session.Name doubles as the SessionID the adapter forwards on every runtime request.
func (*PlatformClient) CreateAgent ¶
func (*PlatformClient) CreateRegistryPullCredential ¶
func (c *PlatformClient) CreateRegistryPullCredential(ctx context.Context, scope registryauth.PullScope) (RegistryPullCredential, error)
func (*PlatformClient) CreateTeam ¶
func (*PlatformClient) CreateTeamUser ¶
func (c *PlatformClient) CreateTeamUser(ctx context.Context, slug, email, password, role string) (TeamMembership, error)
func (*PlatformClient) CreateUser ¶
func (c *PlatformClient) CreateUser(ctx context.Context, email, password, role string) (PlatformUser, error)
func (*PlatformClient) CredentialMetadata ¶
func (c *PlatformClient) CredentialMetadata(ctx context.Context, method, namespace, kind, name string, body json.RawMessage, revision int64) (json.RawMessage, error)
func (*PlatformClient) CurrentPrincipal ¶
func (c *PlatformClient) CurrentPrincipal(ctx context.Context) (Principal, error)
func (*PlatformClient) DeactivateUser ¶
func (c *PlatformClient) DeactivateUser(ctx context.Context, userID string) (apikit.UserDeactivationResult, error)
func (*PlatformClient) DeleteGrant ¶
func (c *PlatformClient) DeleteGrant(ctx context.Context, namespace, name string) error
func (*PlatformClient) DeleteRuntimeServer ¶
func (c *PlatformClient) DeleteRuntimeServer(ctx context.Context, namespace, name string) error
func (*PlatformClient) DeleteSession ¶
func (c *PlatformClient) DeleteSession(ctx context.Context, namespace, name string) error
func (*PlatformClient) DeleteTeamMember ¶
func (c *PlatformClient) DeleteTeamMember(ctx context.Context, slug, userID string) error
func (*PlatformClient) GetGrant ¶
func (c *PlatformClient) GetGrant(ctx context.Context, namespace, name string) (mcpaccess.GrantSummary, error)
func (*PlatformClient) GetRuntimePolicy ¶
func (*PlatformClient) GetRuntimeServer ¶
func (c *PlatformClient) GetRuntimeServer(ctx context.Context, namespace, name string) (ServerListItem, error)
GetRuntimeServer returns one server with its runtime inventory and scoped last-session observation when the caller may inspect server activity.
func (*PlatformClient) GetSession ¶
func (c *PlatformClient) GetSession(ctx context.Context, namespace, name string) (mcpaccess.SessionSummary, error)
func (*PlatformClient) IssueAdapterCertificate ¶
func (c *PlatformClient) IssueAdapterCertificate(ctx context.Context, req AdapterCertificateRequest) (AdapterCertificate, error)
func (*PlatformClient) ListAgents ¶
func (*PlatformClient) ListGrants ¶
func (c *PlatformClient) ListGrants(ctx context.Context, namespace string) ([]mcpaccess.GrantSummary, error)
func (*PlatformClient) ListNamespaces ¶
func (c *PlatformClient) ListNamespaces(ctx context.Context) ([]namespaceListItem, error)
func (*PlatformClient) ListRuntimeServers ¶
func (c *PlatformClient) ListRuntimeServers(ctx context.Context, namespace string) ([]ServerListItem, error)
func (*PlatformClient) ListRuntimeTools ¶
func (c *PlatformClient) ListRuntimeTools(ctx context.Context, filters map[string]string) ([]RuntimeToolRow, error)
func (*PlatformClient) ListSessions ¶
func (c *PlatformClient) ListSessions(ctx context.Context, namespace string) ([]mcpaccess.SessionSummary, error)
func (*PlatformClient) ListTeamMembers ¶
func (c *PlatformClient) ListTeamMembers(ctx context.Context, slug string) ([]TeamMembership, error)
func (*PlatformClient) ListTeams ¶
func (c *PlatformClient) ListTeams(ctx context.Context) ([]Team, error)
func (*PlatformClient) PatchGrant ¶
func (*PlatformClient) PatchSession ¶
func (*PlatformClient) PreflightAdapter ¶
func (c *PlatformClient) PreflightAdapter(ctx context.Context, req AdapterPreflightRequest) (AdapterPreflight, error)
func (*PlatformClient) PushRegistryImage ¶
func (c *PlatformClient) PushRegistryImage(ctx context.Context, tarPath, target, scope string) error
PushRegistryImage uploads a docker save tar and asks the platform API to push it to the configured registry from inside the cluster.
func (*PlatformClient) RecordImagePublish ¶
func (c *PlatformClient) RecordImagePublish(ctx context.Context, record ImagePublishRecord) error
func (*PlatformClient) RenameAgent ¶
func (*PlatformClient) RevokeGrantSessions ¶
func (*PlatformClient) SetAgentActive ¶
func (*PlatformClient) UpsertTeamMember ¶
func (c *PlatformClient) UpsertTeamMember(ctx context.Context, slug, userID, role string) (TeamMembership, error)
func (*PlatformClient) ValidateCredentials ¶
func (c *PlatformClient) ValidateCredentials(ctx context.Context) error
func (*PlatformClient) WaitRegistryAdminReady ¶
func (c *PlatformClient) WaitRegistryAdminReady(ctx context.Context, onRetry func(reason string)) error
WaitRegistryAdminReady polls the registry administration preflight until it succeeds registryReadyStreak times in a row. Ingress gateway errors (502, 503, 504) and transport failures are transient right after a platform-api rollout and restart the streak; any other unexpected status (401, 403, 404) fails immediately. Credential creation is deliberately not retried: every POST mints a new credential, so an ambiguous failure could orphan one. onRetry, when non-nil, is told why the wait continues.
type PlatformUser ¶
type RegistryPullCredential ¶
type RuntimeToolRow ¶
type RuntimeToolRow struct {
ToolName string `json:"tool_name"`
Description string `json:"description,omitempty"`
ServerName string `json:"server_name"`
Namespace string `json:"namespace"`
TeamID string `json:"team_id,omitempty"`
EndpointURL string `json:"endpoint_url,omitempty"`
Declared bool `json:"declared"`
Live bool `json:"live"`
DriftStatus string `json:"drift_status"`
RequiredTrust string `json:"required_trust,omitempty"`
SideEffect string `json:"side_effect,omitempty"`
RiskLevel string `json:"risk_level,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
ConnectConfig map[string]any `json:"connect_config,omitempty"`
}
type ServerListItem ¶
type ServerListItem struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
UID string `json:"uid,omitempty"`
TeamID string `json:"team_id,omitempty"`
Image string `json:"image,omitempty"`
ImageTag string `json:"imageTag,omitempty"`
Description string `json:"description,omitempty"`
Ready string `json:"ready"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
Generation int64 `json:"generation,omitempty"`
Labels map[string]string `json:"labels"`
Age string `json:"age"`
Endpoint string `json:"endpoint,omitempty"`
AuthMode string `json:"authMode,omitempty"`
AuthHeaders []string `json:"authHeaders,omitempty"`
CredentialPresence string `json:"credentialPresence,omitempty"`
GatewayEnabled bool `json:"gatewayEnabled"`
ServicePort int32 `json:"servicePort,omitempty"`
Tools []ToolConfig `json:"tools,omitempty"`
Prompts []mcpv1alpha1.InventoryItem `json:"prompts,omitempty"`
Resources []mcpv1alpha1.InventoryItem `json:"resources,omitempty"`
Tasks []mcpv1alpha1.InventoryItem `json:"tasks,omitempty"`
LiveInventory *LiveInventory `json:"liveInventory,omitempty"`
LiveInventoryError string `json:"liveInventoryError,omitempty"`
AccessJSON map[string]any `json:"access_json,omitempty"`
RuntimeStatus controlplane.ServerRuntimeStatus `json:"runtimeStatus"`
Egress *controlplane.ServerEgressInfo `json:"egress,omitempty"`
}
ServerListItem is one row from the platform API runtime servers list.
type TeamMembership ¶
type TeamMembership = apikit.TeamMembership
type ToolConfig ¶
type ToolConfig struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
RequiredTrust string `json:"requiredTrust,omitempty"`
SideEffect string `json:"sideEffect,omitempty"`
RiskLevel string `json:"riskLevel,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}