MCPV2ToolProvider uses @modelcontextprotocol/client@^2.3.0. It defaults to protocol 2026-07-28 without silent fallback. Choose versionNegotiation: { mode: "auto" } explicitly for SDK legacy negotiation.
Supported transports are http, stdio, and a host-supplied custom transport. Legacy SSE stays on MCPToolProvider with @modelcontextprotocol/sdk@^1.27.1.
Select tools from a server
Preserve tool results
Both adapters preserve MCP content/metadata as anmcp-result artifact. Read ToolResult.content rather than assuming every result is a string. Tool-level errors throw MCPToolError with the mapped result.
Tool discovery changes affect future getTools() calls. An Agent’s bound tool array is a snapshot; rebuild selection deliberately. Requests propagate the run’s cancellation signal. Closing the provider invalidates pending initialization and closes late transports.
Optional Tasks extension
Enable Tasks explicitly. Handles are opaque and owned by run, session, user, and tenant. The adapter bounds retained handles and TTL; cross-owner lookup sends no remote request. Completed, failed, and cancelled states are terminal locally. Handles are connection-local.close() drops local state and disconnects; it does not cancel remote tasks or recover them after restart. Use a host task store and the durable MCP bridge for an explicitly designed cross-process lifecycle.