MCPClient class base
The base class for MCP clients.
Can be directly constructed or extended with additional classes.
Adding capabilities is done through additional support mixins such as RootsSupport.
Override the initialize function to perform setup logic inside mixins, this will be invoked at the end of base class constructor.
- Implementers
Constructors
- MCPClient.new(Implementation implementation)
Properties
- capabilities → ClientCapabilities
-
The capabilities of this client.
final
-
connections
→ Set<
ServerConnection> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- implementation → Implementation
-
A description of the client sent to servers during initialization.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connectServer(
StreamChannel< String> channel, {Sink<String> ? protocolLogSink}) → ServerConnection -
Returns a connection for an MCP server using a
channel
, which is already established. -
connectStdioServer(
StreamSink< List< stdin, Stream<int> >List< stdout, {Sink<int> >String> ? protocolLogSink, void onDone()?}) → ServerConnection -
Connect to a new MCP server over
stdin
andstdout
, where these correspond to the stdio streams of the server process (not the client). -
initialize(
) → void - Lifecycle method called in the base class constructor.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shutdown(
) → Future< void> - Shuts down all active server connections.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited