Client for connecting to multiple MCP servers and loading LangChain-compatible tools.
class MultiServerMCPClientCreate a new MultiServerMCPClient.
Close all connections.
Get a the MCP client for a specific server. Useful for fetching prompts or resources from that server.
Get tools from specified servers as a flattened array.
Proactively initialize connections to all servers. This will be called automatically when methods requiring an active connection (like getTools or getClient) are called, but you can call it directly to ensure all connections are established before using the tools.
When a server fails to connect, the client will throw an error if onConnectionError is "throw",
otherwise it will skip the server and continue with the remaining servers.
List resources from specified servers.
List resource templates from specified servers.
Resource templates are used for dynamic resources with parameterized URIs.
Read a resource from a specific server.
Set the logging level for all servers