{"id":24401591,"url":"https://github.com/grll/mcpadapt","last_synced_at":"2025-05-15T18:03:40.742Z","repository":{"id":272080981,"uuid":"915470479","full_name":"grll/mcpadapt","owner":"grll","description":"Unlock 650+ MCP servers tools in your favorite agentic framework.","archived":false,"fork":false,"pushed_at":"2025-04-06T20:04:09.000Z","size":4546,"stargazers_count":276,"open_issues_count":6,"forks_count":20,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-11T23:16:15.136Z","etag":null,"topics":["langchain","llamaindex","modelcontextprotocol","pydantic-ai","smolagents","swarm"],"latest_commit_sha":null,"homepage":"https://grll.github.io/mcpadapt/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-11T23:23:49.000Z","updated_at":"2025-04-11T18:37:45.000Z","dependencies_parsed_at":"2025-01-12T00:22:12.867Z","dependency_job_id":"29246603-99b2-4633-9d21-8402b65e1ab6","html_url":"https://github.com/grll/mcpadapt","commit_stats":null,"previous_names":["grll/mcpadapt"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fmcpadapt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fmcpadapt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fmcpadapt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fmcpadapt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grll","download_url":"https://codeload.github.com/grll/mcpadapt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492884,"owners_count":21113163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["langchain","llamaindex","modelcontextprotocol","pydantic-ai","smolagents","swarm"],"created_at":"2025-01-20T00:32:16.097Z","updated_at":"2025-05-15T18:03:40.736Z","avatar_url":"https://github.com/grll.png","language":"Python","readme":"# MCPAdapt\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/grll/mcpadapt/blob/main/docs/assets/logo_transparent_cropped.png\" alt=\"MCPAdapt Logo\" width=\"200\"\u003e\n\u003c/p\u003e\n\n![PyPI version](https://img.shields.io/pypi/v/mcpadapt)\n![Python versions](https://img.shields.io/pypi/pyversions/mcpadapt)\n![Tests](https://github.com/grll/mcpadapt/actions/workflows/ci.yml/badge.svg)\n![License](https://img.shields.io/github/license/grll/mcpadapt)\n![PyPI downloads](https://img.shields.io/pypi/dm/mcpadapt)\n![GitHub Repo stars](https://img.shields.io/github/stars/grll/mcpadapt)\n\nFor more context, guides and API references visit our new [documentation](https://grll.github.io/mcpadapt/).\n\nUnlock 650+ MCP servers tools in your favorite agentic framework.\n\nModel 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\".\n\nSince its release more than 650 MCP servers have been created giving access to many data \u0026 tools to supported \"MCP Client\".\n\nThis project makes calling any MCP servers tools seemless from any agentic framework. Virtually providing your agentic worfklow access to 650+ MCP servers tools.\n\nLook at [glama.ai](https://glama.ai/mcp/servers) or [smithery.ai](https://smithery.ai/) to give you an idea of what your agent could access.\n\n## Installation Instructions\n\n### Smolagents\n\nSmolagents 1.4.1 and above directly ships with mcpadapt integrated in their tool collections object.\nIt means you can directly use it from smolagents:\n\n```bash\nuv add smolagents[mcp]\n```\n\n### Other Frameworks\n\nEach agent framework has its own set of optional dependencies to not clutter with useless dependencies.\nYou choose the flavor you want by adding your framework in brackets in the installation command.\n\n```bash\n# with uv\nuv add mcpadapt[langchain]\n\n# or with pip\npip install mcpadapt[langchain]\n```\n\nFramework supported at the moment: smolagents, langchain, crewAI, google-genai.\n\nYou can also add multiple framework comma separated if needed. \n\n## Usage\n\n⚠️ **Security Warning**: When using MCP servers, especially over SSE (Server-Sent Events), be extremely cautious and only connect to trusted and verified servers. Always verify the source and security of any MCP server before connecting.\n\n### Smolagents\n\nSince mcpadapt is part of smolagents simple use tool collection from smolagents like:\n\n```python\nfrom mcp import StdioServerParameters\nfrom smolagents.tools import ToolCollection\n\nserverparams = StdioServerParameters(command=\"uv\", args=[\"run\", \"src/echo.py\"])\n\nwith ToolCollection.from_mcp(serverparams) as tool_collection:\n    ... # enjoy your tools!\n```\n\n### Other Frameworks\n\nMCPAdapt adapt any MCP servers into tools that you can use right in your agentic workflow:\n\n```python\nfrom mcp import StdioServerParameters\nfrom mcpadapt.core import MCPAdapt\nfrom mcpadapt.smolagents_adapter import SmolAgentsAdapter\n\nwith MCPAdapt(\n    # specify the command to run your favorite MCP server (support also smithery and co.)\n    StdioServerParameters(command=\"uv\", args=[\"run\", \"src/echo.py\"]),\n    # or a dict of sse server parameters e.g. {\"url\": http://localhost:8000, \"headers\": ...}\n\n    # specify the adapter you want to use to adapt MCP into your tool in this case smolagents.\n    SmolAgentsAdapter(),\n) as tools:\n    # enjoy your smolagents tools as if you wrote them yourself\n    ...\n```\n\nMCP Adapt supports Smolagents, Langchain, CrewAI, google-genai [pydantic.dev, Llammaindex and more...]*.\n*coming soon.\n\nNote: you can also specify multiple mcp servers as in:\n\n```python\nfrom mcp import StdioServerParameters\nfrom mcpadapt.core import MCPAdapt\nfrom mcpadapt.smolagents_adapter import SmolAgentsAdapter\n\nwith MCPAdapt(\n    [\n        StdioServerParameters(command=\"uv\", args=[\"run\", \"src/echo1.py\"]),\n        StdioServerParameters(command=\"uv\", args=[\"run\", \"src/echo2.py\"]),\n    ],\n    SmolAgentsAdapter(),\n) as tools:\n    # tools is now a flattened list of tools from the 2 MCP servers.\n    ...\n```\n\nWe also support async if the underlying agentic framework supports it.\n\nSee our [examples](https://grll.github.io/mcpadapt/quickstart/#examples) for more details on how to use.\n\n## Contribute\n\nIf your favorite agentic framework is missing no problem add it yourself it's quite easy:\n\n1. create a new module in `src/mcpadapt/{name_of_your_framework}_adapter.py`:\n\n```python\nclass YourFrameworkAdapter(ToolAdapter):\n    def adapt(\n        self,\n        func: Callable[[dict | None], mcp.types.CallToolResult],\n        mcp_tool: mcp.types.Tool,\n    ) -\u003e YourFramework.Tool:\n        # HERE implement how the adapter should convert a simple function and mcp_tool (JSON Schema)\n        # into your framework tool. see smolagents_adapter.py for an example\n    \n    def async_adapt(\n        self,\n        afunc: Callable[[dict | None], Coroutine[Any, Any, mcp.types.CallToolResult]],\n        mcp_tool: mcp.types.Tool,\n    ) -\u003e YourFramework.Tool:\n        # if your framework supports async function even better use async_adapt.\n```\n\n2. and that's it, test that your adapter is working and send us a PR to share it with the world.\n\n## Roadmap\n\n- [x] initial framework for anyone to start creating adapters\n- [x] support for smolagents\n- [ ] support for pydantic-ai\n- [x] support for langchain\n- [ ] support for llamaindex\n- [ ] support for swarm\n- [x] support for crewAI\n- [x] support for google genai\n- [x] support for remote MCP Servers via SSE\n- [x] support for jupyter notebook\n- [x] add tests\n\n## Contributors\n\nWe acknowledge the work and thanks every contributors and maintainers for their contributions.\n\nCore Maintainers:\n\n* [@grll](https://github.com/grll)\n\nContributors:\n\n* [@murawakimitsuhiro](https://github.com/murawakimitsuhiro)\n* [@joejoe2](https://github.com/joejoe2)\n* [@tisDDM](https://github.com/tisDDM)\n* [@sysradium](https://github.com/sysradium)\n","funding_links":[],"categories":["MCP Middleware \u0026 Orchestration","📚 Projects (1974 total)","Python"],"sub_categories":["MCP Servers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrll%2Fmcpadapt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrll%2Fmcpadapt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrll%2Fmcpadapt/lists"}