FastestMCP.Providers.Proxy (fastest_mcp v0.3.0)

Copy Markdown View Source

Request-scoped proxy provider for a remote MCP server.

A proxy opens one FastestMCP.Client for each frontend operation, reuses it while that operation resolves and invokes components, and disconnects it when the request context exits. It intentionally does not pool clients or proxy remote tasks, subscriptions, notifications, roots, or callback requests.

protocol_version: :mirror follows the frontend request profile. An exact supported protocol version may be selected instead; :auto is rejected so a proxy never changes protocol profiles based on an upstream failure.

Incoming authorization is not forwarded by default. Enabling forward_authorization: true is limited to HTTP requests and requires the upstream endpoint's exact origin in trusted_origins:.

Proxy providers cannot be combined with bounded ToolSearch. Upstream MCP cursors have opaque ordering, so a proxy cannot provide both a bounded scan and a global proof that the synthetic tool names do not collide. Server construction rejects that unsafe composition before opening an upstream connection.

Summary

Functions

Resolves a remote resource or resource template for one concrete URI.

Lists remote components through the request-scoped upstream client.

Builds a request-scoped proxy provider.

Returns the provider type label.

Types

protocol_version()

@type protocol_version() :: :mirror | String.t()

t()

@type t() :: %FastestMCP.Providers.Proxy{
  client_opts: keyword(),
  forward_authorization: boolean(),
  instance_id: reference(),
  max_items: pos_integer(),
  max_pages: pos_integer(),
  protocol_version: protocol_version(),
  target:
    String.t() | {:stdio, String.t()} | {:stdio, String.t(), [String.t()]},
  target_origin: String.t() | nil,
  target_type: :http | :stdio,
  trusted_origins: MapSet.t(String.t())
}

Functions

get_resource_target_candidates(proxy, uri, operation)

Resolves a remote resource or resource template for one concrete URI.

list_components(proxy, component_type, operation)

Lists remote components through the request-scoped upstream client.

new(target, opts \\ [])

Builds a request-scoped proxy provider.

provider_type(proxy)

Returns the provider type label.