server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 19 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 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

View Source
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

func MetricsHandler() http.Handler

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.

func New

func New(cfg *config.Config, reader kb.Reader, log *slog.Logger, version string) *mcp.Server

New builds the MCP server with all tools registered.

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 GraphOutput

type GraphOutput = kb.Graph

GraphOutput is graph's structured result.

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

type RecentOutput struct {
	Documents []kb.Document `json:"documents"`
}

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.

type Server

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

Server holds what the tool handlers need.

Jump to

Keyboard shortcuts

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