Skip to content

McpNdjson

Namespace: Vercel.AI.Mcp

public static class McpNdjson

Newline-delimited JSON used by the upstream stdio transport.

Inheritance: object

View source

public static string Serialize(JsonElement message)

Serializes one message and appends a newline.

Parameters

Name Type Description
message JsonElement

Returns: string

View source

public static void Write(Stream? output, JsonElement message)

Writes one newline-delimited message. A null stream means the transport is not connected.

Parameters

Name Type Description
output Stream
message JsonElement

View source

WriteAsync(Stream?, JsonElement, CancellationToken)

Section titled “WriteAsync(Stream?, JsonElement, CancellationToken)”
public static Task WriteAsync(Stream? output, JsonElement message, CancellationToken cancellationToken = default)

Writes one newline-delimited message without blocking a thread when the pipe is full.

Parameters

Name Type Description
output Stream
message JsonElement
cancellationToken CancellationToken

Returns: Task

View source

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