Documentation
¶
Index ¶
- Constants
- func ToGrantSummary(grant MCPAccessGrant) access.GrantSummary
- func ToSessionSummary(session MCPAgentSession) access.SessionSummary
- type MCPAccessGrant
- type MCPAccessGrantList
- type MCPAgentSession
- type MCPAgentSessionList
- type Manager
- func (m *Manager) ApplyGrant(ctx context.Context, grant *MCPAccessGrant) (*MCPAccessGrant, error)
- func (m *Manager) ApplySession(ctx context.Context, session *MCPAgentSession) (*MCPAgentSession, error)
- func (m *Manager) AssertMCPServerRef(ctx context.Context, ref access.ServerReference) error
- func (m *Manager) CompleteSessionEnrollment(ctx context.Context, name, namespace, uid string) error
- func (m *Manager) DeleteGrant(ctx context.Context, name, namespace string) error
- func (m *Manager) DeletePendingSession(ctx context.Context, name, namespace, uid, humanID string) error
- func (m *Manager) DeleteSession(ctx context.Context, name, namespace string) error
- func (m *Manager) DisableGrant(ctx context.Context, name, namespace string) error
- func (m *Manager) EnableGrant(ctx context.Context, name, namespace string) error
- func (m *Manager) GetActiveMCPServerRef(ctx context.Context, ref access.ServerReference) (*mcpv1alpha1.MCPServer, error)
- func (m *Manager) GetGrant(ctx context.Context, name, namespace string) (*MCPAccessGrant, error)
- func (m *Manager) GetMCPServerRef(ctx context.Context, ref access.ServerReference) (*mcpv1alpha1.MCPServer, error)
- func (m *Manager) GetServerPolicy(ctx context.Context, namespace, serverName string) (map[string]interface{}, error)
- func (m *Manager) GetSession(ctx context.Context, name, namespace string) (*MCPAgentSession, error)
- func (m *Manager) ListGrantSessions(ctx context.Context, namespace, name string) (*MCPAgentSessionList, error)
- func (m *Manager) ListGrants(ctx context.Context, namespace string) (*MCPAccessGrantList, error)
- func (m *Manager) ListMCPServers(ctx context.Context, namespace string) (*mcpv1alpha1.MCPServerList, error)
- func (m *Manager) ListSessions(ctx context.Context, namespace string) (*MCPAgentSessionList, error)
- func (m *Manager) RetireServerAccess(ctx context.Context, namespace, name string) error
- func (m *Manager) RevokeGrantSessions(ctx context.Context, namespace, name string) (int64, error)
- func (m *Manager) RevokeSession(ctx context.Context, name, namespace string) error
- func (m *Manager) SetGrantMode(ctx context.Context, name, namespace string, mode access.GrantMode) error
- func (m *Manager) UnrevokeSession(ctx context.Context, name, namespace string) error
- func (m *Manager) WithSessionBackend(backend SessionBackend) *Manager
- type SessionBackend
Constants ¶
const ( APIGroup = mcpv1alpha1.Group APIVersion = mcpv1alpha1.Version AccessGrantResource = mcpv1alpha1.MCPAccessGrantResource MCPServerResource = mcpv1alpha1.MCPServerResource )
Variables ¶
This section is empty.
Functions ¶
func ToGrantSummary ¶
func ToGrantSummary(grant MCPAccessGrant) access.GrantSummary
ToGrantSummary converts an MCPAccessGrant to a GrantSummary.
func ToSessionSummary ¶
func ToSessionSummary(session MCPAgentSession) access.SessionSummary
ToSessionSummary converts an MCPAgentSession to a SessionSummary.
Types ¶
type MCPAccessGrant ¶
type MCPAccessGrant struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec access.MCPAccessGrantSpec `json:"spec,omitempty"`
Status access.MCPAccessGrantStatus `json:"status,omitempty"`
}
MCPAccessGrant grants a human or agent access to an MCPServer.
type MCPAccessGrantList ¶
type MCPAccessGrantList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MCPAccessGrant `json:"items"`
}
MCPAccessGrantList contains a list of MCPAccessGrant.
type MCPAgentSession ¶
type MCPAgentSession struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec access.MCPAgentSessionSpec `json:"spec,omitempty"`
Status access.MCPAgentSessionStatus `json:"status,omitempty"`
}
MCPAgentSession is a platform session management envelope, not a Kubernetes resource.
type MCPAgentSessionList ¶
type MCPAgentSessionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MCPAgentSession `json:"items"`
}
MCPAgentSessionList contains a list of MCPAgentSession.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Kubernetes grants and delegates sessions to the platform backend.
func NewManager ¶
func NewManager(dynamic dynamic.Interface, clientset kubernetes.Interface) *Manager
NewManager creates a new access resource manager.
func (*Manager) ApplyGrant ¶
func (m *Manager) ApplyGrant(ctx context.Context, grant *MCPAccessGrant) (*MCPAccessGrant, error)
ApplyGrant creates or updates an MCPAccessGrant resource.
func (*Manager) ApplySession ¶
func (m *Manager) ApplySession(ctx context.Context, session *MCPAgentSession) (*MCPAgentSession, error)
ApplySession uses the authoritative platform session backend.
func (*Manager) AssertMCPServerRef ¶
AssertMCPServerRef checks that a server exists and accepts new authorization. Use this before creating grants or sessions so the API can reject unknown targets early.
func (*Manager) CompleteSessionEnrollment ¶
CompleteSessionEnrollment conditionally completes enrollment in the platform store.
func (*Manager) DeleteGrant ¶
DeleteGrant removes an MCPAccessGrant.
func (*Manager) DeletePendingSession ¶
func (m *Manager) DeletePendingSession(ctx context.Context, name, namespace, uid, humanID string) error
DeletePendingSession conditionally removes the caller's pending enrollment.
func (*Manager) DeleteSession ¶
DeleteSession uses the authoritative platform session backend.
func (*Manager) DisableGrant ¶
DisableGrant disables an MCPAccessGrant by setting spec.disabled to true.
func (*Manager) EnableGrant ¶
EnableGrant enables an MCPAccessGrant by setting spec.disabled to false.
func (*Manager) GetActiveMCPServerRef ¶
func (m *Manager) GetActiveMCPServerRef(ctx context.Context, ref access.ServerReference) (*mcpv1alpha1.MCPServer, error)
GetActiveMCPServerRef resolves an authorization target for issuance. Ordinary lookups retain retiring servers so management can still check ownership and clean up access after a failed retirement.
func (*Manager) GetMCPServerRef ¶
func (m *Manager) GetMCPServerRef(ctx context.Context, ref access.ServerReference) (*mcpv1alpha1.MCPServer, error)
GetMCPServerRef returns the MCPServer referenced by ref.
func (*Manager) GetServerPolicy ¶
func (m *Manager) GetServerPolicy(ctx context.Context, namespace, serverName string) (map[string]interface{}, error)
GetServerPolicy returns the rendered policy for a specific server if available.
func (*Manager) GetSession ¶
GetSession uses the authoritative platform session backend.
func (*Manager) ListGrantSessions ¶
func (*Manager) ListGrants ¶
ListGrants returns all MCPAccessGrant resources, optionally filtered by namespace.
func (*Manager) ListMCPServers ¶
func (m *Manager) ListMCPServers(ctx context.Context, namespace string) (*mcpv1alpha1.MCPServerList, error)
ListMCPServers returns all MCPServer resources, optionally filtered by namespace.
func (*Manager) ListSessions ¶
ListSessions uses the authoritative platform session backend.
func (*Manager) RetireServerAccess ¶
RetireServerAccess invalidates and removes all authorization referencing the exact server identity, including resources held in other namespaces. It does not remove agents or audit history. A failure is safe to retry: all records are invalidated before any record is removed, and missing records are tolerated.
func (*Manager) RevokeGrantSessions ¶
RevokeGrantSessions atomically revokes linked sessions in the platform store.
func (*Manager) RevokeSession ¶
RevokeSession uses the authoritative platform session backend.
func (*Manager) SetGrantMode ¶
func (m *Manager) SetGrantMode(ctx context.Context, name, namespace string, mode access.GrantMode) error
SetGrantMode updates only enforcement mode, preserving the grant restrictions.
func (*Manager) UnrevokeSession ¶
UnrevokeSession uses the authoritative platform session backend.
func (*Manager) WithSessionBackend ¶
func (m *Manager) WithSessionBackend(backend SessionBackend) *Manager
WithSessionBackend selects the authoritative session store at construction. A configured backend error never falls back to Kubernetes session state.
type SessionBackend ¶
type SessionBackend interface {
ListSessions(context.Context, string) (*MCPAgentSessionList, error)
GetSession(context.Context, string, string) (*MCPAgentSession, error)
ApplySession(context.Context, *MCPAgentSession) (*MCPAgentSession, error)
RevokeSession(context.Context, string, string) error
UnrevokeSession(context.Context, string, string) error
DeleteSession(context.Context, string, string) error
}
SessionBackend owns runtime session persistence. Grants remain Kubernetes resources; platform-managed sessions use the platform API instead of CRDs.