Groq
MillionShort search for models on Groq, as a remote MCP tool in its Responses API 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
Groq's Responses API is compatible with OpenAI's, remote MCP included: point the OpenAI SDK at Groq, list the MillionShort server as an mcp tool, and Groq lists and calls the server's tools for the model (the MCP page lists them). Groq runs remote MCP on its models that support tool use. For a loop you run yourself, the Groq SDK takes a function tool.
1Install
pip install openai groq requests
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEYnpm install openai groq-sdk
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEYBoth SDKs here read your Groq key from GROQ_API_KEY. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself. The groq packages and requests are only for the function tool further down.
2Connect the server
The key goes in the tool's headers, which Groq redacts from its logs. Without a key, leave headers out.
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["GROQ_API_KEY"], base_url="https://api.groq.com/openai/v1")
response = client.responses.create(
model="openai/gpt-oss-120b",
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",
"headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
"require_approval": "never",
}
],
)
print(response.output_text)import OpenAI from 'openai';
const client = new OpenAI({ apiKey: process.env.GROQ_API_KEY, baseURL: 'https://api.groq.com/openai/v1' });
const response = await client.responses.create({
model: 'openai/gpt-oss-120b',
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',
headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` },
require_approval: 'never',
},
],
});
console.log(response.output_text);Groq makes the calls from its own servers, so our server must be reachable from the internet, which it is. require_approval is never, so the model calls the tools without asking. Most of them only read; crawl spends credits, crawl_cancel stops a crawl and create_space saves a Space, so give the model a key with a monthly cap.
3Tell it when to search
Groq's browser search is a built-in tool (browser_search) that 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, the model's reasoning, one mcp_call item per call (with its output), and the final message:
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["GROQ_API_KEY"], base_url="https://api.groq.com/openai/v1")
server = {"type": "mcp", "server_label": "millionshort", "server_url": "https://mcp.millionshort.com/mcp", "require_approval": "never",
"headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}}
response = client.responses.create(model="openai/gpt-oss-120b", 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)import OpenAI from 'openai';
const client = new OpenAI({ apiKey: process.env.GROQ_API_KEY, baseURL: 'https://api.groq.com/openai/v1' });
const response = await client.responses.create({
model: 'openai/gpt-oss-120b',
input: 'Search for home espresso blogs.',
tools: [{ type: 'mcp', server_label: 'millionshort', server_url: 'https://mcp.millionshort.com/mcp', require_approval: 'never',
headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }],
});
for (const item of response.output) {
if (item.type === 'mcp_list_tools') console.log(item.tools.map((tool) => tool.name));
else if (item.type === 'mcp_call') console.log(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
Groq calls this local tool calling: your code runs the search, and the loop goes on until the model stops asking for it.
import json
import os
import requests
from groq import Groq
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", "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"]},
}}]
client = Groq()
messages = [{"role": "user", "content": "Find independent blogs about home espresso."}]
while True:
message = client.chat.completions.create(model="openai/gpt-oss-120b", messages=messages, tools=tools).choices[0].message
messages.append(message)
if not message.tool_calls:
break
for call in message.tool_calls:
result = millionshort_search(**json.loads(call.function.arguments))
messages.append({"role": "tool", "tool_call_id": call.id, "name": call.function.name, "content": result})
print(message.content)import Groq from 'groq-sdk';
async function millionshortSearch(query: string): Promise<string> {
const res = await fetch('https://api.millionshort.com/v1/search', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }),
});
if (!res.ok) throw new Error(`search failed: ${res.status}`);
const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } };
return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet })));
}
const tools: Groq.Chat.ChatCompletionTool[] = [{ type: 'function', 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'] },
} }];
const client = new Groq();
const messages: Groq.Chat.ChatCompletionMessageParam[] = [{ role: 'user', content: 'Find independent blogs about home espresso.' }];
while (true) {
const message = (await client.chat.completions.create({ model: 'openai/gpt-oss-120b', messages, tools })).choices[0].message;
messages.push(message);
if (!message.tool_calls?.length) {
console.log(message.content);
break;
}
for (const call of message.tool_calls) {
const content = await millionshortSearch(JSON.parse(call.function.arguments).query);
messages.push({ role: 'tool', tool_call_id: call.id, content });
}
}MCP configuration
The same address for every client: https://mcp.millionshort.com/mcp, streamable HTTP.
| 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 |
| GROQ_API_KEY | Your Groq key |
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 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 model never calls a tool | Remote MCP runs only on Groq models that support tool use | Use a Groq model that does, such as openai/gpt-oss-120b |
| The MCP tool fails, the function tool works | Groq's servers could not reach ours | Try again, or use the function tool |
Related
- Agent tool use: when to give a model tools, and what to tell it.
- Other model APIs: OpenAI (the same
mcptool), xAI, Anthropic, OpenRouter. - MCP server and Filters for agents.
- Groq's own documentation, read on 2026-11-19: Remote Tools and MCP, Local Tool Calling, Browser Search.