Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(client ManagementClient, version string, opts Options) *mcp.Server
NewServer builds a tools-only MCP server backed by vmflow's daemon management API.
func RunStdio ¶
func RunStdio(ctx context.Context, stdin io.Reader, stdout io.Writer, client ManagementClient, version string, opts Options) error
RunStdio serves one MCP client over the supplied streams. The streams are not closed because the caller normally owns os.Stdin and os.Stdout. Callers must keep diagnostics on stderr so stdout remains a JSON-RPC-only channel.
Types ¶
type ManagementClient ¶
type ManagementClient interface {
Session(context.Context) (*controlapi.SessionResponse, error)
ConfigRules(context.Context) (*controlapi.ConfigRulesResponse, error)
Rules(context.Context) (*controlapi.RulesResponse, error)
Stats(context.Context) (*controlapi.StatsResponse, error)
CurrentPrecheck(context.Context) (*controlapi.CurrentPrecheckResponse, error)
}
ManagementClient is the read-only subset of the daemon management client used by MCP. Keeping this boundary small makes tool contracts testable and prevents write APIs from becoming reachable through the MCP server unless write mode is explicitly enabled.
type Options ¶ added in v0.4.0
type Options struct {
WriteEnabled bool
}
Options configures optional MCP server capabilities. WriteEnabled is off by default; enabling it registers the single-rule write tools when the management client also implements WriteManagementClient.
type WriteManagementClient ¶ added in v0.4.0
type WriteManagementClient interface {
Precheck(ctx context.Context, match string, draft controlapi.ConfigRulesRequest) (*controlapi.PrecheckResponse, error)
Apply(ctx context.Context, match string, draft controlapi.ConfigRulesRequest) (*controlapi.ApplyResponse, error)
}
WriteManagementClient is the write subset of the daemon management client. It is plumbed into the backend only when the server is constructed with write mode enabled; controlapi.Client satisfies it without changes.