Configuration for an MCP server reached over Streamable HTTP.
Build one with new/1 (or AshAi.Mcp.Client.server/1) and pass it to
AshAi.Mcp.Client.connect/1. The struct holds no connection state, so it is
safe to build from stored configuration in each job or request.
Summary
Types
@type t() :: %AshAi.Mcp.Client.Server{ allowed_private_hosts: [String.t()] | :all, auth: {module(), keyword()} | nil, capabilities: map(), client_info: map() | nil, headers: [{String.t(), String.t()}] | (-> [{String.t(), String.t()}]), max_response_size: pos_integer(), name: String.t(), protocol_version: String.t() | nil, req_options: keyword(), request_timeout: pos_integer(), url: String.t() }
Functions
Builds a server configuration.
Options
:name- Required. A name for the server, unique among the servers a conversation uses: up to 32 letters and digits in runs joined by single-or_. It prefixes the server's tool names (mcp__<name>__<tool>), so changing it changes every tool name. The format keeps one server's tool names from colliding with another's.:url(String.t/0) - Required. The server's MCP endpoint, e.g.https://example.com/mcp.:allowed_private_hosts- Hosts that may resolve to loopback, private, or other non-public addresses, such as["localhost"]in development or an internal MCP server's hostname. The client connects to any other host only at public addresses, so a URL a user supplies can't reach services on your network.:allturns the check off. A proxy, a namedfinch:pool, or a customadapter:inreq_optionstakes the connection out of the check's reach, so they require:all, for example with an egress proxy that enforces it. The default value is[].:request_timeout(pos_integer/0) - Milliseconds a request may take in all, including a streamed response. The default value is60000.:max_response_size(pos_integer/0) - The most bytes a response may carry, including a streamed one. The default value is8388608.:auth-{module, opts}, wheremoduleimplementsAshAi.Mcp.Client.Auth, such as{AshAi.Mcp.OAuth, store: MyApp.McpTokens, owner: user.id}. The default value isnil.:headers- Static headers sent with every request, such as an API key. A zero-arity function is called before each request. The default value is[].:req_options(keyword/0) - Options merged intoReq.new/1, e.g.plug:in tests orreceive_timeout:. The default value is[].:client_info(map ofString.t/0keys andterm/0values) - TheImplementationsent asclientInfo. Defaults to%{"name" => "ash_ai", "version" => <AshAi's version>}.:capabilities(map ofString.t/0keys andterm/0values) - The client capabilities to declare. The client implements none beyond the core. The default value is%{}.:protocol_version- Skip version detection and use this protocol version. Set it from a previously negotiatedAshAi.Mcp.Client.Connection.protocol_versionto save the probe request. The default value isnil.