remotemcp

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package remotemcp serves the AerolVM MCP tools over Streamable HTTP at /mcp on sandboxd (plans/mcp-server-and-agent-cli.md §5.7, Phase 2b). It is off unless SB_MCP_ENABLED=true, authenticates with the API's bearer token, and is pinned-only: every request names one sandbox in ?sandbox=.

The endpoint is stateless (no Mcp-Session-Id), so any node can serve any request behind any load balancer and nothing touches cluster state. Each request builds an agentmcp server whose tools reach the API in-process with the caller's own token (see inProcessTransport).

Index

Constants

View Source
const Path = "/mcp"

Path is where the endpoint is mounted: not under /v1, because MCP versions itself.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AllowedOrigins lists browser origins that may call /mcp. A request
	// with any other Origin is refused (DNS rebinding); MCP clients that
	// aren't browsers send no Origin and are unaffected.
	AllowedOrigins []string
	// AllowedHosts, when set, lists the Host values /mcp answers to.
	AllowedHosts []string
	// RateLimit is the per-token request rate (req/s); the burst is twice
	// that. Zero disables the limit.
	RateLimit float64
	Version   string
	Logger    *slog.Logger
}

Config configures the endpoint.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is the /mcp endpoint.

func New

func New(cfg Config, api func() http.Handler) *Handler

New builds the endpoint. api returns sandboxd's root API handler; it is a func because /mcp is mounted on that same handler.

func (*Handler) Wrap

func (h *Handler) Wrap(auth func(http.Handler) http.Handler) http.Handler

Wrap returns the endpoint wrapped around the API's auth middleware, in order: Origin/Host check (before auth, so a rebinding page learns nothing), bearer auth, per-token rate limit, query options, then MCP.

Jump to

Keyboard shortcuts

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