mcpserver

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package mcpserver is the MCP adapter for search, describe, and invoke.

Index

Constants

View Source
const (
	// CallerHeader is the credential of the process calling veto.
	// The value identifies that caller. It is not an upstream API token.
	CallerHeader = "Veto-Caller"

	// DefaultAddr is the listen address for serve --http.
	DefaultAddr = "127.0.0.1:7433"
)
View Source
const Instructions = "Search, then describe, then invoke. A delete waits until confirmation is stored."

Instructions is the procedure a host gives the model on connect.

Variables

View Source
var Version = "dev"

Version is the MCP server build. A release sets it with -X.

Functions

func Handler

func Handler(srv *capability.Server, opt Options, ids []Identity) (http.Handler, error)

Handler is the Streamable HTTP MCP endpoint. A request without a known caller credential is rejected first.

func Listen

func Listen(ctx context.Context, addr string, h http.Handler) (string, error)

Listen serves h and returns the bound address. The server stops when ctx is done.

func RegisterTools

func RegisterTools(cat *catalog.Catalog, opt Options) []string

func RunStdio

func RunStdio(ctx context.Context, srv *capability.Server, opt Options) error

func Serve

func Serve(ctx context.Context, addr string, h http.Handler) error

Serve listens on addr until ctx is done. An empty addr uses DefaultAddr.

func ToolNames

func ToolNames(cat *catalog.Catalog, pins []string, directPins, grouped bool) []string

Grouped mode adds one tool per resource, never one tool per operation.

func ValidatePins

func ValidatePins(cat *catalog.Catalog, pins []string) error

func ValidateRegistration added in v0.1.6

func ValidateRegistration(cat *catalog.Catalog, opt Options) error

ValidateRegistration rejects unknown pins and colliding tool names.

Types

type Identity

type Identity struct {
	ID    string
	Token string
}

Identity is one caller of the HTTP server. Token is the credential. ID is the name stored with an approval.

func Identities

func Identities(names map[string]string, getenv func(string) string) ([]Identity, error)

Identities reads caller credentials from the environment variables named in names. names maps a caller id to an environment variable. The credential values are not returned in errors.

type Options

type Options struct {
	Pins       []string
	DirectPins bool
	Grouped    bool
	// ChatApproval lets an elicitation answer approve a held call. RunStdio turns it on.
	ChatApproval bool
}

Jump to

Keyboard shortcuts

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