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