Files
crewAI/lib
Devin AI fa09175b17 feat: Add MCPTool.from_server() API for simplified MCP tool integration
This commit implements the MCPTool class with a from_server() class method
that provides a user-friendly API for connecting to MCP servers and getting
tools that can be used with CrewAI agents.

Features:
- Support for server names (npm packages via npx, Python packages via uvx)
- Support for HTTP/SSE URLs
- Support for MCPServerConfig objects (MCPServerStdio, MCPServerHTTP, MCPServerSSE)
- Optional parameters: env, headers, tool_filter, cache_tools_list
- JSON schema to Pydantic model conversion for tool arguments
- Sync and async tool execution support

Example usage:
  from crewai.tools import MCPTool

  # Connect to MCP servers
  cloud_tools = MCPTool.from_server('@anthropic/mcp-server-filesystem')
  api_tools = MCPTool.from_server('https://api.example.com/mcp')

  # Create agent with MCP tools
  agent = Agent(role='Cloud Engineer', tools=[*cloud_tools, *api_tools])

Closes #4197

Co-Authored-By: João <joao@crewai.com>
2026-01-07 20:38:22 +00:00
..
2025-12-19 15:47:00 -05:00