mcpserver

package
v0.3.0-rc.55 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 21 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 is the built-in MCP server at /mcp (streamable HTTP, stateless). It offers the same operations as the REST API, with the same tokens and scopes, so an agent can see what is alerting, gather the evidence in one call, act on it and leave notes, and work on machines through the SSH channel with tools shaped like its own (run a command, read, write and edit a file). Every write and every session is audited and echoed to the alert chat.

Index

Constants

View Source
const Instructions = `` /* 1783-byte string literal not displayed */

Instructions tell an agent what the server is for and how to use it well.

View Source
const MonitorInstructions = `` /* 809-byte string literal not displayed */

MonitorInstructions follow Instructions when the server has the monitors.

Variables

This section is empty.

Functions

func Handler

func Handler(b *bridge.Bridge, g SSH, a *api.Auth, log *slog.Logger, opts ...Option) http.Handler

Handler returns the MCP endpoint, guarded by bearer credentials: a token, or an OAuth access token a person allowed a client to hold (package oauth). A request without one, or with one that does not verify, gets a 401 whose WWW-Authenticate names the protected resource metadata (RFC 9728), so that an MCP client can sign in through the browser.

func New

func New(b *bridge.Bridge, g SSH, opts ...Option) *mcp.Server

New builds the MCP server with its tools.

Types

type Option

type Option func(*options)

Option changes what the server offers.

func WithMe

func WithMe(fn func(store.Principal) api.Me) Option

WithMe gives whoami the view GET /api/v1/me gives (api.Server.MeOf).

func WithMonitors

func WithMonitors(m *monitors.Service) Option

WithMonitors adds the monitor tools, which read and change the monitors Beacon holds.

func WithResourceMetadata

func WithResourceMetadata(url func(*http.Request) string) Option

WithResourceMetadata names, for a request, the protected resource metadata (RFC 9728) that a 401 points to, so that an MCP client can find where to sign in (package oauth).

func WithVault

func WithVault(v *vault.Service, configured bool) Option

WithVault offers the vault's agent tools; configured with a nil vault, they answer that it is unavailable.

type SSH

type SSH struct {
	Gate    *sshgate.Gate
	Address string
}

SSH is the SSH channel behind the machine tools (Gate nil: off), and where agents reach it with their own ssh (host:port, for the ssh configuration list_machines returns).

Jump to

Keyboard shortcuts

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