Adapt MCP servers to many agentic framework.
Project description
MCPAdapt
Unlock 650+ MCP servers tools in your favorite agentic framework.
Model Context Protocol is an open-source protocol introduced by Anthropic which allows anyone to simply and quickly make tools and resources available as "MCP Servers".
Since its release more than 650 MCP servers have been created giving access to many data & tools to supported "MCP Client".
This project makes calling any MCP servers tools seemless from any agentic framework. Virtually providing your agentic worfklow access to 650+ MCP servers tools.
Look at glama.ai or smithery.ai to give you an idea of what your agent could access.
Installation Instructions
Smolagents
Smolagents 1.4.1 and above directly ships with mcpadapt integrated in their tool collections object. It means you can directly use it from smolagents:
uv add smolagents[mcp]
Other Frameworks
Each agent framework has its own set of optional dependencies to not clutter with useless dependencies. You choose the flavor you want by adding your framework in brackets in the installation command.
# with uv
uv add mcpadapt[langchain]
# or with pip
pip install mcpadapt[langchain]
Framework supported at the moment: smolagents, langchain.
You can also add multiple framework comma separated if needed.
Usage
Smolagents
Since mcpadapt is part of smolagents simple use tool collection from smolagents like:
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 adapt any MCP servers into tools that you can use right in your agentic workflow:
from mcp import StdioServerParameters
from mcpadapt.core import MCPAdapt
from mcpadapt.smolagents_adapter import SmolAgentsAdapter
with MCPAdapt(
# specify the command to run your favorite MCP server (support also smithery and co.)
StdioServerParameters(command="uv", args=["run", "src/echo.py"]),
# specify the adapter you want to use to adapt MCP into your tool in this case smolagents.
SmolAgentsAdapter(),
) as tools:
# enjoy your smolagents tools as if you wrote them yourself
...
MCP Adapt supports Smolagents, Langchain, [pydantic.dev, Llammaindex and more...]*. *coming soon.
See our examples for more details on how to use.
Contribute
If your favorite agentic framework is missing no problem add it yourself it's quite easy:
- 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:
# HERE implement how the adapter should convert a simple function and mcp_tool (JSON Schema)
# into your framework tool. see smolagents_adapter.py for an example
def async_adapt(
self,
afunc: Callable[[dict | None], Coroutine[Any, Any, mcp.types.CallToolResult]],
mcp_tool: mcp.types.Tool,
) -> YourFramework.Tool:
# if your framework supports async function even better use async_adapt.
- and that's it, test that your adapter is working and send us a PR to share it with the world.
Roadmap
- initial framework for anyone to start 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcpadapt-0.0.9.tar.gz.
File metadata
- Download URL: mcpadapt-0.0.9.tar.gz
- Upload date:
- Size: 183.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad28be0278ad4e50f957d4a0a91402c39ec72b05a8bb70bbebd304b4784fd19e
|
|
| MD5 |
88bbdfd2eb25e02140e965388987562c
|
|
| BLAKE2b-256 |
6d33a2e1bcda3a8cffd7d7ef8497fdfd57a9ac2a6cb13cf1e7bf96284e2f0c3c
|
Provenance
The following attestation bundles were made for mcpadapt-0.0.9.tar.gz:
Publisher:
release.yml on grll/mcpadapt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpadapt-0.0.9.tar.gz -
Subject digest:
ad28be0278ad4e50f957d4a0a91402c39ec72b05a8bb70bbebd304b4784fd19e - Sigstore transparency entry: 163377757
- Sigstore integration time:
-
Permalink:
grll/mcpadapt@320b696754c2dfafcab940d7f7e66d587d8c3deb -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/grll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@320b696754c2dfafcab940d7f7e66d587d8c3deb -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcpadapt-0.0.9-py3-none-any.whl.
File metadata
- Download URL: mcpadapt-0.0.9-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bdb9adb01f96a289ff7bd1d7ae337f85452e68a9e2ff1e0822ae3541ad80169
|
|
| MD5 |
096f269bfdea34c2eec5c802e591ba48
|
|
| BLAKE2b-256 |
fb68f7971e95b34f8d40a7ed4f825887c4a16de4266bc9edafab125b72a3d072
|
Provenance
The following attestation bundles were made for mcpadapt-0.0.9-py3-none-any.whl:
Publisher:
release.yml on grll/mcpadapt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcpadapt-0.0.9-py3-none-any.whl -
Subject digest:
3bdb9adb01f96a289ff7bd1d7ae337f85452e68a9e2ff1e0822ae3541ad80169 - Sigstore transparency entry: 163377758
- Sigstore integration time:
-
Permalink:
grll/mcpadapt@320b696754c2dfafcab940d7f7e66d587d8c3deb -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/grll
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@320b696754c2dfafcab940d7f7e66d587d8c3deb -
Trigger Event:
release
-
Statement type: