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 ¶
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 ¶
Server answers one client.
func (Server) Serve ¶
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.