Documentation
¶
Overview ¶
Package server exposes the knowledge base as narrow, typed MCP tools. Agents never send Cypher and never name a graph; scope comes from the bearer token plus the X-Ki-Brains header ki sets from projects.yaml. decisions_for and search may narrow that scope with a brains argument; the argument cannot widen it.
Index ¶
- Constants
- func MetricsHandler() http.Handler
- func New(cfg *config.Config, reader kb.Reader, log *slog.Logger, version string) *mcp.Server
- type ActivityInput
- type ActivityOutput
- type BrainInfo
- type BrainsOutput
- type DecisionsInput
- type GetContextInput
- type GraphInput
- type GraphOutput
- type RecentInput
- type RecentOutput
- type SearchHit
- type SearchInput
- type SearchOutput
- type Server
Constants ¶
const BrainsHeader = "X-Ki-Brains"
BrainsHeader carries the session's brains, set by ki from projects.yaml.
Variables ¶
This section is empty.
Functions ¶
func MetricsHandler ¶
MetricsHandler serves the registry. Mount it on a path the ingress does not expose; it carries no secrets but is for the cluster's Prometheus.
Types ¶
type ActivityInput ¶
type ActivityInput struct {
Since string `json:"since" jsonschema:"RFC 3339 time; documents ingested before it are left out"`
Brains []string `` /* 151-byte string literal not displayed */
}
ActivityInput is the activity tool input.
type ActivityOutput ¶
type ActivityOutput struct {
Brains map[string][]kb.ActivityDay `json:"brains"`
}
ActivityOutput is activity's structured result: per brain, one row per day that ingested documents.
type BrainInfo ¶
type BrainInfo struct {
Name string `json:"name"`
Documents int `json:"documents"`
LastIngest *time.Time `json:"last_ingest,omitempty"`
}
BrainInfo is one brain in brains' structured result.
type BrainsOutput ¶
type BrainsOutput struct {
Brains []BrainInfo `json:"brains"`
}
BrainsOutput is brains' structured result, sorted by name.
type DecisionsInput ¶
type DecisionsInput struct {
Component string `json:"component" jsonschema:"service, package or component name"`
Brains []string `` /* 150-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"maximum facts from each brain, default 30"`
}
DecisionsInput is the decisions_for tool input.
type GetContextInput ¶
type GetContextInput struct {
Task string `json:"task" jsonschema:"what the agent is about to do"`
Budget int `json:"budget,omitempty" jsonschema:"token budget for the pack, default 3000"`
}
GetContextInput is the get_context tool input.
type GraphInput ¶
type GraphInput struct {
Brain string `json:"brain" jsonschema:"the one brain to read; it must be in the resolved scope"`
Query string `json:"query,omitempty" jsonschema:"find the facts that match this text and the entities they link; give this or node"`
Node string `json:"node,omitempty" jsonschema:"uuid of an entity of the brain: its facts and the entities they link; give this or query"`
Limit int `json:"limit,omitempty" jsonschema:"maximum edges, 1 to 60; default 30"`
}
GraphInput is the graph tool input.
type RecentInput ¶
type RecentInput struct {
Since string `json:"since,omitempty" jsonschema:"RFC 3339 time; documents committed before it are left out"`
Limit int `json:"limit,omitempty" jsonschema:"max documents, default 20"`
Brains []string `` /* 151-byte string literal not displayed */
}
RecentInput is the recent tool input.
type RecentOutput ¶
RecentOutput is recent's structured result, newest first.
type SearchHit ¶
type SearchHit struct {
Brain string `json:"brain"`
Kind string `json:"kind"`
Fact string `json:"fact"`
Source string `json:"source,omitempty"`
Score float64 `json:"score"`
Superseded bool `json:"superseded"`
}
SearchHit is one ranked fact in search's structured result.
type SearchInput ¶
type SearchInput struct {
Query string `json:"query"`
Limit int `json:"limit,omitempty" jsonschema:"max facts, default 15"`
Brains []string `` /* 150-byte string literal not displayed */
}
SearchInput is the search tool input.
type SearchOutput ¶
type SearchOutput struct {
Hits []SearchHit `json:"hits"`
}
SearchOutput is search's structured result; the text content carries the same facts.