httpapi

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const PublicMount = "/s/"

PublicMount is the URL prefix of the public routes.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(version string, opts Options) http.Handler

NewRouter returns the root HTTP handler.

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.
	Shares    *share.Store
	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
	// Shares, when set, mounts the public /s/{token} routes. This is the one
	// 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.

Jump to

Keyboard shortcuts

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