Menu

Integrations / Model APIs

OpenAI

MillionShort search in the OpenAI Responses API, as a remote MCP tool or a function tool, 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 Responses API connects to the MillionShort MCP server for you: list it as an mcp tool and OpenAI's servers call the server's tools (search, get_domain_info, list_sources and the tools of the other endpoints; the MCP page lists them all) while the model works, all in one request. If you would rather run the search yourself, a function tool that calls the API does the same job.

1Install

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

The SDK reads your OpenAI key from OPENAI_API_KEY. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself. requests is only for the function tool further down.

2Connect the server

Add the server as an mcp tool, with the key in its authorization field. OpenAI does not store that field's value and does not show it in the response object (a key in headers gets no such promise), so send it with every request. Without a key, leave authorization out.

Choose one
Python
import os

from openai import OpenAI

client = OpenAI()
response = client.responses.create(
    model="gpt-6.2-astra",
    input="Find independent blogs about home espresso, without the 1,000 most popular sites.",
    tools=[
        {
            "type": "mcp",
            "server_label": "millionshort",
            "server_description": "Web search that can leave out the most popular sites.",
            "server_url": "https://mcp.millionshort.com/mcp",
            "authorization": os.environ["MILLIONSHORT_API_KEY"],
            "require_approval": "never",
        }
    ],
)
print(response.output_text)

require_approval defaults to always; with never, every tool of the server runs without asking. Most of them only read; crawl spends credits, crawl_cancel stops a crawl and create_space saves a Space, so keep always if the model should not do those unasked. OpenAI's servers make the calls, so our server must be reachable from the internet, which it is.

Built-in web search is a separate tool in the Responses API: it runs only when you list it in tools, so leave it out. Then put a line like this in the request's 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.

To offer only some of the tools, add "allowed_tools": ["search", "list_sources"] to the mcp tool.

4Check it works

The response's output holds an mcp_list_tools item with the server's tools, then one mcp_call item per tool call. Print them:

Choose one
Python
import os

from openai import OpenAI

server = {"type": "mcp", "server_label": "millionshort", "server_url": "https://mcp.millionshort.com/mcp", "require_approval": "never",
          "authorization": os.environ["MILLIONSHORT_API_KEY"]}
response = OpenAI().responses.create(model="gpt-6.2-astra", input="Search for home espresso blogs.", tools=[server])
for item in response.output:
    if item.type == "mcp_list_tools":
        print([tool.name for tool in item.tools])  # search, get_domain_info, list_sources, ...
    elif item.type == "mcp_call":
        print(item.name, item.arguments)

With no key you see two tools, search and list_sources. 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: a function tool

Your code runs the search and hands the results back, so this works wherever the Responses API runs, and our server need not be reachable from OpenAI. The loop ends when the model stops asking for the tool.

Choose one
Python
import json
import os

import requests
from openai import OpenAI


def millionshort_search(query: str) -> str:
    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"]])


tools = [{
    "type": "function",
    "name": "millionshort_search",
    "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.",
    "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"], "additionalProperties": False},
    "strict": True,
}]
client = OpenAI()
items = [{"role": "user", "content": "Find independent blogs about home espresso."}]
while True:
    response = client.responses.create(model="gpt-6.2-astra", tools=tools, input=items)
    items += response.output
    calls = [item for item in response.output if item.type == "function_call"]
    if not calls:
        break
    for call in calls:
        items.append({"type": "function_call_output", "call_id": call.call_id, "output": millionshort_search(**json.loads(call.arguments))})
print(response.output_text)

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
OPENAI_API_KEYYour OpenAI 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.

On OpenAI's side you pay for the tokens that importing the tool list and making the calls use; OpenAI charges no fee per tool call.

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
Nothing is called and the output has an mcp_approval_requestrequire_approval was left at its default, alwaysSet "require_approval": "never"
The MCP tool fails, the function tool worksOpenAI's servers could not reach ours, or the model does not take MCP toolsTry again, or use the function tool

This page as Markdown ยท llms.txt