mcp

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mcp exposes Oriel's validated tool Registry as a Model Context Protocol server over stdio. Every MCP client (Claude Desktop, Claude Code, Cursor, a local Ollama-backed host) speaks the same JSON-RPC-over-stdio transport, so a single `oriel mcp` process lets any of them drive Docker and Colima through the exact same execution path the UI uses, schema-validated, entity-checked, with the same secret masking. No model ships in the binary; the model lives in the client.

Tools map one-to-one to the registry. Destructive tools carry a destructive hint and are gated by the time-boxed grant: the MCP path never sets consent, so `Registry.Execute` locks remove/prune unless a grant window is open (wired in mcp_cmd.go via SetDestructiveWindow).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, reg *tools.Registry, version string, include func(*tools.Tool) bool) error

Serve runs the MCP server over stdio until the client disconnects (EOF) or ctx is cancelled. It registers one MCP tool per registry tool that `include` admits (a nil include exposes everything), that's how `oriel mcp --read-only` and the allow/deny lists scope the surface handed to a client.

func ServeHTTP added in v0.6.0

func ServeHTTP(ctx context.Context, addr string, reg *tools.Registry, version string, include func(*tools.Tool) bool, tokenFn func() string) error

ServeHTTP serves the MCP server over Streamable HTTP at addr until ctx is cancelled. tokenFn supplies the gate token, read fresh per request, so a rotation or clear (via the UI or `oriel config auth-token`, in the other process) takes effect immediately, including revoking a leaked token without a restart. A loopback, non-proxied client is exempt; an empty token disables the gate. Remote/hosted clients connect with `Authorization: Bearer <token>`. The caller must ensure a token is set before binding a non-loopback address (see mcp_cmd.go).

Types

This section is empty.

Jump to

Keyboard shortcuts

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