> For the complete documentation index, see [llms.txt](https://docs.allmcp.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allmcp.co/documentation/agent-frameworks/crewai.md).

# CrewAI

Use AllMCP tools in CrewAI agents via `langchain-mcp-adapters`.

{% hint style="info" %}
**Connect a provider first.** The examples below assume the CRM (Bitrix24) is already connected for your user. To connect one, ask your agent to connect it by name, or connect it from your AllMCP dashboard. Once connected, that provider's tools become available to your crew automatically.
{% endhint %}

***

## Install

{% code title="install" %}

```bash
pip install crewai langchain-mcp-adapters langchain-anthropic
```

{% endcode %}

{% hint style="info" %}
**Adapter, not native.** CrewAI reaches AllMCP through `langchain-mcp-adapters` — `client.get_tools()` returns LangChain-compatible tools you hand straight to an `Agent`.
{% endhint %}

***

## Minimal example

{% code title="agent.py" overflow="wrap" %}

```python
import asyncio
from crewai import Agent, Task, Crew
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_anthropic import ChatAnthropic


async def run_crm_crew():
    client = MultiServerMCPClient({
        "allmcp": {
            "url": "https://go.allmcp.co/mcp/",
            "transport": "streamable_http",
            "headers": {"X-API-Key": "YOUR_API_KEY"},
        }
    })
    tools = await client.get_tools()
    llm = ChatAnthropic(model="claude-sonnet-4-6")

    crm_agent = Agent(
        role="CRM Analyst",
        goal="Analyze sales pipeline and surface actionable insights",
        backstory="You are an expert sales analyst with deep CRM knowledge.",
        tools=tools,
        llm=llm,
        verbose=True,
    )

    task = Task(
        description=(
            "List all open deals in Bitrix24, group them by stage, "
            "and identify the top 3 deals most likely to close this week."
        ),
        expected_output="A ranked list of top 3 deals with reasoning.",
        agent=crm_agent,
    )

    crew = Crew(agents=[crm_agent], tasks=[task], verbose=True)
    result = crew.kickoff()
    return result


asyncio.run(run_crm_crew())
```

{% endcode %}

***

## Multi-agent crew

{% code title="sales\_ops\_crew\.py" overflow="wrap" %}

```python
async def run_sales_ops_crew():
    client = MultiServerMCPClient({
        "allmcp": {
            "url": "https://go.allmcp.co/mcp/",
            "transport": "streamable_http",
            "headers": {"X-API-Key": "YOUR_API_KEY"},
        }
    })
    tools = await client.get_tools()
    llm = ChatAnthropic(model="claude-sonnet-4-6")

    researcher = Agent(
        role="Sales Researcher",
        goal="Pull raw data from the CRM",
        tools=tools,
        llm=llm,
    )

    analyst = Agent(
        role="Sales Analyst",
        goal="Identify trends and insights from CRM data",
        llm=llm,
    )

    gather_task = Task(
        description="List all leads created in the last 7 days with their source and status.",
        expected_output="Raw list of leads with source and status fields.",
        agent=researcher,
    )

    analyze_task = Task(
        description="Based on the leads data, identify the top 2 lead sources by conversion rate.",
        expected_output="Top 2 lead sources with conversion rates.",
        agent=analyst,
        context=[gather_task],
    )

    crew = Crew(
        agents=[researcher, analyst],
        tasks=[gather_task, analyze_task],
    )
    return crew.kickoff()
```

{% endcode %}

***

## Multi-user setup

{% hint style="info" icon="users" %}
**One client per user.** Append `?user_id=<id>` to the endpoint so each crew acts as that user and only sees the providers that user has connected.
{% endhint %}

{% code title="multi\_user.py" overflow="wrap" %}

```python
def make_crew_for_user(user_id: str):
    return MultiServerMCPClient({
        "allmcp": {
            "url": f"https://go.allmcp.co/mcp/?user_id={user_id}",
            "transport": "streamable_http",
            "headers": {"X-API-Key": "YOUR_API_KEY"},
        }
    })
```

{% endcode %}

***

## Related

{% content-ref url="/pages/uBaUeZYQpupBMd5c1BY0" %}
[Overview](/documentation/agent-frameworks/frameworks.md)
{% endcontent-ref %}

{% content-ref url="/pages/QJVxDLqxIz5KMCH5afbE" %}
[All Providers](/documentation/providers/providers.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allmcp.co/documentation/agent-frameworks/crewai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
