adapter

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 26 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(server *mcp.Server, document *openapi.Document, client *HTTPClient, options Options) error

Types

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(options Options) *HTTPClient

func (*HTTPClient) Call

func (c *HTTPClient) Call(ctx context.Context, view openapi.OperationView, input map[string]any) (any, error)

type Options

type Options struct {
	// BaseURL overrides servers[0].url from the OpenAPI document.
	BaseURL string
	// BearerToken is sent to upstream API operations that require bearer auth.
	BearerToken string
	// APIKeyName, APIKeyValue, and APIKeyIn configure upstream API key auth.
	APIKeyName  string
	APIKeyValue string
	APIKeyIn    string
	// BasicUsername and BasicPassword configure upstream HTTP Basic auth.
	BasicUsername string
	BasicPassword string
	// OAuth2 fields configure the client credentials flow for upstream calls.
	OAuth2ClientID     string
	OAuth2ClientSecret string
	OAuth2TokenURL     string
	OAuth2Scopes       []string
	OAuth2TokenSource  oauth2.TokenSource
	// Timeout bounds one upstream operation, including retries.
	Timeout time.Duration
	// MaxResponseBytes limits an upstream response body. Zero uses 10 MiB.
	MaxResponseBytes int64
	// MaxRetries controls retries after the initial upstream request.
	MaxRetries int
	// RetryBaseDelay is the initial exponential backoff delay.
	RetryBaseDelay time.Duration
	// MaxRetryAfter caps an upstream Retry-After value. Zero uses 30 seconds.
	MaxRetryAfter time.Duration
	// RetryNonIdempotent permits retries for methods such as POST and PATCH.
	RetryNonIdempotent bool
	// Allow and Deny filter the generated MCP tool names.
	Allow []string
	Deny  []string
	// HTTPClient is used for upstream calls. Nil creates an isolated client.
	HTTPClient *http.Client

	// MCPMaxRequestBodyBytes limits incoming Streamable HTTP request bodies.
	// Zero uses the MCP SDK default of 4 MiB.
	MCPMaxRequestBodyBytes int64
	// MCPMaxConcurrentRequests limits in-flight Streamable HTTP requests.
	// Zero uses 64.
	MCPMaxConcurrentRequests int
	// MCPTrustedOrigins permits additional browser origins for Streamable HTTP.
	MCPTrustedOrigins []string
	// AllowNonLoopbackHTTP permits RunHTTP to listen beyond localhost. The
	// caller must place an authenticating reverse proxy in front of the server.
	AllowNonLoopbackHTTP bool
}

Options configures upstream API execution and the optional MCP HTTP transport.

Jump to

Keyboard shortcuts

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