CrewAI MCP Adapter

CrewAI MCP Adapter

By dshivendra GitHub

-

Overview

what is CrewAI MCP Adapter?

CrewAI MCP Adapter is a Python library that extends CrewAI's adapter ecosystem by integrating support for the Model Context Protocol (MCP) and providing comprehensive tooling for custom agent and tool development.

how to use CrewAI MCP Adapter?

To use the CrewAI MCP Adapter, install it via PyPI or from source, and then utilize the provided classes and methods to create agents and execute tasks with integrated tools.

key features of CrewAI MCP Adapter?

  • Native CrewAI integration and adapter patterns
  • MCP protocol support for tool integration
  • Easy-to-use interface for extending and creating new adapters
  • Type-safe implementation with Pydantic
  • JSON Schema validation for tool parameters
  • Async/await support
  • Detailed execution metadata

use cases of CrewAI MCP Adapter?

  1. Developing custom agents for specific tasks in AI applications.
  2. Integrating various tools into a unified agent framework.
  3. Performing complex calculations and data processing tasks asynchronously.

FAQ from CrewAI MCP Adapter?

  • What is the Model Context Protocol (MCP)?

MCP is a protocol designed to facilitate the integration of various tools and agents in AI applications.

  • Is CrewAI MCP Adapter free to use?

Yes! CrewAI MCP Adapter is open-source and available under the MIT License.

  • What are the prerequisites for using CrewAI MCP Adapter?

You need Python 3.11 or higher, along with the crewai, pydantic, and mcp packages.

Content

CrewAI MCP Adapter

A Python library extending CrewAI's adapter ecosystem with Model Context Protocol (MCP) integration support and comprehensive tooling for custom agent and tool development.

Features

  • 🔌 Native CrewAI integration and adapter patterns
  • 🛠️ MCP protocol support for tool integration
  • 🧩 Easy-to-use interface for extending and creating new adapters
  • 📝 Type-safe implementation with Pydantic
  • 🔍 JSON Schema validation for tool parameters
  • 🚀 Async/await support
  • 📊 Detailed execution metadata

Installation

You can install the package directly from PyPI:

pip install crewai-adapters

Or install from source:

pip install git+https://github.com/dshivendra/crewai_mcp_adapter.git

Quick Start

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())

Documentation

For detailed documentation, see:

Development

Prerequisites

  • Python 3.11 or higher
  • crewai package
  • pydantic package
  • mcp package

Install Development Dependencies

pip install -e ".[test,docs]"

Running Tests

pytest tests/ -v

Publishing

To publish a new version to PyPI:

  1. Update version in pyproject.toml
  2. Build the package:
    python -m build
    
  3. Upload to PyPI:
    python -m twine upload dist/*
    

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

No tools information available.
No content found.