mcp

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 16 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 mcp is authama's Model Context Protocol server: an AI client starts `authama mcp` and talks to it over stdio, as the protocol recommends for a local server (no port, so only the client that started it can reach it).

Its tools read only, as the API does, through the same dataset and feed: profiles, keys, hosts, which tokens are set (never a secret), the history, the event feed and doctor. Nothing here changes the home.

It is built on the official Go SDK, github.com/modelcontextprotocol/go-sdk, the owner's decision of 2026-11-12 for every Go project that serves MCP. The SDK owns the protocol: framing, JSON-RPC, initialisation and version negotiation. stdout holds nothing but its messages; anything else goes to stderr.

The tools are registered with the SDK's low-level AddTool and a written input schema, so their schemas, results and refusals are the ones clients had from the hand-written server this replaced: arguments are read as the tools always read them, not validated against the schema first.

Index

Constants

This section is empty.

Variables

View Source
var Versions = []string{"2025-11-25", "2025-06-18", "2025-03-26"}

Versions are the protocol revisions this server speaks, newest first. A client asking for one of them gets it; any other gets the newest. The SDK negotiates, limited to these.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	History(f history.Filter) ([]history.Op, error)
	Doctor() (doctor.Report, error)
}

Reader is what the tools read besides the dataset and the feed: the history and doctor, as the web UI reads them.

type Server

type Server struct {
	Home    paths.Paths
	Reads   Reader
	Version string
}

Server answers one client.

func (Server) New

func (s Server) New() *sdk.Server

New is the SDK server with authama's tools.

func (Server) Serve

func (s Server) Serve(ctx context.Context, in io.Reader, out io.Writer) error

Serve answers one client over in and out with the SDK's stdio framing (its IOTransport: one JSON-RPC message per line), until in ends or ctx is cancelled. `authama mcp` passes the process's stdin and stdout.

When in ends, the session ends only once every request already read has its answer. On its own the SDK cancels requests still in flight when its input closes, so a client that writes its requests and closes stdin, as a script piping into `authama mcp` does, would lose the last answers.

Jump to

Keyboard shortcuts

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