mcpadapt
by: grll
Unlock 650+ MCP servers tools in your favorite agentic framework.
📌Overview
Purpose: MCPAdapt aims to facilitate seamless access to over 650 MCP servers tools from various agentic frameworks, enhancing the capabilities of applications using the Model Context Protocol (MCP).
Overview: MCPAdapt is an open-source framework designed to integrate MCP servers into agentic workflows effortlessly. By leveraging the Model Context Protocol introduced by Anthropic, it allows developers to easily utilize a diverse range of tools and resources encapsulated in MCP servers. This adaptability prompts a significant increase in the operational efficiency and effectiveness of agentic applications.
Key Features:
-
Seamless Integration: MCPAdapt simplifies the interaction with MCP servers, allowing users to execute server tools directly within their preferred agentic frameworks like Smolagents, Langchain, and CrewAI.
-
Broad Compatibility: The framework supports multiple agent frameworks and offers the flexibility to install dependencies tailored to specific frameworks, ensuring a clean setup without unnecessary bloat.
-
Extensible Architecture: MCPAdapt provides an easy mechanism for developers to create custom adapters for new frameworks, thus enhancing its extensibility and community contributions.
MCPAdapt
Unlock 650+ MCP server tools in your favorite agentic framework.
What is MCP?
Model Context Protocol (MCP) is an open-source protocol introduced by Anthropic. It allows for the simple and quick creation of tools and resources known as "MCP Servers". Since its release, over 650 MCP servers have been created, providing access to numerous data and tools for supported "MCP Clients". This project facilitates seamless access to all MCP server tools from any agentic framework.
Installation Instructions
Smolagents
For Smolagents version 1.4.1 and above, MCPAdapt is integrated into the tool collections. You can install it directly with:
uv add smolagents[mcp]
Other Frameworks
Different agent frameworks have their unique optional dependencies. To install MCPAdapt for a specific framework, use the following command, replacing framework
with your desired option:
uv add mcpadapt[framework]
or
pip install mcpadapt[framework]
Supported frameworks include: Smolagents, Langchain, and CrewAI. You can also specify multiple frameworks by separating them with commas.
Usage
⚠️ Security Warning: Be cautious when connecting to MCP servers, especially via SSE (Server-Sent Events). Always verify the source and security of any MCP server before connecting.
Smolagents
Using MCPAdapt within Smolagents is straightforward:
from mcp import StdioServerParameters
from smolagents.tools import ToolCollection
serverparams = StdioServerParameters(command="uv", args=["run", "src/echo.py"])
with ToolCollection.from_mcp(serverparams) as tool_collection:
... # Enjoy your tools!
Other Frameworks
MCPAdapt allows you to transform any MCP server into tools usable in your agentic workflow:
from mcp import StdioServerParameters
from mcpadapt.core import MCPAdapt
from mcpadapt.smolagents_adapter import SmolAgentsAdapter
with MCPAdapt(
StdioServerParameters(command="uv", args=["run", "src/echo.py"]),
SmolAgentsAdapter(),
) as tools:
... # Enjoy your tools!
Contributing
If your preferred agentic framework is not supported, you can easily add it:
- Create a new module in
src/mcpadapt/{name_of_your_framework}_adapter.py
:
class YourFrameworkAdapter(ToolAdapter):
def adapt(self, func: Callable[[dict | None], mcp.types.CallToolResult], mcp_tool: mcp.types.Tool) -> YourFramework.Tool:
# Implement the logic for adapting a function for your framework.
def async_adapt(self, afunc: Callable[[dict | None], Coroutine[Any, Any, mcp.types.CallToolResult]], mcp_tool: mcp.types.Tool) -> YourFramework.Tool:
# Implement async adaptation if supported by your framework.
- Test your adapter and submit a PR to share it with the community.
Roadmap
- Initial framework for creating adapters
- Support for Smolagents
- Support for Pydantic-AI
- Support for Langchain
- Support for Llamaindex
- Support for Swarm
- Support for CrewAI
- Support for remote MCP Servers via SSE
- Support for Jupyter Notebook
- Add tests