mcp

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package mcp serves request files to AI agents over the Model Context Protocol (`sonde mcp`): sonde_list and sonde_check read them, and sonde_run, only when the server was started with --allow-run, runs one against the hosts of an allowlist. Every capability is granted on the command line at start; nothing a tool call sends widens it. Tools see only files under the root, and every secret is redacted from what they return.

Index

Constants

View Source
const (
	DefaultRunTimeout = time.Minute
	MaxRunTimeout     = 10 * time.Minute
)

Run timeout bounds.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (*sdk.Server, io.Closer, error)

New returns the MCP server for cfg. Close the returned closer when the server is done.

func Serve

func Serve(ctx context.Context, cfg Config, t sdk.Transport) error

Serve runs the server on t until the client disconnects or ctx ends.

Types

type Config

type Config struct {
	// Root confines every file a tool reads; it must be absolute, with
	// symbolic links resolved.
	Root string
	// AllowRun registers sonde_run; Hosts must then be set.
	AllowRun bool
	// Hosts are the hosts sonde_run may contact.
	Hosts *netpolicy.Policy
	// Env is the environment of --env, used when a call names none;
	// EnvVar is SONDE_ENV. Both fall back to a sonde.yaml's defaults.env.
	Env, EnvVar string
	// Variables (--variable, SONDE_VARIABLE_*) and Secrets (--secret,
	// SONDE_SECRET_*) apply to every run; the variables of a call win
	// over Variables.
	Variables map[string]any
	Secrets   map[string]string
	// RunTimeout bounds each run (default DefaultRunTimeout).
	RunTimeout time.Duration
	// Version is the sonde version announced to clients.
	Version string
	// Log receives one audit line per tool call. Nil: discarded.
	Log io.Writer
}

Config is what `sonde mcp` was started with.

Jump to

Keyboard shortcuts

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