Menu

Integrations / Voice agents

Pipecat

MillionShort search inside a Pipecat voice bot, through the hosted MCP server or a direct function, in Python.

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

Pipecat's MCPClient connects to the MillionShort MCP server, reads its tools and hands them to the LLM service with their handlers attached. The bot then gets the server's tools, search, get_domain_info, list_sources and the tools of the other endpoints (the MCP page lists them all), or only the ones you name. With no MCP at all, a direct function that calls the API does the same job.

Spoken answers work best with few results: ask for num_results 3 and max_highlights 1, so the model reads short passages rather than long text. Each search also adds a little latency to the turn it runs in.

1Install

Python
pip install "pipecat-ai[mcp]"
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY

MCPClient needs version 2.1.1 or later of the MCP Python SDK, which the mcp extra installs. Build the rest of the bot (transport, speech-to-text, LLM, text-to-speech) as in Pipecat's quickstart. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself.

2Connect the server

tools() opens the connection on its first call and returns the tools, ready for the context. The connection closes when the pipeline ends. Without a key, leave the headers out.

Python
import os

from mcp.client.session_group import StreamableHttpParameters
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
from pipecat.services.mcp_service import MCPClient


async def millionshort_context():
    mcp = MCPClient(
        server_params=StreamableHttpParameters(
            url="https://mcp.millionshort.com/mcp",
            headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
        ),
        tools_filter=["search"],
        tools_arguments={"search": {"num_results": 3, "max_highlights": 1}},
    )
    context = LLMContext(tools=await mcp.tools())
    return context, LLMContextAggregatorPair(context)

tools_filter offers the model only search. tools_arguments fixes num_results and max_highlights on every call and hides them from the model, so it cannot ask for more than a spoken answer needs.

3Give the tools to the bot

Put the two aggregators around the LLM service in the pipeline, as for any Pipecat tool:

Python
from pipecat.pipeline.pipeline import Pipeline


def build_pipeline(transport, stt, llm, tts, aggregators):
    user_aggregator, assistant_aggregator = aggregators
    return Pipeline([
        transport.input(),
        stt,
        user_aggregator,
        llm,
        tts,
        transport.output(),
        assistant_aggregator,
    ])

Tell the LLM service when to search in its system instruction, and to answer in a few short sentences.

4Check it works

To see the tools without a model, list them from the client:

Python
import asyncio
import os

from mcp.client.session_group import StreamableHttpParameters
from pipecat.services.mcp_service import MCPClient


async def main():
    params = StreamableHttpParameters(url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"})
    async with MCPClient(server_params=params) as mcp:
        print([tool.name for tool in (await mcp.tools()).standard_tools])  # search, get_domain_info, list_sources, ...


asyncio.run(main())

Then run the bot and ask a question that needs the web: the answer should name pages it found. If the model answers from memory, say when to search in its instructions:

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.

Without MCP: a direct function

A direct function is both the handler and the schema; Pipecat reads the name, the description and the arguments from its signature and docstring.

Python
import os

import aiohttp
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.services.llm_service import FunctionCallParams


async def millionshort_search(params: FunctionCallParams, query: str):
    """Search the web with MillionShort, leaving out the 1,000 most popular sites.

    Args:
        query: What to search for.
    """
    async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=15)) as http:
        async with http.post(
            "https://api.millionshort.com/v1/search",
            headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
            json={"query": query, "remove_top_sites": 1000, "num_results": 3, "max_highlights": 1},
        ) as response:
            response.raise_for_status()
            results = (await response.json())["data"]["results"]
    await params.result_callback([{"title": r["title"], "url": r["url"], "highlights": r.get("highlights")} for r in results])


context = LLMContext(tools=[millionshort_search])

aiohttp is installed with Pipecat. Use the context's aggregator pair in the pipeline, as in step 3.

MCP configuration

The same address for every client: https://mcp.millionshort.com/mcp, streamable HTTP.

ModeHowWhat the agent gets
API keySend Authorization: Bearer ms-YOUR_API_KEYEvery tool, at your plan's limits; calls use your credits
No keySend no Authorization headersearch, list_sources and a few more; one source and up to 5 results a search, 10 free searches a day

Tools

ToolWhat it doesWithout a keyCost
searchSearches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filtersYes: one source, up to 5 results1 credit per source searched, first 10 results
get_domain_infoPopularity and risk for up to 25 sitesNo1 credit
list_sourcesThe sources, page types and topics search acceptsYes: source namesFree
The tools of the other endpointsextract, map, crawl, places and more: the MCP page lists themA few, such as placesWhat the API call behind each costs

Settings

VariableMeaning
MILLIONSHORT_API_KEYYour 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.

When it fails

What you seeWhyFix
The server does not connect, or no tools are listedThe address or the transport is not the one the server speaksUse 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 upAdd a key: it is free in the dashboard
INSUFFICIENT_CREDITSThe plan's credits are used upStop and add credits; retrying does not help
The agent answers from memory, or uses another searchNothing told it when to use this oneTurn off its own search where it can be (this page says how), and add the line for its instructions
The bot never calls the toolsThe tools were not put in the LLMContext the aggregators usePass await mcp.tools() to LLMContext(tools=...) and use that context's aggregator pair
Connecting times outStreamableHttpParameters waits 5 seconds by defaultPass a longer timeout
Long pauses before spoken answersMany results or long text for the model to readFix num_results 3 and max_highlights 1 with tools_arguments

This page as Markdown ยท llms.txt