mcpserver

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 14 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

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

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.

Jump to

Keyboard shortcuts

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