colmugx/mcp/client does not have a README file

    CallToolResult

    pub(all) struct CallToolResult {
    content : Array[
    ContentItem
    ]
    is_error : Bool
    } derive(Eq,
    Debug
    )

    ClientBackend

    pub enum ClientBackend {
    Modern
    Legacy(
    LegacyClient
    )
    }

    Backend selected after era probing. Modern clients speak the stateless 2026-07-28 protocol; Legacy clients wrap the 2025-11-25 session client.

    CompletionResult

    pub(all) struct CompletionResult {
    values : Array[String]
    total : Int?
    has_more : Bool?
    } derive(Eq,
    Debug
    )

    ListPromptsResult

    pub(all) struct ListPromptsResult {
    prompts : Array[
    PromptDefinition
    ]
    next_cursor : String?
    } derive(Eq,
    Debug
    )

    ListResourceTemplatesResult

    pub(all) struct ListResourceTemplatesResult {
    resource_templates : Array[ResourceTemplate]
    next_cursor : String?
    } derive(Eq,
    Debug
    )

    ListResourcesResult

    pub(all) struct ListResourcesResult {
    resources : Array[
    ResourceDefinition
    ]
    next_cursor : String?
    } derive(Eq,
    Debug
    )

    ListToolsResult

    pub(all) struct ListToolsResult {
    tools : Array[
    ToolDefinition
    ]
    next_cursor : String?
    } derive(Eq,
    Debug
    )

    ListenFilter

    pub(all) struct ListenFilter {
    tools_list_changed : Bool
    prompts_list_changed : Bool
    resources_list_changed : Bool
    resource_subscriptions : Array[String]
    } derive(Eq,
    Debug
    )

    Filter for a subscriptions/listen request. Controls which server notification channels the client wants multiplexed onto this single long-lived request.

    ListenFilter::default

    fn ListenFilter::default() -> ListenFilter

    Default filter: subscribe only to list-change notifications, with no per-resource subscriptions.

    MCPClient

    pub struct MCPClient {
    client_name : String
    client_version : String
    capabilities :
    ClientCapabilities

    transport :
    AnyTransport

    id_counter : RequestIdCounter
    server_capabilities :
    ServerCapabilities
    ?
    server_info :
    ServerInfo
    ?
    notification_handlers : NotificationHandlers
    subscription_handlers : Map[String, (Json) -> Unit]
    sampling_handler : (Json) -> Result[
    CreateMessageResult
    ,
    MCPError
    ]?
    roots_handler : () -> Result[Array[
    Root
    ],
    MCPError
    ]?
    elicitation_handler : (Json) -> Result[
    ElicitationResult
    ,
    MCPError
    ]?
    response_map : Map[Int,
    Queue
    [String]]
    event_loop_started : Bool
    legacy_mode : Bool
    backend : ClientBackend
    }

    MCPClient::call_tool

    async fn MCPClient::call_tool(self : MCPClient, name : String, arguments? : String) -> Result[CallToolResult,
    MCPError
    ]

    MCPClient::cancel_listen

    async fn MCPClient::cancel_listen(self : MCPClient, subscription_id : String) -> Result[Unit,
    MCPError
    ]

    Cancel a running subscriptions/listen subscription. For stdio transports this sends a notifications/cancelled notification. HTTP transports do not currently support per-stream cancellation in this SDK, so this returns an error explaining that limitation.

    MCPClient::cancel_request

    async fn MCPClient::cancel_request(self : MCPClient, request_id : String, reason? : String) -> Result[Unit,
    MCPError
    ]

    Cancel an in-flight request. Per the 2026-07-28 spec (transports/streamable-http), the core protocol defines no client→server notification on Streamable HTTP: cancellation there is signalled by closing the SSE response stream. So only stdio client transports send notifications/cancelled; HTTP and other transports return a clear error instead (same style as cancel_listen).

    MCPClient::close

    async fn MCPClient::close(self : MCPClient) -> Unit

    MCPClient::complete

    async fn MCPClient::complete(self : MCPClient, ref_type~ : String, ref_name~ : String, argument_name~ : String, argument_value~ : String) -> Result[CompletionResult,
    MCPError
    ]

    MCPClient::connect_http

    async fn MCPClient::connect_http(url~ : String, name~ : String, version~ : String, auth_token? : String, extra_headers? : Array[(String, String)], era? : ProtocolEra) -> Result[MCPClient,
    MCPError
    ]

    Connect to a remote MCP server over HTTP.

    era constrains how the protocol era is negotiated:

    eraserver/discover probelegacy fallback
    Autoyes (default)allowed
    Legacyskippeddirect connect
    Modernyesforbidden (Err)

    extra_headers are appended to every request this transport issues, after the built-in headers. Same-name entries override the built-ins (including the spec-mandated MCP-Protocol-Version/Mcp-Method/Mcp-Name and the auth_token-derived Authorization — extra wins), so pass reserved headers only deliberately. The same set is applied on the legacy-era fallback path, so header-gated servers (bearer, routing, session-context) see identical headers on both protocol eras.

    MCPClient::connect_stdio

    async fn MCPClient::connect_stdio(cmd~ : String, args? : Array[String], name~ : String, version~ : String, extra_env? : Map[String, String], group~ :
    TaskGroup
    [Unit], era? : ProtocolEra) -> Result[MCPClient,
    MCPError
    ]

    Connect to a local MCP server by spawning it as a child process.

    era constrains era negotiation exactly like connect_http:

    eraserver/discover probelegacy fallback
    Autoyes (default)allowed
    Legacyskippeddirect connect
    Modernyesforbidden (Err)

    MCPClient::discover

    Query the server's supported versions, capabilities, and identity via server/discover (required by the 2026-07-28 spec). Stores the results in server_capabilities and server_info for later use. Optional for clients per spec, but recommended — and the primary era probe for legacy fallback.

    MCPClient::get_prompt

    async fn MCPClient::get_prompt(self : MCPClient, name : String, arguments? : String) -> Result[
    GetPromptResult
    ,
    MCPError
    ]

    MCPClient::list_prompts

    async fn MCPClient::list_prompts(self : MCPClient, cursor? : String) -> Result[ListPromptsResult,
    MCPError
    ]

    MCPClient::list_resource_templates

    async fn MCPClient::list_resource_templates(self : MCPClient, cursor? : String) -> Result[ListResourceTemplatesResult,
    MCPError
    ]

    MCPClient::list_resources

    async fn MCPClient::list_resources(self : MCPClient, cursor? : String) -> Result[ListResourcesResult,
    MCPError
    ]

    MCPClient::list_tools

    async fn MCPClient::list_tools(self : MCPClient, cursor? : String) -> Result[ListToolsResult,
    MCPError
    ]

    MCPClient::listen

    fn MCPClient::listen(self : MCPClient, filter? : ListenFilter, handler~ : (Json) -> Unit, group~ :
    TaskGroup
    [Unit]) -> Result[String,
    MCPError
    ]

    Start a subscriptions/listen request. Returns the subscription id string on success. The caller must already have started the event loop via run; otherwise a clear error is returned. Notifications carrying the subscription id in params._meta are routed to handler until the server closes the subscription (the final JSON-RPC response causes a background cleanup task to unregister the handler).

    MCPClient::next_request_id

    fn MCPClient::next_request_id(self : MCPClient) -> Int

    MCPClient::on_notification

    fn MCPClient::on_notification(self : MCPClient, handlers : NotificationHandlers) -> MCPClient

    MCPClient::read_resource

    async fn MCPClient::read_resource(self : MCPClient, uri : String) -> Result[ReadResourceResult,
    MCPError
    ]

    MCPClient::run

    async fn MCPClient::run(self : MCPClient, group :
    TaskGroup
    [Unit]) -> Unit

    MCPClient::set_legacy_mode

    fn MCPClient::set_legacy_mode(self : MCPClient, enabled : Bool) -> MCPClient

    Enable or disable legacy mode. When enabled, the event loop accepts server-initiated requests (2025-11-25 behavior); when disabled (the default), such requests are rejected with -32601 per the 2026-07-28 spec.

    MCPHost

    pub struct MCPHost {
    name : String
    version : String
    connections : Map[String, MCPClient]
    }

    MCPHost::MCPHost

    fn MCPHost::MCPHost(name~ : String, version~ : String) -> MCPHost

    MCPHost::call_tool

    async fn MCPHost::call_tool(self : MCPHost, qualified_name : String, arguments? : String) -> Result[CallToolResult,
    MCPError
    ]

    MCPHost::close_all

    async fn MCPHost::close_all(self : MCPHost) -> Unit

    MCPHost::connect_http

    async fn MCPHost::connect_http(self : MCPHost, name~ : String, url~ : String, auth_token? : String, era? : ProtocolEra) -> Result[Unit,
    MCPError
    ]

    Register a named connection to a remote MCP server over HTTP. era is passed through to MCPClient::connect_http:

    eraserver/discover probelegacy fallback
    Autoyes (default)allowed
    Legacyskippeddirect connect
    Modernyesforbidden (Err)

    MCPHost::connect_stdio

    async fn MCPHost::connect_stdio(self : MCPHost, name~ : String, cmd~ : String, args? : Array[String], extra_env? : Map[String, String], group~ :
    TaskGroup
    [Unit], era? : ProtocolEra) -> Result[Unit,
    MCPError
    ]

    Register a named connection to a spawned MCP server. era is passed through to MCPClient::connect_stdio (same semantics table as MCPHost::connect_http).

    MCPHost::list_tools

    NotificationHandlers

    pub(all) struct NotificationHandlers {
    on_tools_changed : () -> Unit?
    on_resources_changed : () -> Unit?
    on_prompts_changed : () -> Unit?
    on_progress : (
    ProgressNotification
    ) -> Unit?
    on_cancelled : (
    CancelledNotification
    ) -> Unit?
    on_resource_updated : (
    ResourceUpdatedNotification
    ) -> Unit?
    on_message : (String, Json?) -> Unit?
    }

    NotificationHandlers::empty

    ProtocolEra

    pub(all) enum ProtocolEra {
    Auto
    Legacy
    Modern
    } derive(Eq)

    Protocol era a client should assume when connecting.

    ReadResourceResult

    RequestIdCounter

    type RequestIdCounter

    ResourceTemplate

    pub(all) struct ResourceTemplate {
    uri_template : String
    name : String
    description : String?
    mime_type : String?
    } derive(Eq,
    Debug
    )