Table of Contents

Class SseClientTransportOptions

Namespace
ModelContextProtocol.Protocol.Transport
Assembly
ModelContextProtocol.dll

Provides options for configuring SseClientTransport instances.

public record SseClientTransportOptions : IEquatable<SseClientTransportOptions>
Inheritance
SseClientTransportOptions
Implements
Inherited Members

Properties

AdditionalHeaders

Gets custom HTTP headers to include in requests to the SSE server.

public Dictionary<string, string>? AdditionalHeaders { get; init; }

Property Value

Dictionary<string, string>

Remarks

Use this property to specify custom HTTP headers that should be sent with each request to the server.

ConnectionTimeout

Gets or sets a timeout used to establish the initial connection to the SSE server.

public TimeSpan ConnectionTimeout { get; init; }

Property Value

TimeSpan

Remarks

This timeout controls how long the client waits for:

  • The initial HTTP connection to be established with the SSE server
  • The endpoint event to be received, which indicates the message endpoint URL
If the timeout expires before the connection is established, a TimeoutException will be thrown.

Endpoint

Gets or sets the base address of the server for SSE connections.

public required Uri Endpoint { get; init; }

Property Value

Uri

MaxReconnectAttempts

Gets or sets the maximum number of reconnection attempts for the SSE connection before giving up.

public int MaxReconnectAttempts { get; init; }

Property Value

int

Remarks

This property controls how many times the client will attempt to reconnect to the SSE server after a connection failure occurs. If all reconnection attempts fail, a McpTransportException with the message "Exceeded reconnect limit" will be thrown.

Between each reconnection attempt, the client will wait for the duration specified by ReconnectDelay.

Name

Gets a transport identifier used for logging purposes.

public string? Name { get; init; }

Property Value

string

ReconnectDelay

Gets or sets the delay to employ between reconnection attempts when the SSE connection fails.

public TimeSpan ReconnectDelay { get; init; }

Property Value

TimeSpan

Remarks

When a connection to the SSE server is lost or fails, the client will wait for this duration before attempting to reconnect. This helps prevent excessive reconnection attempts in quick succession which could overload the server or network.

The reconnection process continues until either a successful connection is established or the maximum number of reconnection attempts (MaxReconnectAttempts) is reached.