Integrations / Frameworks & SDKs
CrewAI
MillionShort search for CrewAI agents, through the agent's MCP servers or a search tool of your own.
Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)
MCPPythonNothing of ours to installWorks with no keyChecked 2026-11-19
A CrewAI agent takes MCP servers in its mcps field. Add the MillionShort server there as an MCPServerHTTP with the key in a header, and the agent finds the server's tools by itself (the MCP page lists them). With no MCP at all, a custom tool that calls the API does the same job.
1Install
pip install crewai mcp
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEYCrewAI's MCP support needs the mcp library, which is also a dependency of crewai. The examples use an OpenAI model id from CrewAI's docs, so they read OPENAI_API_KEY; any model CrewAI supports works. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself.
2Connect the server
MCPServerHTTP uses streamable HTTP by default. Without a key, leave the headers out. mcps also takes a plain address string, but a string carries no header, so use MCPServerHTTP to send the key.
import os
from crewai import Agent, Crew, Task
from crewai.mcp import MCPServerHTTP
researcher = Agent(
role="Research Analyst",
goal="Find useful pages outside the most popular sites",
backstory="Searches the web with MillionShort and cites every source.",
llm="openai/gpt-5.6-terra",
mcps=[
MCPServerHTTP(
url="https://mcp.millionshort.com/mcp",
headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
cache_tools_list=True,
)
],
)
task = Task(
description="Find independent blogs about home espresso, without the 1,000 most popular sites.",
expected_output="Five blogs, each with its URL and one line on why it is useful.",
agent=researcher,
)
print(Crew(agents=[researcher], tasks=[task]).kickoff())3Give the tools to an agent
The agent's role, goal and backstory are its instructions: say there when to search. CrewAI agents have no web search of their own, so there is nothing to turn off. To give an agent only search, filter the server's tools:
import os
from crewai import Agent
from crewai.mcp import MCPServerHTTP
from crewai.mcp.filters import create_static_tool_filter
researcher = Agent(
role="Research Analyst",
goal="Answer with sources: use the MillionShort search tool for anything recent or niche, and cite the URLs.",
backstory="Searches the web with MillionShort.",
llm="openai/gpt-5.6-terra",
max_iter=10,
mcps=[
MCPServerHTTP(
url="https://mcp.millionshort.com/mcp",
headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
tool_filter=create_static_tool_filter(allowed_tool_names=["search"]),
)
],
)CrewAI puts the server's name in front of each MCP tool's name, so the model sees them under longer names than the server's own. max_iter caps the agent's steps on one task.
A line that works well in the agent's goal or the task description:
Use the MillionShort search tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set remove_top_sites (for example 1000). Cite the URLs it returns.
4Check it works
Run the crew from step 2 with Crew(agents=[researcher], tasks=[task], verbose=True). The log shows the MCP tools CrewAI discovered and each call to search, and the answer should cite pages. If the server cannot be reached, CrewAI logs a warning and the agent goes on without its tools, so check the log before trusting the answer.
Without MCP: a function tool
A function with the @tool decorator calls POST /v1/search; the docstring tells the agent what it does.
import json
import os
import urllib.request
from crewai import Agent, Crew, Task
from crewai.tools import tool
@tool("millionshort_search")
def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str:
"""Search the web with MillionShort. remove_top_sites leaves out the N most popular sites."""
request = urllib.request.Request(
"https://api.millionshort.com/v1/search",
data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(),
headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"},
)
with urllib.request.urlopen(request, timeout=30) as response:
results = json.load(response)["data"]["results"]
return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results])
researcher = Agent(role="Researcher", goal="Find and cite useful pages", backstory="Uses MillionShort.", tools=[millionshort_search])
task = Task(description="Find independent blogs about home espresso.", expected_output="Five URLs with notes.", agent=researcher)
print(Crew(agents=[researcher], tasks=[task]).kickoff())MCP configuration
The same address for every client: https://mcp.millionshort.com/mcp, streamable HTTP (streamable=True, the default in MCPServerHTTP).
| Mode | How | What the agent gets |
|---|---|---|
| API key | Send Authorization: Bearer ms-YOUR_API_KEY | Every tool, at your plan's limits; calls use your credits |
| No key | Send no Authorization header | search, list_sources and a few more; one source and up to 5 results a search, 10 free searches a day |
Tools
| Tool | What it does | Without a key | Cost |
|---|---|---|---|
search | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results |
get_domain_info | Popularity and risk for up to 25 sites | No | 1 credit |
list_sources | The sources, page types and topics search accepts | Yes: source names | Free |
| The tools of the other endpoints | extract, map, crawl, places and more: the MCP page lists them | A few, such as places | What the API call behind each costs |
Settings
| Variable | Meaning |
|---|---|
MILLIONSHORT_API_KEY | Your key, read by the examples above. Leave the header out for the no-key mode |
Costs and limits
A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. Credits and limits has the numbers.
An agent's max_iter (25 by default) is its step limit on one task.
When it fails
| What you see | Why | Fix |
|---|---|---|
| The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly https://mcp.millionshort.com/mcp and the streamable HTTP transport (often called http), not SSE |
401 or "unauthorized" | The key is wrong, or it was sent without Bearer | Send Authorization: Bearer ms-..., or leave the header out to use the no-key mode |
| "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the dashboard |
INSUFFICIENT_CREDITS | The plan's credits are used up | Stop and add credits; retrying does not help |
| The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions |
| The agent works, but without the MillionShort tools | CrewAI skips a server it cannot reach and only logs a warning | Run with verbose=True, check the warning, then the address and the key |
| The agent stops before an answer | It reached max_iter | Raise max_iter, or ask for fewer results per search |
Related
- Agent tool use: when to give a model tools, and what to tell it.
- LangChain, LlamaIndex and Pydantic AI.
- MCP server and Filters for agents.
- CrewAI's own documentation, read on 2026-11-19: MCP servers as tools, Streamable HTTP transport, Tools, LLMs.