README

colmugx/mcp/client/legacy does not have a README file

#
LegacyClient

pub struct LegacyClient {
client_name : String
client_version : String
transport : LegacyTransport
next_id : Int
server_name : String
server_version : String
}

#
LegacyClient::LegacyClient

fn LegacyClient::LegacyClient(name~ : String, version~ : String, transport~ :
AnyTransport
) -> LegacyClient

#
LegacyClient::close

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

Close the underlying transport. For the HTTP session transport this also sends a best-effort DELETE to terminate the session.

#
LegacyClient::connect_http

async fn LegacyClient::connect_http(url~ : String, name~ : String, version~ : String, auth_token? : String) -> Result[LegacyClient,
MCPError
]

Create a legacy client connected over the 2025-11-25 Streamable HTTP session transport and complete the initialize handshake.

#
LegacyClient::initialize

Perform the legacy initialize handshake: send initialize, parse serverInfo/protocolVersion from the response, then send notifications/initialized. Returns the server identity on success.

The legacy client advertises empty client capabilities: it has no inbound request handlers (roots/listChanged and sampling are provided by the modern client after the 2026-07-28 migration), so claiming them here would be a lie.

#
LegacyClient::ping

Send a legacy ping request and wait for a response. Returns Ok(()) if the response contains no JSON-RPC error.

#
LegacyClient::send_raw

async fn LegacyClient::send_raw(self : LegacyClient, request : String) -> Result[String,
MCPError
]

Send a raw JSON-RPC request string and wait for the response (legacy synchronous send/receive). Callers build the request body themselves.

#
LegacyHttpSessionTransport

pub struct LegacyHttpSessionTransport {
base_url : String
auth_token : String?
session_id : String?
closed : Bool
pending_responses :
Queue
[String]
}

2025-11-25 Streamable HTTP session-aware client transport.

This transport is intentionally separate from the modern @transport.AnyTransport enum: it holds a Mcp-Session-Id returned during initialize and re-sends it on every subsequent POST. It also terminates the session with an HTTP DELETE in close. The legacy GET long-poll SSE channel and Last-Event-ID resumability are not implemented.

#
LegacyHttpSessionTransport::LegacyHttpSessionTransport

fn LegacyHttpSessionTransport::LegacyHttpSessionTransport(url~ : String, auth_token? : String) -> LegacyHttpSessionTransport

#
LegacyHttpSessionTransport::close

Best-effort session termination. If a session id is held, sends an HTTP DELETE to the MCP endpoint with the Mcp-Session-Id header. Errors are ignored.

#
LegacyHttpSessionTransport::receive

Drain the next response message queued by send. Returns None when the queue is empty.

#
LegacyHttpSessionTransport::send

POST a JSON-RPC request to the legacy MCP endpoint. If the server returns an Mcp-Session-Id header, it is stored for all later requests. Responses may be a single JSON object or an SSE stream; every JSON-RPC payload is queued for receive.

#
LegacyHttpSessionTransport::send_notification

Send a JSON-RPC notification (no id, fire-and-forget). Per the 2025-11-25 spec the server answers with HTTP 202 Accepted and no body.

#
LegacyTransport

pub enum LegacyTransport {
Wrapped(
AnyTransport
)
HttpSession(LegacyHttpSessionTransport)
}

Internal transport wrapper for LegacyClient.

LegacyClient must be able to accept a modern @transport.AnyTransport (for callers that already have one) or the legacy session-aware HTTP transport (for connect_http). This private enum keeps both shapes inside the legacy package without adding a variant to the closed AnyTransport enum in the transport package.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io