config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 12 Imported by: ? 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 config loads the MCP server configuration and token store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brain

type Brain struct {
	Graph     string `json:"graph"`
	Backend   string `json:"backend"`
	Sensitive bool   `json:"sensitive"`
}

Brain maps a logical brain name to the graph that stores it and the kb-query backend that can reach that graph. A family entry, keyed "client-*" with graph "brain-client-*", serves every "client-<suffix>" brain from graph "brain-client-<suffix>", so a new sub-project needs no config.

type Config

type Config struct {
	// Listen must be a VPN-only address; the server is never exposed publicly.
	Listen     string           `json:"listen"`
	TokensFile string           `json:"tokens_file"`
	Brains     map[string]Brain `json:"brains"`
	// DefaultBudget is the token budget for get_context when the caller sets none.
	DefaultBudget int `json:"default_budget"`
}

Config is the server configuration file.

func Load

func Load(path string) (*Config, error)

Load reads and validates a config file.

func (*Config) Lookup

func (c *Config) Lookup(name string) (Brain, bool)

Lookup returns the brain for a concrete name, resolving family members to their own graph. Unknown names and patterns are not found.

func (*Config) Sensitive

func (c *Config) Sensitive(brain string) bool

Sensitive reports whether a brain may only be read when named explicitly. Unknown brains count as sensitive, so they are never part of a default scope.

type Token

type Token struct {
	ID      string    `json:"id"`
	SHA256  string    `json:"sha256"`
	Brains  []string  `json:"brains"`
	Expires time.Time `json:"expires"`
}

Token is one entry in the token store. Only the SHA-256 of the secret is stored.

type Tokens

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

Tokens is a loaded token store.

func LoadTokens

func LoadTokens(path string, cfg *Config) (*Tokens, error)

LoadTokens reads the token store and checks every granted brain exists.

func (*Tokens) Verifier

func (t *Tokens) Verifier() auth.TokenVerifier

Verifier returns a bearer-token verifier for the MCP auth middleware. TokenInfo.Scopes carries the granted brains; UserID carries the token id.

Jump to

Keyboard shortcuts

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