server

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 15 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 owns the MCP plumbing shared by every tool: the registry, argument decoding, result and error conversion, annotations, the per-call log line and the warnings logged once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(args json.RawMessage, v any) error

Decode reads tool arguments into v, refusing unknown fields. Missing or null arguments read as {}.

Types

type Registry

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

Registry holds the MCP server and the tools that the enabled groups let through.

func New

func New(cfg *config.Config, d *db.DB, version string) *Registry

New builds the MCP server (name, version, instructions) and an empty registry.

func (*Registry) Add

func (r *Registry) Add(t Tool)

Add registers t unless its group is disabled by --tools. It panics on a programming error: empty title, duplicate name, or an array in the input schema without items.

func (*Registry) Config

func (r *Registry) Config() *config.Config

Config returns the process configuration.

func (*Registry) DB

func (r *Registry) DB() *db.DB

DB returns the database handle shared by the tools.

func (*Registry) MCP

func (r *Registry) MCP() *mcp.Server

MCP returns the MCP server that transports serve.

func (*Registry) Warn

func (r *Registry) Warn(line string)

Warn writes line to stderr, once per distinct text for the process lifetime.

type Tool

type Tool struct {
	Group   string    // schema|query|explain|stats|health|index|locks
	Def     *mcp.Tool // Name, Description, InputSchema; Annotations are set by Add
	Title   string    // required; the annotation title
	Writes  bool      // true only for execute_sql in unrestricted mode
	Handler func(ctx context.Context, args json.RawMessage) (string, error)
}

Tool is one MCP tool, registered with Registry.Add.

Jump to

Keyboard shortcuts

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