# CrewAI

> Give CrewAI agents live web search, news, agentic search, and page reading by connecting them to the hosted Search1API MCP server.

Canonical URL: https://s1.dev/docs/integrations/crewai

CrewAI agents can use Search1API through the hosted [MCP server](https://s1.dev/docs/integrations/mcp)
at `https://mcp.search1api.com/mcp`. No extra package is needed: CrewAI's
`mcps` field connects to the server, discovers its tools, and hands them to
the agent. You get web search, news, agentic search, and page reading from one
connection.

## Install

```bash
pip install crewai mcp
```

Create a key in the [dashboard](https://app.s1.dev), then export it:

```bash
export SEARCH1API_API_KEY="your-api-key"
```

## Add Search1API to an agent

Pass an `MCPServerHTTP` configuration with the key in the `Authorization`
header. The tool filter keeps the agent to the tools a research crew needs.

```python
import os

from crewai import Agent, Crew, Task
from crewai.mcp import MCPServerHTTP
from crewai.mcp.filters import create_static_tool_filter

search1api = MCPServerHTTP(
    url="https://mcp.search1api.com/mcp",
    headers={"Authorization": f"Bearer {os.environ['SEARCH1API_API_KEY']}"},
    tool_filter=create_static_tool_filter(
        allowed_tool_names=["search", "news", "ask", "crawl"]
    ),
    cache_tools_list=True,
)

researcher = Agent(
    role="Research Analyst",
    goal="Answer questions with current, cited sources from the web",
    backstory="You search first, read the most relevant pages, and cite every claim.",
    mcps=[search1api],
)

task = Task(
    description="What changed in CrewAI this month? Read the release notes before answering.",
    expected_output="A short summary with a source URL for each change",
    agent=researcher,
)

result = Crew(agents=[researcher], tasks=[task]).kickoff()
print(result)
```

The agent picks a model the usual CrewAI way, from `llm=` or your environment.

## Tools

The server exposes the same tools to CrewAI as to any MCP client. The ones most
useful for agents:

| Tool | What it does | Credits |
| --- | --- | --- |
| `search` | Web search across engines such as Google, Bing, Reddit, GitHub, and YouTube | 1 |
| `news` | Recent news articles | 1 |
| `ask` | Describe what you need; Search1API picks the sources and time range | 5 |
| `crawl` | Read a known URL as clean text | 1 |
| `sitemap` | List the links on a site | 1 |
| `deepcrawl` | Read many pages of one site, such as a docs section | 20 per task |

`maps` and `trending` are also available. See the [MCP server](https://s1.dev/docs/integrations/mcp)
page for every tool and its inputs, and [Credits and limits](https://s1.dev/docs/essentials/credits-and-limits)
for current rates.

Two tools are meant for chat apps rather than agents: `render_results` draws
source cards in a client UI, and `send_feedback` reports problems to the
Search1API team. Leave them out of `allowed_tool_names` for crews.

> **info:** CrewAI prefixes each tool with the server name, so the agent sees names such as
> `mcp_search1api_com_mcp_search`. Tool filters use the plain names shown above.

## Quick setup with a URL

For a quick test, CrewAI also accepts the server as a string. Add `#search` to
load only one tool:

```python
researcher = Agent(
    role="Research Analyst",
    goal="Answer questions with current sources",
    backstory="You search before you answer.",
    mcps=[f"https://mcp.search1api.com/mcp?apiKey={os.environ['SEARCH1API_API_KEY']}#search"],
)
```

This puts the key in a URL, where it can end up in logs. Use the header
configuration above for anything you deploy.

## CrewBase projects

In a project created with `crewai create crew`, set `mcps` on the agent inside
its `@agent` method:

```python
@agent
def researcher(self) -> Agent:
    return Agent(config=self.agents_config["researcher"], mcps=[search1api])
```

> **warn:** Prefer `mcps` over `mcp_server_params` and `MCPServerAdapter`. With
> `crewai-tools` 1.15, the adapter sends unset optional arguments as `null`, and
> `search` and `news` calls are rejected with an input validation error on
> `time_range`. The `mcps` field does not have this problem.

## Related

- [MCP server](https://s1.dev/docs/integrations/mcp): authentication, OAuth, and every tool
- [LangChain](https://s1.dev/docs/integrations/langchain): native tools for LangChain agents
- [CrewAI MCP documentation](https://docs.crewai.com/en/mcp/overview)