AxMCPStreambleHTTPTransport
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L97
AxMCPStreambleHTTPTransport implements the 2025-03-26 Streamable HTTP transport specification This transport uses a single HTTP endpoint that supports both POST and GET methods
Implements
Constructors
Constructor
new AxMCPStreambleHTTPTransport(mcpEndpoint: string, options?: AxMCPStreamableHTTPTransportOptions): AxMCPStreambleHTTPTransport;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L113
Parameters
Parameter | Type |
---|---|
mcpEndpoint | string |
options? | AxMCPStreamableHTTPTransportOptions |
Returns
AxMCPStreambleHTTPTransport
Methods
close()
close(): void;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L455
Close any open connections
Returns
void
connect()
connect(): Promise<void>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L173
Connects to the transport if needed This method is optional and only required for transports that need connection setup
Returns
Promise
<void
>
Implementation of
getHeaders()
getHeaders(): Record<string, string>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L143
Get a copy of the current custom headers
Returns
Record
<string
, string
>
openListeningStream()
openListeningStream(): Promise<void>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L182
Opens an SSE stream to listen for server-initiated messages
Returns
Promise
<void
>
send()
send(message: Readonly<AxMCPJSONRPCRequest<unknown>>): Promise<AxMCPJSONRPCResponse<unknown>>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L289
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 |
Returns
Promise
<AxMCPJSONRPCResponse
<unknown
>>
A Promise that resolves to the JSON-RPC response
Implementation of
sendNotification()
sendNotification(message: Readonly<AxMCPJSONRPCNotification>): Promise<void>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L396
Sends a JSON-RPC notification
Parameters
Parameter | Type | Description |
---|---|---|
message | Readonly <AxMCPJSONRPCNotification > | The JSON-RPC notification to send |
Returns
Promise
<void
>
Implementation of
AxMCPTransport
.sendNotification
setAuthorization()
setAuthorization(authorization: string): void;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L136
Update authorization header (convenience method)
Parameters
Parameter | Type |
---|---|
authorization | string |
Returns
void
setHeaders()
setHeaders(headers: Record<string, string>): void;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L129
Update custom headers (useful for refreshing tokens)
Parameters
Parameter | Type |
---|---|
headers | Record <string , string > |
Returns
void
setMessageHandler()
setMessageHandler(handler: (message:
| AxMCPJSONRPCNotification
| AxMCPJSONRPCRequest<unknown>) => void): void;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L165
Set a handler for incoming server messages (requests/notifications)
Parameters
Parameter | Type |
---|---|
handler | (message : | AxMCPJSONRPCNotification | AxMCPJSONRPCRequest <unknown >) => void |
Returns
void
terminateSession()
terminateSession(): Promise<void>;
Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/mcp/httpTransport.ts#L428
Explicitly terminate the session (if supported by server)
Returns
Promise
<void
>