Skip to content

HttpMcpTransport

Namespace: Vercel.AI.Mcp

public sealed class HttpMcpTransport : IMcpTransport

MCP over Streamable HTTP. Posts JSON-RPC and accepts a JSON body or an SSE data: payload.

Inheritance: object

Implements: IMcpTransport

View source

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

View source

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>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product