Client constructor

Client({
  1. required String name,
  2. required String version,
  3. ClientCapabilities capabilities = const ClientCapabilities(),
})

Creates a new MCP client with the specified parameters

Implementation

Client({
  required this.name,
  required this.version,
  this.capabilities = const ClientCapabilities(),
}) {
  // Default `roots/list` handler returns the locally registered roots.
  // Hosts may override with [onListRoots] for dynamic roots.
  _requestHandlers['roots/list'] = (_) async => {
        'roots': _roots.map((r) => r.toJson()).toList(),
      };
}