AxMCPStreamableHTTPTransport Generated TypeScript API reference. typescript api api/reference build/apidocs/Class.AxMCPStreamableHTTPTransport.md class AxMCPStreamableHTTPTransport

AxMCPStreamableHTTPTransport

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L37

Extended by

Implements

Constructors

Constructor

TypeScript
new AxMCPStreamableHTTPTransport(mcpEndpoint: string, options: Readonly<AxMCPStreamableHTTPTransportOptions>): AxMCPStreamableHTTPTransport;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L58

Parameters

ParameterType
mcpEndpointstring
optionsReadonly<AxMCPStreamableHTTPTransportOptions>

Returns

AxMCPStreamableHTTPTransport

Methods

close()

TypeScript
close(): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L332

Releases transport resources. Implementations should be idempotent.

Returns

void

Implementation of

AxMCPTransport.close


connect()

TypeScript
connect(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L159

Connects to the transport if needed This method is optional and only required for transports that need connection setup

Returns

Promise<void>

Implementation of

AxMCPTransport.connect


getHeaders()

TypeScript
getHeaders(): Record<string, string>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L86

Returns

Record<string, string>


openListeningStream()

TypeScript
openListeningStream(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L163

Returns

Promise<void>


send()

TypeScript
send(message: Readonly<AxMCPJSONRPCRequest<unknown>>, options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPJSONRPCResponse<unknown>>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L189

Sends a JSON-RPC request or notification and returns the response

Parameters

ParameterTypeDescription
messageReadonly<AxMCPJSONRPCRequest<unknown>>The JSON-RPC request or notification to send
options?Readonly<AxMCPRequestOptions>-

Returns

Promise<AxMCPJSONRPCResponse<unknown>>

A Promise that resolves to the JSON-RPC response

Implementation of

AxMCPTransport.send


sendBatch()

TypeScript
sendBatch(messages: readonly Readonly<AxMCPJSONRPCRequest<unknown>>[], options?: Readonly<AxMCPRequestOptions>): Promise<readonly AxMCPJSONRPCResponse<unknown>[]>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L221

Sends one version-gated JSON-RPC batch on transports that support it.

Parameters

ParameterType
messagesreadonly Readonly<AxMCPJSONRPCRequest<unknown>>[]
options?Readonly<AxMCPRequestOptions>

Returns

Promise<readonly AxMCPJSONRPCResponse<unknown>[]>

Implementation of

AxMCPTransport.sendBatch


sendNotification()

TypeScript
sendNotification(message: Readonly<AxMCPJSONRPCNotification>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L289

Sends a JSON-RPC notification

Parameters

ParameterTypeDescription
messageReadonly<AxMCPJSONRPCNotification>The JSON-RPC notification to send

Returns

Promise<void>

Implementation of

AxMCPTransport.sendNotification


sendResponse()

TypeScript
sendResponse(message: Readonly<AxMCPJSONRPCResponse>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L304

Sends a JSON-RPC response for a server-initiated request. Transports that cannot receive server requests do not need to implement it.

Parameters

ParameterType
messageReadonly<AxMCPJSONRPCResponse>

Returns

Promise<void>

Implementation of

AxMCPTransport.sendResponse


setAuthorization()

TypeScript
setAuthorization(authorization: string): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L82

Parameters

ParameterType
authorizationstring

Returns

void


setHeaders()

TypeScript
setHeaders(headers: Record<string, string>): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L78

Parameters

ParameterType
headersRecord<string, string>

Returns

void


setLifecycleHandler()

TypeScript
setLifecycleHandler(handler: (state: "reconnected") => void | Promise<void>): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L153

Registers transport lifecycle events that require client-level recovery.

Parameters

ParameterType
handler(state: "reconnected") => void | Promise<void>

Returns

void

Implementation of

AxMCPTransport.setLifecycleHandler


setMessageHandler()

TypeScript
setMessageHandler(handler: (message: Readonly<AxMCPJSONRPCMessage>) => void | Promise<void>): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L147

Registers a handler for server-initiated JSON-RPC requests and notifications that arrive outside a direct client request response.

Parameters

ParameterType
handler(message: Readonly<AxMCPJSONRPCMessage>) => void | Promise<void>

Returns

void

Implementation of

AxMCPTransport.setMessageHandler


setProtocolVersion()

TypeScript
setProtocolVersion(protocolVersion: string): void;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L90

Stores the negotiated MCP protocol version for transports that must emit it on later frames or HTTP requests.

Parameters

ParameterType
protocolVersionstring

Returns

void

Implementation of

AxMCPTransport.setProtocolVersion


startListening()

TypeScript
startListening(options: Readonly<AxMCPListeningOptions>): AxMCPListeningHandle;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L170

Starts a nonblocking server-message listener when the transport needs one.

Parameters

ParameterType
optionsReadonly<AxMCPListeningOptions>

Returns

AxMCPListeningHandle

Implementation of

AxMCPTransport.startListening


takeRequestMetadata()

TypeScript
takeRequestMetadata(id: string | number): 
  | undefined
  | Readonly<{
  retryCount?: number;
}>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L94

One-shot metadata for the most recently completed request ID.

Parameters

ParameterType
idstring | number

Returns

| undefined | Readonly<{ retryCount?: number; }>

Implementation of

AxMCPTransport.takeRequestMetadata


terminateSession()

TypeScript
terminateSession(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transports/httpStreamTransport.ts#L315

Terminates a negotiated transport session when supported.

Returns

Promise<void>

Implementation of

AxMCPTransport.terminateSession

Docs