ConnectionState
Category: Mcp_client
Source: connection_state.dart
Connection state machine for an [McpClient] against a single MCP server, plus the backoff-with-jitter helper.
Pure data + a pure function. The state-transition logic itself lives in client.dart and pool.dart.
[McpDisconnectReason] re-exports from glue_core so the wire enum stays single-sourced — the same value flows through events and the state machine.
Classes
sealed McpConnectionState
Constructor
dart
const McpConnectionState()McpDisconnected
Constructor
dart
const McpDisconnected()McpConnecting
Constructor
dart
const McpConnecting({this.attempt = 1})Properties
| Property | Type | Description |
|---|---|---|
attempt | int |
McpConnected
Constructor
dart
const McpConnected({
required this.connectedAt,
required this.serverName,
required this.serverVersion,
required this.protocolVersion,
})Properties
| Property | Type | Description |
|---|---|---|
connectedAt | DateTime | |
serverName | String | |
serverVersion | String | |
protocolVersion | String |
McpReconnecting
Constructor
dart
const McpReconnecting({
required this.attempt,
required this.nextAttemptIn,
this.lastError,
})Properties
| Property | Type | Description |
|---|---|---|
attempt | int | |
nextAttemptIn | Duration | |
lastError | String? |
McpDead
Constructor
dart
const McpDead({required this.reason})Properties
| Property | Type | Description |
|---|---|---|
reason | String |
McpAwaitingAuth
Server is parked because OAuth is required. Distinct from [McpDead]: no reconnect timer armed, no budget consumed. Cleared by a successful auth flow (via pool.reconnect).
Constructor
dart
const McpAwaitingAuth({this.lastError})Properties
| Property | Type | Description |
|---|---|---|
lastError | String? |