AxMCPTransport
Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L24
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
evaluationMode? | readonly | "record" | "live" | "replay" | "sandbox" | Indicates whether optimizer/evaluation use can cause live side effects. |
Methods
close()?
optional close(): void | Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L93
Releases transport resources. Implementations should be idempotent.
Returns
void | Promise<void>
connect()?
optional connect(): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L82
Connects to the transport if needed This method is optional and only required for transports that need connection setup
Returns
Promise<void>
send()
send(message: Readonly<AxMCPJSONRPCRequest<unknown>>, options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPJSONRPCResponse<unknown>>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L36
Sends a JSON-RPC request or notification and returns the response
Parameters
| Parameter | Type | Description |
|---|---|---|
message | Readonly<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
sendBatch()?
optional 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/transport.ts#L42
Sends one version-gated JSON-RPC batch on transports that support it.
Parameters
| Parameter | Type |
|---|---|
messages | readonly Readonly<AxMCPJSONRPCRequest<unknown>>[] |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<readonly AxMCPJSONRPCResponse<unknown>[]>
sendNotification()
sendNotification(message: Readonly<AxMCPJSONRPCNotification>): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L51
Sends a JSON-RPC notification
Parameters
| Parameter | Type | Description |
|---|---|---|
message | Readonly<AxMCPJSONRPCNotification> | The JSON-RPC notification to send |
Returns
Promise<void>
sendResponse()?
optional sendResponse(message: Readonly<AxMCPJSONRPCResponse>): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L57
Sends a JSON-RPC response for a server-initiated request. Transports that cannot receive server requests do not need to implement it.
Parameters
| Parameter | Type |
|---|---|
message | Readonly<AxMCPJSONRPCResponse> |
Returns
Promise<void>
setLifecycleHandler()?
optional setLifecycleHandler(handler: (state: "reconnected") => void | Promise<void>): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L68
Registers transport lifecycle events that require client-level recovery.
Parameters
| Parameter | Type |
|---|---|
handler | (state: "reconnected") => void | Promise<void> |
Returns
void
setMessageHandler()?
optional setMessageHandler(handler: (message: Readonly<AxMCPJSONRPCMessage>) => void | Promise<void>): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L63
Registers a handler for server-initiated JSON-RPC requests and notifications that arrive outside a direct client request response.
Parameters
| Parameter | Type |
|---|---|
handler | (message: Readonly<AxMCPJSONRPCMessage>) => void | Promise<void> |
Returns
void
setProtocolVersion()?
optional setProtocolVersion(protocolVersion: string): void;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L76
Stores the negotiated MCP protocol version for transports that must emit it on later frames or HTTP requests.
Parameters
| Parameter | Type |
|---|---|
protocolVersion | string |
Returns
void
startListening()?
optional startListening(options?: Readonly<AxMCPListeningOptions>):
| AxMCPListeningHandle
| Promise<AxMCPListeningHandle>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L85
Starts a nonblocking server-message listener when the transport needs one.
Parameters
| Parameter | Type |
|---|---|
options? | Readonly<AxMCPListeningOptions> |
Returns
| AxMCPListeningHandle
| Promise<AxMCPListeningHandle>
takeRequestMetadata()?
optional takeRequestMetadata(id: string | number):
| undefined
| Readonly<{
retryCount?: number;
}>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L28
One-shot metadata for the most recently completed request ID.
Parameters
| Parameter | Type |
|---|---|
id | string | number |
Returns
| undefined
| Readonly<{
retryCount?: number;
}>
terminateSession()?
optional terminateSession(): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/transport.ts#L90
Terminates a negotiated transport session when supported.
Returns
Promise<void>