Documentation

Build LLM-powered agents
with production-ready TypeScript

DSPy for TypeScript. Working with LLMs is complex—they don't always do what you want. DSPy makes it easier to build amazing things with LLMs. Just define your inputs and outputs (signature) and an efficient prompt is auto-generated and used. Connect together various signatures to build complex systems and workflows using LLMs.

15+ LLM Providers
End-to-end Streaming
Auto Prompt Tuning

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

ParameterType
mcpEndpointstring
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

AxMCPTransport.connect


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

ParameterTypeDescription
messageReadonly<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

AxMCPTransport.send


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

ParameterTypeDescription
messageReadonly<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

ParameterType
authorizationstring

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

ParameterType
headersRecord<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

ParameterType
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>