McpClient class

MCP client — manages server connections and tool proxying.

Constructors

McpClient({required ToolRegistry toolRegistry})

Properties

connectedServers List<ConnectedMcpServer>
Connected servers only.
no setter
connections Map<String, McpServerConnection>
All server connections.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolRegistry ToolRegistry
final

Methods

callTool({required String serverName, required String toolName, required Map<String, dynamic> input, Duration timeout = const Duration(hours: 1)}) Future<McpToolResult>
Call a tool on an MCP server.
connect(McpServerConfig config) Future<McpServerConnection>
Connect to an MCP server.
disconnect(String serverName) Future<void>
Disconnect from an MCP server.
disconnectAll() Future<void>
Disconnect all servers.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshTools(String serverName) Future<void>
Reload tools from a connected server.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited