StreamableHttp

data class StreamableHttp(val url: String, val headers: Map<String, String> = emptyMap(), val connectTimeout: Duration = 5.seconds, val requestTimeout: Duration = 5.minutes, val allowInsecureHttp: Boolean = false) : McpTransportConfig

Streamable HTTP settings supported by both JVM and Android MCP clients.

HTTPS is allowed by default. An http endpoint requires allowInsecureHttp to be explicitly enabled on every platform. Android 9 / API 28 and newer normally block cleartext traffic as well, so the application must configure networkSecurityConfig or usesCleartextTraffic itself. A library cannot override that operating-system policy.

Constructors

Link copied to clipboard
constructor(url: String, headers: Map<String, String> = emptyMap(), connectTimeout: Duration = 5.seconds, requestTimeout: Duration = 5.minutes, allowInsecureHttp: Boolean = false)

Types

Link copied to clipboard
class Builder

Fluent builder for StreamableHttp, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor. Timeouts are set in milliseconds from Java because Duration is a value class hidden from Java.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

When true, an http URL is accepted. HTTPS does not need this.

Link copied to clipboard

Timeout for establishing the HTTP connection.

Link copied to clipboard

Headers included on every request. Values returned by the headerProvider passed to RemoteMcpToolsetConfig.toToolset override same-named entries.

Link copied to clipboard

Timeout for a single MCP request.

Link copied to clipboard
val url: String

The Streamable HTTP MCP endpoint. A URL with no path, or with path /, uses /mcp on JVM and Android (for example https://host becomes https://host/mcp). Any other path is used as-is.

Functions

Link copied to clipboard

Returns connectTimeout in whole milliseconds. Java cannot read connectTimeout.

Link copied to clipboard

Returns requestTimeout in whole milliseconds. Java cannot read requestTimeout.

Link copied to clipboard

Returns a Builder initialized with this instance's properties, primarily for Java callers. Prefer it over copy from Java: copy takes every property positionally, so its signature changes whenever a property is added.