Class McpTransportException
Represents errors that occur during MCP transport operations.
[Serializable]
public class McpTransportException : Exception, ISerializable
- Inheritance
-
McpTransportException
- Implements
- Inherited Members
Remarks
This exception is thrown when transport-level failures occur, such as:
- Connection failures (process won't start, network unreachable)
- Message framing errors (malformed JSONL, incomplete messages)
- Process termination (for stdio transport)
- Stream read/write failures
This exception is distinct from JSON-RPC protocol errors, which are returned in the response payload and handled at a higher level.
Constructors
- McpTransportException()
Initializes a new instance of the McpTransportException class.
- McpTransportException(string)
Initializes a new instance of the McpTransportException class with a specified error message.
- McpTransportException(string, Exception)
Initializes a new instance of the McpTransportException class with a specified error message and inner exception.
- McpTransportException(string, string, int?, bool, Exception)
Initializes a new instance of the McpTransportException class with detailed transport information.
Properties
- ErrorCode
Gets the error code associated with this transport error, if applicable.
- IsRecoverable
Gets whether this error is potentially recoverable by reconnecting.
- TransportType
Gets the transport type that raised the exception.
Methods
- ConnectionTimeout(string, double)
Creates a transport exception for a connection timeout.
- InvalidMessageFormat(string, string)
Creates a transport exception for invalid message format.
- ProcessStartFailed(string, Exception)
Creates a transport exception for a process startup failure.
- ProcessTerminated(int, string)
Creates a transport exception for an unexpected process termination.
- ReceiveFailed(string, Exception)
Creates a transport exception for a message receive failure.
- SendFailed(string, Exception)
Creates a transport exception for a message send failure.