Documentation
¶
Overview ¶
Package mcp exposes the operations of a registry that set MCP: true as MCP tools, over stdio or streamable HTTP.
A tool's name is the operation name with dots replaced by underscores, its input schema is the registry's wire schema (including apply and confirm), and its annotations follow the effect. Every call goes through the same op.Entry.CallJSON path as HTTP, so validation, the apply and confirm rules and authorization are identical. A failed call is an isError result whose text is {"error": {code, message, suggestions}}.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler serves MCP over streamable HTTP, stateless with JSON responses, so it works behind a plain reverse proxy.
func NewServer ¶
NewServer returns an MCP server with one tool per MCP operation. httpReq is the inbound HTTP request for authorizers, or nil for local transports. A nil auth means op.DenyWrites.
func ServeStdio ¶
ServeStdio serves MCP on stdin and stdout until the client disconnects or ctx is done.
Types ¶
type Options ¶
type Options struct {
// Authorizer decides whether a caller may run an operation. Nil means the
// transport default: op.AllowAll for stdio, whose caller already runs the
// binary as the user, and op.DenyWrites for HTTP.
Authorizer op.Authorizer
}
Options configures the MCP surface.