Menu

Integrations / Model APIs

Anthropic

MillionShort search for Claude in the Messages API, through the MCP connector or a tool the SDK's tool runner calls, in Python and TypeScript.

Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)

MCPPython and TypeScriptNothing of ours to installWorks with no keyChecked 2026-11-19

The MCP connector lets the Messages API connect to the MillionShort MCP server for you: Anthropic's servers list the server's tools (the MCP page lists them) and call them while Claude works, in one request. If you would rather run the search in your own process, the SDK's tool runner calls a plain function for Claude and loops until it is done.

1Install

Choose one
Shell
pip install anthropic requests
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY

The SDK reads your Anthropic key from ANTHROPIC_API_KEY. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself. requests and zod are only for the tool runner further down.

2Connect the server

The connector is in beta: call client.beta.messages.create with the mcp-client-2025-11-20 beta. It takes two halves, and both are required: the server in mcp_servers, and an mcp_toolset in tools that names it. The key goes in authorization_token, which the connector sends to our server as a bearer token. Without a key, leave authorization_token out.

Choose one
Python
import os

import anthropic

client = anthropic.Anthropic()
response = client.beta.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    betas=["mcp-client-2025-11-20"],
    mcp_servers=[{
        "type": "url",
        "url": "https://mcp.millionshort.com/mcp",
        "name": "millionshort",
        "authorization_token": os.environ["MILLIONSHORT_API_KEY"],
    }],
    tools=[{"type": "mcp_toolset", "mcp_server_name": "millionshort"}],
    messages=[{"role": "user", "content": "Find independent blogs about home espresso, without the 1,000 most popular sites."}],
)
print("".join(block.text for block in response.content if block.type == "text"))

Anthropic's servers make the calls, so our server must be reachable from the internet, which it is. The connector speaks streamable HTTP, which is what our server speaks.

Claude's own web search is a server tool that runs only when you list it in tools, so leave it out. Claude calls a connected tool when the request maps to what the tool does; to make that reliable, put a line like this in system:

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.

To offer only some of the tools, turn them all off in the toolset's default_config and turn the ones you want back on in its configs, keyed by tool name (each with "enabled": true).

4Check it works

Each tool call shows up in the response's content as an mcp_tool_use block, followed by an mcp_tool_result block with what our server sent back:

Choose one
Python
import os

import anthropic

response = anthropic.Anthropic().beta.messages.create(
    model="claude-opus-5-5",
    max_tokens=16000,
    betas=["mcp-client-2025-11-20"],
    mcp_servers=[{"type": "url", "url": "https://mcp.millionshort.com/mcp", "name": "millionshort", "authorization_token": os.environ["MILLIONSHORT_API_KEY"]}],
    tools=[{"type": "mcp_toolset", "mcp_server_name": "millionshort"}],
    messages=[{"role": "user", "content": "Search MillionShort for home espresso blogs."}],
)
for block in response.content:
    if block.type == "mcp_tool_use":
        print(block.server_name, block.name, block.input)  # millionshort search {...}
    elif block.type == "mcp_tool_result":
        print("error" if block.is_error else "ok")

To try it, ask:

Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links.

Without MCP: the tool runner

The SDK's tool runner (also in beta) turns a function into a tool, runs it when Claude asks, and loops until Claude stops asking. Your process makes the search, so this works where the connector is not available.

Choose one
Python
import json
import os

import anthropic
import requests
from anthropic import beta_tool


@beta_tool
def millionshort_search(query: str) -> str:
    """Search the web with MillionShort, leaving out the 1,000 most popular sites.

    Args:
        query: What to search for.
    """
    r = requests.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": 5},
        timeout=30,
    )
    r.raise_for_status()
    return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]])


runner = anthropic.Anthropic().beta.messages.tool_runner(
    model="claude-opus-5-5",
    max_tokens=16000,
    tools=[millionshort_search],
    messages=[{"role": "user", "content": "Find independent blogs about home espresso."}],
)
final = runner.until_done()
print("".join(block.text for block in final.content if block.type == "text"))

In Python you can also iterate the runner (for message in runner:) to see each turn as it happens.

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 authorization_token out for the no-key mode
ANTHROPIC_API_KEYYour Anthropic key, read by the SDK

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
400 naming mcp_servers or the toolsetOne half is missing, or mcp_server_name does not match the server's nameSend both, with the same name, and the mcp-client-2025-11-20 beta
The connector fails, the tool runner worksAnthropic's servers could not reach ours, or the connector is not offered where you call ClaudeTry again, or use the tool runner

This page as Markdown ยท llms.txt