mcpserver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: GPL-3.0, LGPL-3.0 Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver offers clusterctl to an AI agent over the Model Context Protocol.

The agent is given a few tools shaped around what it is asked to find out, rather than one tool per command: resolve a node set, describe nodes across the inventory and the workload manager, query Slurm, and run any command the command tree marks as read-only. Nothing changes the site except through a plan: plan_change resolves and previews an action exactly as the confirmation gate would, and apply_plan carries it out once the administrator, not the agent, has answered the gate's question.

The server runs on the administrator's workstation, over stdio, as the administrator: it reaches the site with their ssh agent and their configuration, and it is pinned to the context it was started in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmModes

func ConfirmModes() []string

ConfirmModes lists the accepted modes.

Types

type ConfirmMode

type ConfirmMode string

ConfirmMode says who answers the confirmation gate before a plan is applied.

const (
	// ConfirmElicit asks the administrator through the client, with an MCP
	// elicitation the agent cannot answer. A client that cannot ask is
	// refused.
	ConfirmElicit ConfirmMode = "elicit"
	// ConfirmApproval leaves the question to the client's own approval of
	// the apply_plan call, which shows the node set and the count the agent
	// had to repeat. It is only as good as the client's approval settings.
	ConfirmApproval ConfirmMode = "approval"
)

type Options

type Options struct {
	// App holds the global options every call resolves the configuration
	// with. Its context is pinned when the server starts; the node set,
	// dry run, confirmation and force options are ignored.
	App app.Options
	// StateDir and CacheDir are where the calls keep their state and cache.
	StateDir string
	CacheDir string
	// Command builds a fresh command tree writing to the given streams. The
	// read_command tool runs the read-only commands through it.
	Command func(ctx context.Context, streams app.Streams) *cobra.Command
	// Confirm says who answers the confirmation gate.
	Confirm ConfirmMode
	// PlanTTL is how long a plan may wait to be applied.
	PlanTTL time.Duration
	// Version is reported to the client.
	Version string
	// Log receives the server's own messages. Standard output carries the
	// protocol, so this is never it.
	Log io.Writer
	// Now replaces the clock in tests.
	Now func() time.Time
}

Options configure a server.

type Server

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

Server is a clusterctl MCP server.

func New

func New(ctx context.Context, opts Options) (*Server, error)

New resolves the configuration once, pins the context it names and builds the server.

func (*Server) Run

func (s *Server) Run(ctx context.Context, t mcp.Transport) error

Run serves one client over a transport until it disconnects or the context ends.

func (*Server) SDK

func (s *Server) SDK() *mcp.Server

SDK returns the underlying server, for tests that connect a client in memory.

Jump to

Keyboard shortcuts

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