Documentation
¶
Index ¶
- func CloseAllForwards()
- func LeaseGate(cfg LeaseGateConfig, extract NodeExtractor, inner server.ToolHandlerFunc) server.ToolHandlerFunc
- func RegisterContext(s *server.MCPServer, reg *registry.Registry, leaseCfg LeaseGateConfig)
- func RegisterDeploy(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterDiagnostics(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterExecute(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterForward(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterHistory(s *server.MCPServer, auditLog *audit.Log)
- func RegisterImportExport(s *server.MCPServer, reg *registry.Registry)
- func RegisterInventory(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool)
- func RegisterJobs(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterLeasing(s *server.MCPServer, reg *registry.Registry, store leasing.Store)
- func RegisterMultiNode(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterNodeOps(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPackage(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPatch(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPortal(s *server.MCPServer)
- func RegisterProcess(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterSchedule(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterTopology(s *server.MCPServer, reg *registry.Registry)
- func RegisterTransfer(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func SetHealthMonitor(m *healthmon.Monitor)
- func SetOpsRegistry(r *ops.Registry)
- func SetPortalURL(u string)
- type LeaseGateConfig
- type NodeExtractor
- type PatchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAllForwards ¶ added in v0.2.0
func CloseAllForwards()
CloseAllForwards releases all active forwards. Safe to call during shutdown.
func LeaseGate ¶ added in v0.4.0
func LeaseGate(cfg LeaseGateConfig, extract NodeExtractor, inner server.ToolHandlerFunc) server.ToolHandlerFunc
LeaseGate wraps an inner tool handler so that, before invoking it, the caller's effective identity is verified to hold an active lease covering every node the call would touch.
Behavior:
- cfg.Enabled == false → pass-through (no store calls).
- extract returns [] → pass-through (no node ownership to check).
- All requested nodes are covered by one or more active leases owned by this agent_id → call inner; on return, if inner took > 30s and the covering lease's runway is < 5min, opportunistically Extend by 60s (errors silently ignored, this is best-effort heartbeat).
- Otherwise → render a structured markdown error listing the holders of the offending nodes and the recommended recovery commands.
The wrap order is: LeaseGate(...) → addTool(...) so that ops-registry tracking sees both successful calls and lease-denied calls. Tools that bypass addTool (s.AddTool direct) still call LeaseGate first.
func RegisterContext ¶
func RegisterContext(s *server.MCPServer, reg *registry.Registry, leaseCfg LeaseGateConfig)
func RegisterDeploy ¶
func RegisterDeploy(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, creds *credentials.Store, agentToken string)
func RegisterDiagnostics ¶
func RegisterDiagnostics(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterExecute ¶
func RegisterExecute(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterForward ¶ added in v0.2.0
func RegisterForward(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
RegisterForward wires the forward_port / stop_forward / list_forwards tools.
func RegisterInventory ¶
func RegisterJobs ¶ added in v0.2.0
func RegisterJobs(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
RegisterJobs exposes the background-job tools (detached executions).
func RegisterLeasing ¶ added in v0.4.0
RegisterLeasing registers the 8 lease tools described in v0.4.0 M2 of the leasing design memo. Tools wrap the in-process leasing.Store (M1).
The reg argument is used only by the topology / role convenience tools and the optional node-name validation in lease(). Store is owned by the caller (cmd/lablink-server/main.go).
func RegisterMultiNode ¶
func RegisterMultiNode(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterNodeOps ¶
func RegisterNodeOps(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterPackage ¶
func RegisterPackage(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterPatch ¶
func RegisterPatch(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, patchCfg *PatchConfig, leaseCfg LeaseGateConfig)
func RegisterPortal ¶ added in v0.2.0
RegisterPortal exposes get_portal_url so the AI client can hand the operator a clickable link to the local operations portal without grepping logs.
func RegisterProcess ¶
func RegisterProcess(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterSchedule ¶
func RegisterSchedule(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterTransfer ¶
func RegisterTransfer(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func SetHealthMonitor ¶
SetHealthMonitor stores the health monitor for use by all tool handlers.
func SetOpsRegistry ¶
SetOpsRegistry registers a process-wide operations registry. Tool handlers that opt in via beginOp will record themselves there for the local portal. Safe to leave nil; in that case beginOp is a no-op pass-through.
func SetPortalURL ¶ added in v0.2.0
func SetPortalURL(u string)
SetPortalURL records the bookmarkable portal URL for get_portal_url to return. Pass "" to indicate the portal is unavailable.
Types ¶
type LeaseGateConfig ¶ added in v0.4.0
LeaseGateConfig is the wiring an MCP tool registration uses to enable lease checks. One LeaseGateConfig is shared across every tool registration in a single lablink-server process.
Enabled gates the whole middleware: when false, LeaseGate degrades to a pass-through (no lookup, no heartbeat, no allocation). The server toggles this via the LABLINK_LEASE_REQUIRED env var.
type NodeExtractor ¶ added in v0.4.0
type NodeExtractor func(mcp.CallToolRequest, *registry.Registry) []string
NodeExtractor pulls the tool-touched node names out of an MCP request. Tools that act on a single node pass extractSingleNode("node"); tools that fan out over a role/topology or a node list pass a custom extractor.
An empty return is allowed and means "this call doesn't touch a node" — LeaseGate then passes through without consulting the store.
type PatchConfig ¶
type PatchConfig struct {
SfpCopySource string // Network share or local path to sfpcopy.exe (dev machine accessible)
CacheDir string // Local cache dir for sfpcopy.exe on the dev machine
}
PatchConfig holds configurable paths for patching.
func NewPatchConfig ¶
func NewPatchConfig(configDir string) *PatchConfig