Documentation
¶
Overview ¶
Package httpapi provides the HTTP surface of vellum: health endpoint, the /mcp mount, and later the JSON REST API for the SPA (/api/*).
Index ¶
Constants ¶
const PublicMount = "/s/"
PublicMount is the URL prefix of the public routes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶ added in v0.2.0
type API struct {
Vault *vault.Vault
Index *vault.Index
Searcher vault.Searcher
Structure vault.Structure
// Activity records sessions and events for the Connections/Activity
// panels. Endpoint is the public MCP URL shown in those panels; Curator
// reflects whether the curator tools are enabled. All optional.
Activity *activity.Recorder
Endpoint string
Curator bool
// Revoker cuts off the OAuth client behind a connection. Nil when auth
// is off: connections are then keyed by address and hold no token.
Revoker ConnectionRevoker
// Shares, when set, enables the /api/shares endpoints. Sharing is the
// configured mode ("ui" or "on") reported to the workspace, and
// PublicURL is the origin share links are built on.
Sharing string
PublicURL string
}
API is the JSON REST surface for the SPA, mirroring vault operations.
type ConnectionRevoker ¶ added in v1.13.0
type ConnectionRevoker interface {
// RevokeClient drops all tokens of a client and reports how many.
RevokeClient(clientID string) int
// IsSecretClient reports whether the client holds the client secret,
// and so can get a new token whenever it likes.
IsSecretClient(clientID string) bool
}
ConnectionRevoker revokes the OAuth grant behind a connection (implemented by *auth.Provider).
type Options ¶ added in v0.1.0
type Options struct {
// MCPHandler, when set, is mounted at /mcp behind the origin check.
MCPHandler http.Handler
// API, when set, mounts the JSON REST surface under /api/*.
API *API
// SPA, when set, serves static files with an index.html fallback for
// anything that is not /api/*, /mcp or an OAuth route (PHY-116 supplies
// the embedded dist).
SPA fs.FS
// AllowedOrigins are the browser origins allowed to call /mcp and
// /api. Same-origin requests and requests without an Origin header
// (CLI clients) always pass.
AllowedOrigins []string
// Auth, when set, mounts the OAuth endpoints and guards /mcp + /api
// with bearer verification. Nil = auth disabled, everything open.
Auth *auth.Provider
// CORSOrigins get CORS response headers (browser clients).
CORSOrigins []string
// Activity, when set, records MCP sessions and tool calls hitting /mcp.
Activity *activity.Recorder
// part of vellum that answers without a bearer token, so it exists only
// when the operator asked for it (VELLUM_SHARING).
Shares *share.Store
// Vault backs the public share routes; required alongside Shares.
Vault *vault.Vault
// TrustProxy makes the share rate limiter read X-Forwarded-For.
TrustProxy bool
}
Options configure the router.