Learn how to use MCPServerAdapter in CrewAI to connect to multiple MCP servers simultaneously and aggregate their tools.
MCPServerAdapter
in crewai-tools
allows you to connect to multiple MCP servers concurrently. This is useful when your agents need to access tools distributed across different services or environments. The adapter aggregates tools from all specified servers, making them available to your CrewAI agents.
MCPServerAdapter
. Each dictionary in the list should define the parameters for one MCP server.
Supported transport types for each server in the list include stdio
, sse
, and streamable-http
.
with
statement), MCPServerAdapter
handles the lifecycle (start and stop) of all connections to the configured MCP servers. This simplifies resource management and ensures that all connections are properly closed when the context is exited.