mcpserver

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 39 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 aggregates a set's downstream servers into one MCP server exposing lazy-mcp's meta-tools. Sessions are opened on first use and shared by every later call.

Policy answers for invoke_command: lazy-mcp's `permissions` block and, after it, the calling key's profile. The gate itself lives in internal/config so the panel's browse path can apply the same permission rules.

Resources and prompts of downstream servers, reachable by the MCP client. A server contributes them only when its config names them in `expose`: without that the client sees tools alone, as before the field existed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupTracing added in v0.5.0

func SetupTracing(ctx context.Context) (func(context.Context) error, error)

SetupTracing включает OTLP/HTTP-экспорт. Без OTEL_EXPORTER_OTLP_ENDPOINT провайдер не ставится: спаны не пишутся и никуда не идут, а проброс traceparent работает на вручную выданных id.

Types

type Manager

type Manager struct {

	// Stats, when set, counts every downstream invocation per client and
	// tool. The panel reads the recorder; the proxy works without it.
	Stats *stats.Recorder

	// LockPath names the set's approved-descriptor record. Empty disables the
	// quarantine: a manager without a data dir has nowhere to keep approvals.
	LockPath string

	// ToolOutURL, when set, names a truncated answer by its /tool-out URL
	// instead of a path: the caller reached this process over HTTP with a key
	// and fetches the file under the same guard as /mcp. stdio leaves it false.
	ToolOutURL bool
	// contains filtered or unexported fields
}

Manager owns the downstream sessions of one set.

func New

func New(cfg *config.Config, version string, conn *downstream.Connector) *Manager

New builds a manager. Nothing is connected until a tool needs a server. A connector carries the version and, when present, OAuth settings.

func (*Manager) Close

func (m *Manager) Close() error

Close cancels in-flight connects and shuts every open downstream session.

func (*Manager) Reload added in v0.5.0

func (m *Manager) Reload(next *config.Config) ReloadResult

Reload applies a freshly loaded config to the running process: new servers join lazily, removed ones lose their session and tool cache, a server whose process or address changed gets a new session on its next call. The previous config stays in force only when the caller could not load one at all.

func (*Manager) ReloadFailed added in v0.5.0

func (m *Manager) ReloadFailed(err error) ReloadResult

ReloadFailed records an attempt whose file did not even load. The running config is untouched; the generation still grows so the supervisor's answer names the try that failed.

func (*Manager) Server

func (m *Manager) Server() *mcp.Server

func (*Manager) Warm

func (m *Manager) Warm(ctx context.Context)

Warm connects every enabled server and fills the tool cache, so the first client call does not pay for eleven cold starts. Failures are left to the regular health probe: warming never blocks the listener.

type ReloadResult added in v0.5.0

type ReloadResult struct {
	// Generation counts attempts, starting at 1, including a rejected config:
	// the supervisor sees that its SIGHUP landed even when nothing was applied.
	Generation int
	// Applied names what the live process now uses: "added:<server>" (lazy — no
	// connection until a call), "removed:<server>", "reset:<server>" (session
	// closed: a field that decides the process or address changed),
	// "updated:<server>" (applied in place, session kept), and the set-wide
	// "rateLimit", "permissions", "profiles", "requestTimeout", "healthMonitor".
	Applied []string
	// RestartNeeded names the transport fields this process cannot adopt: the
	// listener was built at startup, so only a restart applies them.
	RestartNeeded []string
	// Err is the load error. Applied stays empty and the previous config is
	// still in force: fail-closed, the process keeps serving.
	Err string
}

ReloadResult reports what one attempt to re-read the config applied, and what it could not. It is the whole answer the supervisor gets: the set's process writes it to reload.status, there is no HTTP route for it.

Jump to

Keyboard shortcuts

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