mcp

package
v2.10.1 Latest Latest
Warning

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

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

Documentation

Overview

Package mcp is the MCP front door (docs/adr/0016): agents read, draft and propose through the same engine as people, with their person's authority and no more. Like the HTTP API and the sync socket, it is a driving adapter; it decides nothing the engine does not.

It is stateless: every request stands alone (MCP's sessionless transport), so it holds nothing open and a deployment still scales to zero (docs/adr/0015).

Index

Constants

View Source
const SubagentMeta = "cartograph/subagent"

SubagentMeta is the _meta key a client names a sub-agent by.

Variables

This section is empty.

Functions

func Handler

func Handler(o Options) http.Handler

Handler serves MCP over HTTP, sessionless. The principal is the one the authentication middleware put on the request: the person the agent acts for.

func ProductName added in v2.6.0

func ProductName(ua string) string

ProductName is a User-Agent's first product as a person reads it: claude-code/2.1 is Claude Code. Empty for a browser or a library.

func ServeStdio

func ServeStdio(ctx context.Context, o Options) error

ServeStdio serves MCP over stdin and stdout, for an agent on the operator's own machine: anonymous, as the command line is, and held to the same ceiling.

Types

type Options

type Options struct {
	Engine *engine.Engine
	// Authz decides whether a principal may act through an agent at all
	// (auth.ResourceAgent); nil allows it.
	Authz    auth.Authorizer
	Reports  reporting.Reporter
	Presence Presence
	Version  string
	// Trace records every tool call by its shape (docs/adr/0028); nil
	// records none.
	Trace trace.Recorder
}

Options are what the MCP server works through.

type Presence

type Presence interface {
	AnnounceAgent(ctx context.Context, docID, actor, name, focus string, agent map[string]any)
}

Presence announces an agent on a document, so the people on it see it working. The sync socket implements it; nil announces nothing.

Jump to

Keyboard shortcuts

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