HttpMcpTransport
Namespace: Vercel.AI.Mcp
public sealed class HttpMcpTransport : IMcpTransportMCP over Streamable HTTP. Posts JSON-RPC and accepts a JSON body or an SSE data: payload.
Inheritance: object
Implements: IMcpTransport
Constructors
Section titled “Constructors”HttpMcpTransport(HttpClient, Uri)
Section titled “HttpMcpTransport(HttpClient, Uri)”public HttpMcpTransport(HttpClient httpClient, Uri endpoint)Creates a transport that posts to <code class=“paramref”>endpoint</code>.
Parameters
| Name | Type | Description |
|---|---|---|
httpClient |
HttpClient | |
endpoint |
Uri |
Methods
Section titled “Methods”CallAsync(string, JsonElement, CancellationToken)
Section titled “CallAsync(string, JsonElement, CancellationToken)”public Task<JsonElement> CallAsync(string method, JsonElement parameters, CancellationToken cancellationToken)Calls <code class=“paramref”>method</code> and returns the JSON-RPC result.
Parameters
| Name | Type | Description |
|---|---|---|
method |
string | |
parameters |
JsonElement | |
cancellationToken |
CancellationToken |
Returns: Task<JsonElement>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product