# CrewAI

Give a CrewAI agent the OrcaRouter tool catalog through MCPServerAdapter, so it can find and run tools while it works on a task.

|  |  |
| --- | --- |
| Kind | framework |
| Connects through | mcp |
| Docs | <https://docs.crewai.com/en/mcp/overview> |

## Install

1. Install the packages: `pip install crewai "crewai-tools[mcp]"`.
2. Set `ORCAROUTER_API_KEY` to an API key from your OrcaRouter console. It pays for the agent's model, reached through OrcaRouter's OpenAI-compatible API, and for the tools; Node.js 18 or later runs the MCP server through `npx`.
3. Open the server with `MCPServerAdapter` and give its tools to your agents.

## Code

### A crew with the OrcaRouter MCP server

```python
import os

from crewai import LLM, Agent, Crew, Task
from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters

server = StdioServerParameters(
    command="npx",
    args=["-y", "@orcarouter/mcp"],
    env={"ORCAROUTER_API_KEY": os.environ["ORCAROUTER_API_KEY"]},
)
# The agent's model, through OrcaRouter's OpenAI-compatible API, on the same key:
# "openai/" picks CrewAI's OpenAI-compatible client, the rest is OrcaRouter's model id.
llm = LLM(
    model="openai/openai/gpt-5-mini",
    base_url="https://api.orcarouter.ai/v1",
    api_key=os.environ["ORCAROUTER_API_KEY"],
)

with MCPServerAdapter(server) as tools:
    researcher = Agent(
        role="Social media researcher",
        goal="Answer questions about social accounts with live figures",
        backstory="You look up live data with the OrcaRouter tool catalog.",
        tools=tools,
        llm=llm,
    )
    task = Task(
        description="How many followers does @nasa have on TikTok?",
        expected_output="The follower count and the tool that returned it.",
        agent=researcher,
    )
    print(Crew(agents=[researcher], tasks=[task]).kickoff())
```

## Recipes

- [Track competitor TikTok accounts](https://www.orcarouter.ai/tools/recipes/track-competitor-tiktok-accounts.md): Pull each competitor's TikTok profile, find its latest videos and read what viewers say, in three tool calls an agent can repeat every week.
- [Monitor brand mentions on the web and TikTok](https://www.orcarouter.ai/tools/recipes/monitor-brand-mentions.md): Search the web and TikTok for your brand, then read the comments under the posts that mention it: a daily brand check an agent can run on its own.
- [Enrich a lead list](https://www.orcarouter.ai/tools/recipes/enrich-a-lead-list.md): Turn a list of company domains into firmographics, a contact's work email and a recent news hook, with one API key.

## Related integrations

- [LangChain](https://www.orcarouter.ai/tools/integrations/langchain.md): Load OrcaRouter tools as LangChain tools from the functions export and give them to any LangChain agent; each call runs the tool through OrcaRouter.
- [LlamaIndex](https://www.orcarouter.ai/tools/integrations/llamaindex.md): Load the OrcaRouter MCP server's tools with McpToolSpec and use them in a LlamaIndex FunctionAgent.
- [OpenAI Agents SDK](https://www.orcarouter.ai/tools/integrations/openai-agents-sdk.md): Wrap each OrcaRouter tool in a FunctionTool with its own JSON schema and run it from an Agents SDK agent, with the model served through OrcaRouter too.

---

Markdown version of https://www.orcarouter.ai/tools/integrations/crewai
