proxy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package proxy runs an MCP stdio proxy for SigV4-protected AWS MCP servers.

The public entry point is Run. Callers provide a Config describing the upstream MCP endpoint and optional RunOptions for embedding concerns such as logging, custom MCP transports, a shared HTTP client, or a replacement upstream connector for tests.

A minimal embedded proxy run looks like:

err := proxy.Run(ctx, proxy.Config{
	Endpoint: new("https://service.us-east-1.api.aws/mcp"),
	Region:   new("us-east-1"),
	Service:  new("service"),
}, proxy.RunOptions{
	Logger: logger,
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config, options RunOptions) error

Run starts the proxy and blocks until the MCP server transport exits or the context is canceled.

Types

type Config

type Config struct {
	Endpoint *string
	Service  *string
	Profiles *[]string
	Region   *string
	CaBundle *string
	Metadata *map[string]string

	ReadOnly *bool
	LogLevel *string
	Retries  *int

	Timeout        *time.Duration
	ConnectTimeout *time.Duration
	ReadTimeout    *time.Duration
	WriteTimeout   *time.Duration
	ToolTimeout    *time.Duration

	DisableTelemetry *bool
	SkipAuth         *bool
}

Config describes a proxy run.

type RunOptions

type RunOptions struct {
	// Connector replaces the default Streamable HTTP upstream connector.
	Connector UpstreamConnector
	// HTTPClient is used by the default upstream connector.
	HTTPClient *http.Client
	// Logger receives proxy and request logs.
	Logger *slog.Logger
	// Transport is the MCP server transport. It defaults to stdio.
	Transport mcp.Transport
	// Version is reported in MCP implementation metadata and user-agent data.
	Version string
	// contains filtered or unexported fields
}

RunOptions configures embedding and test seams for Run.

type UpstreamConnector

type UpstreamConnector interface {
	Connect(context.Context, Config, *mcp.InitializeParams) (UpstreamSession, error)
}

UpstreamConnector opens an MCP client session to the configured upstream.

type UpstreamSession

type UpstreamSession interface {
	CallTool(context.Context, *mcp.CallToolParams) (*mcp.CallToolResult, error)
	Close() error
	InitializeResult() *mcp.InitializeResult
	ListTools(context.Context, *mcp.ListToolsParams) (*mcp.ListToolsResult, error)
}

UpstreamSession is the upstream MCP session behavior used by the proxy.

Jump to

Keyboard shortcuts

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