Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthTokenFromContext ¶
AuthTokenFromContext retrieves the Authorization header value stored in the context by HTTPContextFuncAuth.
func ExtractUserFromToken ¶
ExtractUserFromToken extracts the user identity (email or subject) from a JWT token forwarded by muster. This does not verify the token -- verification is handled by muster before forwarding.
func HTTPContextFuncAuth ¶
HTTPContextFuncAuth extracts the Authorization header from the incoming HTTP request and stores it in the context. It is used with mcp-go's WithHTTPContextFunc to make the token available to tool handlers.
Types ¶
type AgentMCPClient ¶ added in v0.0.15
type AgentMCPClient interface {
Prompt(ctx context.Context, instanceName, baseURL, message string) (*mcpgolang.CallToolResult, error)
Status(ctx context.Context, instanceName, baseURL string) (*mcpgolang.CallToolResult, error)
Result(ctx context.Context, instanceName, baseURL string, full bool) (*mcpgolang.CallToolResult, error)
SessionID(instanceName string) string
Close()
}
AgentMCPClient communicates with the MCP endpoint running inside a klaus agent container. The production implementation caches sessions per instance to avoid repeated initialization. Tests can supply a mock.
func NewAgentMCPClient ¶ added in v0.0.15
func NewAgentMCPClient() AgentMCPClient
NewAgentMCPClient creates a new AgentMCPClient with session caching.
type ArtifactLister ¶
type ArtifactLister interface {
ListPlugins(ctx context.Context, opts ...klausoci.ListOption) ([]klausoci.ListEntry, error)
ListPersonalities(ctx context.Context, opts ...klausoci.ListOption) ([]klausoci.ListEntry, error)
ListToolchains(ctx context.Context, opts ...klausoci.ListOption) ([]klausoci.ListEntry, error)
}
ArtifactLister discovers available OCI artifacts from a registry.
type PodLogReader ¶ added in v0.0.13
type PodLogReader interface {
GetLogs(ctx context.Context, namespace, podName string, opts *corev1.PodLogOptions) (io.ReadCloser, error)
}
PodLogReader reads logs from a pod container. The production implementation uses the Kubernetes clientset (corev1client), while tests can supply a mock.
func NewPodLogReader ¶ added in v0.0.13
func NewPodLogReader(coreClient corev1client.CoreV1Interface) PodLogReader
NewPodLogReader creates a PodLogReader backed by a Kubernetes CoreV1 client.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the MCP server for the klaus-operator, exposing tools to create, list, delete, get, and restart KlausInstance resources, and to discover available OCI artifacts (plugins, personalities, toolchains). It implements manager.Runnable so it can be managed by controller-runtime.
func NewServer ¶
func NewServer(c client.Client, operatorNamespace, addr string, ociClient ArtifactLister, podLogReader PodLogReader, agentClient AgentMCPClient) *Server
NewServer creates a new MCP server backed by the given Kubernetes client and OCI client for artifact discovery.
func (*Server) NeedLeaderElection ¶
NeedLeaderElection implements manager.LeaderElectionRunnable to indicate the MCP server should run regardless of leader election status.