MCPClientConfig class
Configuration for MCP clients
Constructors
-
MCPClientConfig({required String name, required String version, ClientCapabilities? capabilities, String? transportType, String? transportCommand, List<
String> ? transportArgs, String? serverUrl, String? authToken, String? endpoint, Duration? timeout, Duration? sseReadTimeout, int? maxConcurrentRequests, bool? useHttp2, bool? terminateOnClose, Map<String, String> ? headers, List<Root> ? initialRoots, bool autoBridgeSampling = true, Future<Map< elicitationHandler(Map<String, dynamic> >String, dynamic> params)?, Future<List< listRootsHandler()?})Root> > - Creates a new MCP client configuration
Properties
- authToken → String?
-
Authentication token for the transport
final
- autoBridgeSampling → bool
-
When true (default) and capabilities is not supplied, the client is
advertised with
sampling: trueand server-initiatedsampling/createMessagerequests are bridged to the host LLM (the default LLM client registered via MCPLlmManager). Set false to opt out — useful when no host LLM will be registered.final - capabilities → ClientCapabilities?
-
Client capabilities
final
-
elicitationHandler
→ Future<
Map< Function(Map<String, dynamic> >String, dynamic> params)? -
Optional handler for server-initiated
elicitation/createrequests. When supplied (and capabilities is not), enables theelicitationcapability. The handler receives the specElicitRequest.paramsmap and must return{action, content?}.final - endpoint → String?
-
Endpoint path for SSE/StreamableHttp (e.g., '/sse', '/mcp')
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
Additional headers to send with requests
final
-
initialRoots
→ List<
Root> ? -
Initial roots to register on this client before connecting.
Implies ClientCapabilities.roots when capabilities is not supplied.
final
-
listRootsHandler
→ Future<
List< Function()?Root> > -
Optional override for server-initiated
roots/listrequests. When not supplied the client returns its locally added roots (initialRoots plus any FlutterMCP.addClientRoot calls).final - maxConcurrentRequests → int?
-
Maximum number of concurrent requests
final
- name → String
-
Name of the client
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverUrl → String?
-
Server URL for SSE/streamablehttp transport
final
- sseReadTimeout → Duration?
-
SSE read timeout (longer for streaming)
final
- terminateOnClose → bool?
-
Whether to terminate session on close
final
- timeout → Duration?
-
Request timeout
final
-
transportArgs
→ List<
String> ? -
Transport command arguments
final
- transportCommand → String?
-
Transport command for stdio transport
final
- transportType → String
-
Transport type to use (stdio, sse, streamablehttp)
final
- useHttp2 → bool?
-
Whether to use HTTP/2 if available
final
- version → String
-
Version of the client
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this configuration to JSON
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited