ExperimentalExperimentalExperimentalThe result of the last (or in-flight) initialize call — protocolVersion/serverInfo/capabilities.
ExperimentalThe Mcp-Session-Id this client was bound to on initialize, or undefined before the first call.
Experimentaltools/call. Throws McpToolError when the tool reported failure
(result.isError: true) — never returns a result the caller has to
remember to check .isError on.
ExperimentalRuns the initialize handshake, capturing the Mcp-Session-Id response
header for every later call. Safe to call more than once — concurrent
callers share one in-flight request; a session already established is NOT
re-initialized.
Optionalsignal: AbortSignalExperimentalWalks tools/list to completion, following nextCursor until the server
stops issuing one, and returns every descriptor in server order.
The loop is bounded twice, because "follow the cursor until it stops" is an unbounded instruction handed to a remote party:
Both bounds throw McpProtocolError rather than silently returning a truncated catalog, because a partial tool catalog is indistinguishable from a narrower server authorization and must never be mistaken for one.
Neither bound helps against a server that accepts a page request and never answers it, so McpListAllToolsOptions.signal is threaded into the handshake and every page — that is the only bound on a request in flight.
Experimentaltools/list — paginated per MCP 2025-03-26; pass cursor back from a prior nextCursor to fetch the next page.
Optionalsignal: AbortSignalExperimentalDrops the negotiated Mcp-Session-Id and initialize result so the next
call re-handshakes. Callers use this to reconnect — a new server session
may advertise a different tool catalog, so whoever calls this is
responsible for invalidating anything derived from the old one
(StudioAgentSession.reconnect invalidates its tool catalog here).
ExperimentalSubscribes to the server's standalone GET /mcp SSE stream and reports
every server-initiated notification — notifications/tools/list_changed
above all — until the subscription is closed, the server declines the
channel, or the reconnect budget runs out.
The returned stream reads this client's session id on every connect
attempt, so a resetSession plus re-handshake is carried
automatically. Call this only after (or alongside) a request that has
established a session: an un-handshaken client sends no Mcp-Session-Id,
which a session-enforcing server rejects.
Nothing else on this client starts a stream — a consumer that never calls this never opens one.
A minimal, hand-rolled MCP client for honua-server's
POST /mcpStreamable HTTP transport — see the module doc for the SDK-vs-hand-rolled decision. One instance owns one session (Mcp-Session-Id); call McpClient.initialize once before McpClient.listTools / McpClient.callTool (both call it lazily on first use if it hasn't run yet, so callers that only needcallTooldon't have to sequence it themselves).