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 ¶
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 ¶
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) 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.
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.