Documentation
¶
Overview ¶
Package mcp serves graphmaster's query tools over the Model Context Protocol (stdio in production, any transport in tests).
Every tool of internal/query is registered with a typed input (mcp.AddTool[In, any]) so the client sees a JSON schema with field descriptions. A call routes absolute path arguments to the repository that contains them, opens (once) and freshens that repository's index through query.Engine, and returns the tool's plain text as a single TextContent block. Failures become tool errors ("isError") with a banner-style text; the server never crashes on a tool call.
Index ¶
Constants ¶
const ServerName = "graphmaster"
ServerName is the MCP implementation name agents register.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Dir is the start directory; its repository answers calls that do not
// name a path elsewhere. Default: the process working directory.
Dir string
// NewResolver creates the name resolver for each opened index.
// Default: internal/resolve.
NewResolver func() index.Resolver
// FreshenBudget bounds the wait for the write lock before a tool
// answers from the current graph (default query.DefaultFreshenBudget).
FreshenBudget time.Duration
// Logf receives indexer diagnostics; default discards. It must not
// write to stdout, which carries the protocol.
Logf func(format string, args ...any)
}
Options configure a Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is graphmaster's MCP server. It keeps one index per repository it has answered for; Close releases them.
func New ¶
New builds a server with every query tool registered. It does not open any index yet: the first tool call does, so a server started outside a repository still lists its tools and explains the problem per call.