mcpsource

package
v1.5.3 Latest Latest
Warning

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

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

Documentation

Overview

Package mcpsource defines the MCPSource interface and registry for host-pluggable MCP server provisioning. An MCPSource is responsible for standing up an MCP endpoint (starting a container, reaching into a remote service, etc.) and returning its URL + Headers. Arena opens sources at scope boundaries (run / scenario / session) and feeds the result into the existing runtime/mcp registry via its URL/Headers fields.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListMCPSources

func ListMCPSources() []string

ListMCPSources returns the names of every registered source, sorted. Used for "unknown source" error messages.

func RegisterMCPSource

func RegisterMCPSource(name string, src MCPSource)

RegisterMCPSource adds a named source implementation. Called from init() blocks in source packages (e.g., mcpsource/docker). Panics on duplicate registration to surface programmer errors at startup.

Types

type MCPConn

type MCPConn struct {
	URL     string
	Headers map[string]string
	// ContainerID is the backing container's ID when the source runs one (e.g.
	// the docker source); empty for non-container backends. Surfaced into
	// SessionEvent metadata so session hooks can reach the sandbox (e.g. a
	// workspace-capture hook running `docker cp`).
	ContainerID string
}

MCPConn carries the coordinates arena needs to construct an mcp.Client. Fed into mcp.ServerConfig{URL, Headers} in the existing code path.

type MCPSource

type MCPSource interface {
	Open(ctx context.Context, args map[string]any) (MCPConn, io.Closer, error)
}

MCPSource opens an MCP endpoint with caller-supplied args.

Implementations validate their own args schema; arena treats args as opaque and only expands scenario template variables before calling Open.

The returned io.Closer is called exactly once when the scope ends. A source that needs no teardown returns io.NopCloser(nil).

func LookupMCPSource

func LookupMCPSource(name string) (MCPSource, bool)

LookupMCPSource returns the source registered under name, if any.

type Scope

type Scope string

Scope is the lifecycle boundary at which a source is opened and closed.

const (
	ScopeRun      Scope = "run"
	ScopeScenario Scope = "scenario"
	ScopeSession  Scope = "session"
)

Known scope values. ScopeRun opens once per arena run; ScopeScenario once per scenario; ScopeSession once per session (repetition) within a scenario.

func ParseScope

func ParseScope(raw string) (Scope, error)

ParseScope converts a YAML string to a Scope, erroring on unknown values.

func (Scope) Valid

func (s Scope) Valid() bool

Valid reports whether s is one of the known scope values.

Directories

Path Synopsis
Package docker implements an MCPSource that provisions MCP servers in Docker containers.
Package docker implements an MCPSource that provisions MCP servers in Docker containers.
register
Package register wires the Docker MCPSource into the global registry via a blank import.
Package register wires the Docker MCPSource into the global registry via a blank import.

Jump to

Keyboard shortcuts

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