Integrations / Frameworks & SDKs
Google ADK
MillionShort search for agents built with Google's Agent Development Kit, 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
ADK connects to the MillionShort MCP server through an MCP toolset (McpToolset in Python, MCPToolset in TypeScript) placed in an agent's tools. The toolset finds the server's tools, search, get_domain_info, list_sources and the tools of the other endpoints (the MCP page lists them all), and calls them for the agent. With no MCP at all, a function tool that calls the API does the same job.
1Install
pip install "google-adk[mcp]"
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEYnpm install @google/adk zod
npm install -D @google/adk-devtools
export MILLIONSHORT_API_KEY=ms-YOUR_API_KEYADK needs Python 3.10 or later, or Node.js 24.13 or later. The examples use a Gemini model, as ADK's docs do: put your Gemini key in the agent's .env file, as GOOGLE_API_KEY for Python or GEMINI_API_KEY for TypeScript. Get a MillionShort key in the dashboard; an agent can ask for a trial key by itself.
2Connect the server
An ADK agent is a root_agent (rootAgent in TypeScript). In Python it lives in agent.py inside an agent folder, such as the one adk create millionshort_agent makes; in TypeScript, in agent.ts. Add the toolset to its tools. Without a key, leave the headers out.
import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
root_agent = LlmAgent(
model="gemini-flash-latest",
name="researcher",
instruction="Use the MillionShort search tool for anything recent or niche, and cite the URLs.",
tools=[
McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://mcp.millionshort.com/mcp",
headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"},
)
)
],
)import { LlmAgent, MCPToolset } from '@google/adk';
export const rootAgent = new LlmAgent({
model: 'gemini-flash-latest',
name: 'researcher',
instruction: 'Use the MillionShort search tool for anything recent or niche, and cite the URLs.',
tools: [
new MCPToolset({
type: 'StreamableHTTPConnectionParams',
url: 'https://mcp.millionshort.com/mcp',
transportOptions: {
requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } },
},
}),
],
});Constructing the toolset does not connect: it opens the session the first time the agent asks for its tools.
3Give the tools to an agent
Run the agent with ADK's command line, from the folder that holds the agent folder (Python) or the project folder (TypeScript):
adk run millionshort_agentnpx adk run agent.tsadk web (npx adk web) opens ADK's development web page instead, where the event trace shows each tool call. ADK adds no web search of its own: its Google Search tool is only there if you put it in tools, so leave it out. To give the agent only search, add tool_filter=["search"] to the Python toolset.
A line that works well in the agent's instruction:
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
Ask the agent something recent, for example:
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.
The trace in adk web should show a call to search. To see the tools without a model, list them from the toolset:
import asyncio
import os
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
async def main():
params = StreamableHTTPConnectionParams(url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"})
toolset = McpToolset(connection_params=params)
try:
print([tool.name for tool in await toolset.get_tools()]) # search, get_domain_info, list_sources, ...
finally:
await toolset.close()
asyncio.run(main())import { MCPToolset } from '@google/adk';
const toolset = new MCPToolset({
type: 'StreamableHTTPConnectionParams',
url: 'https://mcp.millionshort.com/mcp',
transportOptions: { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } } },
});
try {
console.log((await toolset.getTools()).map((tool) => tool.name)); // search, get_domain_info, list_sources, ...
} finally {
await toolset.close();
}Without MCP: a function tool
In Python, a plain function in tools becomes a function tool, described by its docstring; ADK wraps a return value that is not a dictionary as {"result": ...}. In TypeScript, a FunctionTool takes a zod schema.
import json
import os
import urllib.request
from google.adk.agents import LlmAgent
def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> dict:
"""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 {"results": [{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]}
root_agent = LlmAgent(
model="gemini-flash-latest",
name="researcher",
instruction="Use millionshort_search for anything recent or niche, and cite the URLs.",
tools=[millionshort_search],
)import { FunctionTool, LlmAgent } from '@google/adk';
import { z } from 'zod';
const millionshortSearch = new FunctionTool({
name: 'millionshort_search',
description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.',
parameters: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }),
execute: async ({ query, remove_top_sites }) => {
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, num_results: 5 }),
});
if (!res.ok) return { status: 'error', message: `search failed: ${res.status}` };
const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } };
return { status: 'success', results: data.results.map(({ title, url, snippet }) => ({ title, url, snippet })) };
},
});
export const rootAgent = new LlmAgent({
model: 'gemini-flash-latest',
name: 'researcher',
instruction: 'Use millionshort_search for anything recent or niche, and cite the URLs.',
tools: [millionshortSearch],
});MCP configuration
The same address for every client: https://mcp.millionshort.com/mcp, streamable HTTP. In ADK that is StreamableHTTPConnectionParams, not the SSE parameters.
| 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.
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 connection times out | The Python toolset's connection timeout is 5 seconds by default | Pass a larger timeout to StreamableHTTPConnectionParams; in TypeScript, timeout goes in the MCPToolset options |
adk run does not find the agent | It was started from the wrong folder | Run it from the folder that holds the agent folder (Python) or the project folder (TypeScript) |
Related
- Agent tool use: when to give a model tools, and what to tell it.
- Gemini: a search function for the Gemini API, with no framework.
- OpenAI Agents SDK and Claude Agent SDK.
- MCP server and Filters for agents.
- ADK's own documentation, read on 2026-11-19: MCP tools, Function tools, Python quickstart, TypeScript quickstart.