](https://mseep.ai/app/dshivendra-crewai-mcp-adapter)
CrewAI MCP适配器
一个扩展CrewAI适配器生态系统的Python库 模型上下文协议(MCP) 为自定义代理和工具开发提供集成支持和全面的工具集。
功能
- 🔌 与CrewAI的原生集成及适配器模式
- 🛠️ 支持工具集成的MCP协议
- 易于使用的界面,用于扩展和创建新的适配器
- 使用 Pydantic 实现类型安全
- 工具参数的JSON Schema验证
- 🚀 支持异步/await
- 📊 详细的执行元数据
安装
您可以直接从PyPI安装该包:
pip install crewai-adapters或者从源代码安装:
pip install git+https://github.com/dshivendra/crewai_mcp_adapter.git快速入门
from crewai import Agent, Task
from crewai_adapters import CrewAIAdapterClient
from crewai_adapters.types import AdapterConfig
async def main():
async with CrewAIAdapterClient() as client:
# Connect to MCP server
await client.connect_to_mcp_server(
"math",
command="python",
args=["math_server.py"]
)
# Create agent with tools
agent = Agent(
name="Calculator",
goal="Perform calculations",
tools=client.get_tools()
)
# Execute task
task = Task(
description="Calculate (3 + 5) × 12",
agent=agent
)
result = await task.execute()
print(f"Result: {result}")
if __name__ == "__main__":
import asyncio
asyncio.run(main())文档
如需详细文档,请参阅:
开发
先决条件
- Python 3.11或更高版本
crewai包pydantic包mcp包
安装开发依赖项
pip install -e ".[test,docs]"运行测试
pytest tests/ -v出版
要在PyPI上发布新版本:
- 更新 pyproject.toml 中的版本
- 构建包:
python -m build- 上传到PyPI:
python -m twine upload dist/*许可证
这个项目遵循MIT许可协议-详情请参阅LICENSE文件。
贡献
欢迎贡献!请随时提交拉取请求。
