internal

package
v0.0.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForwardingRoundTripper

func NewForwardingRoundTripper(base http.RoundTripper) http.RoundTripper

NewForwardingRoundTripper constructs a RoundTripper that forwards headers to the underlying transport. When base is nil, http.DefaultTransport is used.

func NewStaticHeadersRoundTripper

func NewStaticHeadersRoundTripper(base http.RoundTripper, serverURL *url.URL, extraHeaders, discoveryExtraHeaders map[string]string) http.RoundTripper

NewStaticHeadersRoundTripper constructs a scoped static-header round tripper.

Types

type ForwardingRoundTripper

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

ForwardingRoundTripper decorates the base RoundTripper so it can read request headers from the context and capture the response headers for later use.

func (*ForwardingRoundTripper) RoundTrip

func (f *ForwardingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip injects headers before issuing the request and records the response headers after the call returns.

type HeaderCarrier

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

HeaderCarrier stores per-request headers that should be forwarded to the MCP server as well as the response headers returned by the transport.

func CarrierFromContext

func CarrierFromContext(ctx context.Context) *HeaderCarrier

CarrierFromContext extracts the header carrier embedded in the context, if present.

func ContextWithHeaders

func ContextWithHeaders(ctx context.Context, headers http.Header) (context.Context, *HeaderCarrier, error)

ContextWithHeaders returns a context that carries the provided headers so the forwarding RoundTripper can inject them into the outbound HTTP request. A carrier instance is returned so callers can inspect the response headers once the request completes.

func (*HeaderCarrier) ApplyRequestHeaders

func (c *HeaderCarrier) ApplyRequestHeaders(dst http.Header)

ApplyRequestHeaders injects the stored request headers into the outgoing HTTP request, overriding any existing values for the same header names.

func (*HeaderCarrier) RequestHeaders

func (c *HeaderCarrier) RequestHeaders() http.Header

RequestHeaders returns the headers that will be forwarded with the request.

func (*HeaderCarrier) ResponseStatusAndHeaders

func (c *HeaderCarrier) ResponseStatusAndHeaders() (int, http.Header)

ResponseStatusAndHeaders returns the captured HTTP status code together with a defensive copy of the response headers.

func (*HeaderCarrier) StoreResponse

func (c *HeaderCarrier) StoreResponse(statusCode int, headers http.Header)

StoreResponse records the HTTP status code and a defensive copy of the response headers so they can be returned to the caller once the request completes.

type StaticHeadersRoundTripper

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

StaticHeadersRoundTripper adds operator-configured MCP headers only for the configured MCP server origin. Discovery headers are additionally gated by a request context marker so they do not leak to normal runtime traffic.

func (*StaticHeadersRoundTripper) RoundTrip

func (s *StaticHeadersRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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