mcpserver

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 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 exposes the application's connections to an external agent over MCP.

It is a sibling of internal/bridge, not a layer on top of it. Both adapt the same *app.Services to a caller that cannot call Go directly; the bridge reshapes for the renderer, and this reshapes for a caller that has no screen and has to be told what an operation costs.

How far it goes is decided when it is started, not here and not in the application's settings. An allowance is a ceiling on the blast radius the catalogue gives each operation: read by default, higher on the connections the person starting it named. Nothing above the widest is offered at all - a tool that is not in the list cannot be called by a model that has not been told about it, which is a stronger guarantee than one that refuses at call time. A tool within it is still refused on a connection whose own ceiling is lower, before anything is dialled.

It never writes the profile store. The window owns that file and rewrites it whole, so a second process that stamped a status onto it would be racing the user's own edits - see connection.Service.OpenReadOnly.

Index

Constants

View Source
const Name = "mq-studio"

Name is what the server calls itself in the initialize handshake.

Variables

This section is empty.

Functions

func New

func New(
	services *app.Services, version string, grants Grants, translate func(string) string,
) *mcp.Server

New builds the MCP server offering every tool some connection may use.

An unrecognised ceiling offers nothing above reading, because catalog.Permits refuses what it does not know: a typo in a flag must not widen anything.

Types

type Allowance

type Allowance struct {
	// Everywhere is the ceiling on every connection, read unless raised.
	Everywhere catalog.Blast
	// Named raises it on connections named as the window shows them.
	Named map[string]catalog.Blast
}

* Allowance is how far a server may go, as its command line put it: a ceiling * on every connection, and a higher one on the connections it names. * * One ceiling was too coarse for the case it matters most in. Emptying a * scratch queue took --allow destructive, and that let the same session empty * every queue on every other connection as well - production included, since * nothing in a profile says which cluster that is. Naming the connection is * the person starting the server saying which one they meant.

func ParseAllowance

func ParseAllowance(values []string) (Allowance, error)

ParseAllowance reads every --allow value, in the order given.

A bare tier is the ceiling on every connection, and says so once. A connection's name, an equals sign and a tier raises the ceiling on that connection alone. The name is everything before the last equals sign: a tier never contains one, and a name the window accepted might.

func (Allowance) Grant

func (a Allowance) Grant(stored []*model.ConnectionProfile) (Grants, error)

* Grant pins an allowance to the connections stored now. * * A name is resolved here, once, into the connection it named when the server * started - the one the person starting it was looking at. A connection saved * later under the same name is not covered by it, and one later pointed at * another broker stops being covered; a name looked up again on every call * could tell neither of those from a new remark. * * Every name has to resolve, to exactly one connection, and to more than every * connection already has. A name that does not is a command line that cannot * mean what it says, so every such name is reported at once and nothing is * served.

type Grants

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

Grants is an allowance pinned to the connections stored when the server started. The zero value grants nothing, reading included.

func (Grants) String

func (g Grants) String() string

String says how far the server goes, for the line it writes on stderr.

Jump to

Keyboard shortcuts

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