server

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 22 Imported by: 1 module, 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

View Source
const LatestProtocolVersion = "2025-06-18"

LatestProtocolVersion is the MCP revision this server prefers when a client asks for one it does not know.

Variables

This section is empty.

Functions

func Instructions added in v1.9.0

func Instructions() string

Instructions returns the server instructions sent during initialize.

func RefreshLatestVersion added in v1.10.0

func RefreshLatestVersion(ctx context.Context)

RefreshLatestVersion runs the CLI's update check in the background, so the next session's notice is current. Without it, someone who only uses the CLI through an assistant never gets one: the terminal check skips agents and never runs under `mcp serve`. It writes only the state file, never stdout, which carries the JSON-RPC stream. The check is due at most daily; if the process exits first, the check recorded the attempt and retries an hour later.

Types

type JSONRPCError

type JSONRPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

type JSONRPCRequest

type JSONRPCRequest = middleware.JSONRPCRequest

JSON-RPC 2.0 structures

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      interface{}   `json:"id,omitempty"`
	Result  interface{}   `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
}

type MCPServer

type MCPServer struct {
	// contains filtered or unexported fields
}

MCP Server

func NewMCPServer

func NewMCPServer(config MCPServerConfig, client client.Client) *MCPServer

Create new MCP server

func (*MCPServer) Done added in v1.9.0

func (s *MCPServer) Done() <-chan struct{}

Done is closed once the server stops handling messages, which happens when the client closes the input stream. Callers wait on it so that a disconnected client ends the process instead of leaving it running with nothing to read.

func (*MCPServer) IsRunning

func (s *MCPServer) IsRunning() bool

Check if server is running

func (*MCPServer) Start

func (s *MCPServer) Start() error

Start the MCP server

func (*MCPServer) Stop

func (s *MCPServer) Stop() error

Stop the MCP server

type MCPServerConfig

type MCPServerConfig struct {
	Transport    string `yaml:"transport" mapstructure:"transport"`
	Port         int    `yaml:"port" mapstructure:"port"`
	AuditLogging bool   `yaml:"audit_logging" mapstructure:"audit_logging"`

	// AllowExec lets exec_service run commands inside a customer's containers.
	// Off by default: it is the one tool here that executes arbitrary code in a
	// running environment, so it is the operator's call, not the assistant's.
	AllowExec bool `yaml:"allow_exec" mapstructure:"allow_exec"`

	// LatestVersion is the newest release the CLI's update check has cached,
	// if any. Never read from or written to the config file.
	LatestVersion string `yaml:"-" mapstructure:"-"`
}

MCP Server configuration

func LoadMCPServerConfig

func LoadMCPServerConfig() MCPServerConfig

Load configuration from Viper

Jump to

Keyboard shortcuts

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