Learn how to integrate MCP servers as tools in your CrewAI agents using the crewai-tools
library.
crewai-tools
library extends CrewAI’s capabilities by allowing you to seamlessly integrate tools from these MCP servers into your agents.
This gives your crews access to a vast ecosystem of functionalities.
We currently support the following transport mechanisms:
crewai-tools
, you need to install the mcp
extra crewai-tools
dependency with the following command:
MCPServerAdapter
class from crewai-tools
is the primary way to connect to an MCP server and make its tools available to your CrewAI agents. It supports different transport mechanisms and simplifies connection management.
Using a Python context manager (with
statement) is the recommended approach for MCPServerAdapter
. It automatically handles starting and stopping the connection to the MCP server.
MCPServerAdapter
constructor.MCPServerAdapter
constructor.mcp_tools
method. Server configurations should be provided via the mcp_server_params attribute. You can pass either a single configuration or a list of multiple server configurations.
get_mcp_tools
method.
MCPServerAdapter
primarily supports adapting MCP tools
.
Other MCP primitives like prompts
or resources
are not directly integrated as CrewAI components through this adapter at this time..content[0].text
). Complex or multi-modal outputs might require custom handling if not fitting this pattern.