NewAnswers MCP: one question, one checked answer for your agent.See how it works

Guides

How to add web search to an AI agent: MCP, REST, the AI SDK and LangChain

By , founder of HyperresearchUpdated

An agent gets web search through a tool: a function the model can call with a query, which returns results it reads before answering. There are three ways to wire one in. Add a vendor’s hosted MCP server to your agent client with one command, define a REST tool yourself in about 20 lines, or install a ready-made tool for the AI SDK or LangChain. All three work with any of the search APIs in Exa alternatives compared. The examples use Exa’s keyless MCP server where a free test helps, and Hyperresearch Answers where a key is needed, because we make Hyperresearch and know its API best.

Choose the tool shape before the vendor

A search tool and an answer tool cost and behave differently inside an agent.

  • A search tool returns ranked links with passages from each page. The model reads them and writes the answer. A standard search call costs $0.001 to about $0.008 at the vendors we compared, read on November 1, 2026. The hidden cost is context: ten results with long passages add thousands of tokens to every turn, and an agent that searches twenty times carries all of them.
  • An answer tool runs the search and the synthesis on the vendor’s side and returns a short answer with citations. Your context stays small. Exa, Tavily, Linkup, Brave, You.com and Perplexity each sell one. Hyperresearch’s ask costs 2¢ to 50¢ because it checks each quote against its page and returns not_found rather than a guess. On 100 BrowseComp questions, ask in max mode answered 89 correctly against 73 for Parallel Pro; that grades cited final answers, not search results (method).

Give a research-heavy agent both: a search tool for when it needs the pages, and an answer tool for factual lookups. Say which is which in each tool’s description, because the name and description are what the model reads when it decides.

Add a hosted MCP server to an agent client

If your agent runs in Claude Code, Cursor, VS Code, Codex or another MCP client, a remote MCP server is the shortest route: no code, and the vendor maintains the tool definitions.

Exa’s server lets you try search and fetch with no key, at a free rate limit:

Terminal window
claude mcp add --transport http exa https://mcp.exa.ai/mcp

Exa’s docs say keyless access needs a direct IPv4 connection; over IPv6 or a proxy, sign in or add a key. For clients that read a JSON config, such as Cursor’s .cursor/mcp.json, the same server is one entry:

{
"mcpServers": {
"exa": { "url": "https://mcp.exa.ai/mcp" }
}
}

Hyperresearch Answers adds its ask and search tools the same way. Then run /mcp in a Claude Code session and choose Authenticate; a browser window opens to sign in, and no key goes in any file:

Terminal window
claude mcp add --transport http -s user hyperresearch-answers https://answers.hyperresearch.ai/mcp

On a machine without a browser, such as CI, pass an API key as a header and keep the key in an environment variable:

Terminal window
claude mcp add --transport http -s user hyperresearch-answers https://answers.hyperresearch.ai/mcp \
--header "Authorization: Bearer $HYPERRESEARCH_API_KEY"

Other vendors’ hosted servers, from their docs on November 1, 2026:

Vendor MCP URL Without a key
Tavily https://mcp.tavily.com/mcp/ Browser sign-in (OAuth)
Parallel https://search.parallel.ai/mcp Free at lower rate limits
Linkup https://mcp.linkup.so/mcp Key required
Perplexity https://api.perplexity.ai/mcp Browser sign-in (OAuth)
You.com https://api.you.com/mcp ?profile=free, 100 searches a day
Firecrawl https://mcp.firecrawl.dev/v2/mcp-oauth (sign-in) or /v2/mcp (key) Browser sign-in

Brave’s MCP server is open source and runs on your own machine with your Brave key. The Answers page has one-click install links for Claude, Cursor and VS Code, and MCP covers both Hyperresearch servers.

Define a REST search tool yourself

If you run your own agent loop, call the search API over HTTP and describe the call to the model as a tool. You control the inputs, trim the results before they reach the context, and can cap the cost of each call.

The Hyperresearch search call, POST /v1/answers/search, takes a query of up to 1,000 characters, a max_results of 1 to 25 (default 10) and a mode of standard (5¢) or max (15¢). Use an hr_live_ key with the answers:ask scope; the console’s key form ticks it by default as “Use the Answers MCP”.

import os
import requests
API = "https://api.hyperresearch.ai/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['HYPERRESEARCH_API_KEY']}"}
def web_search(query: str, max_results: int = 5) -> list[dict]:
"""Ranked sources with word-for-word passages. No synthesis."""
r = requests.post(
f"{API}/answers/search",
headers=HEADERS,
json={"query": query, "max_results": max_results},
timeout=90,
)
r.raise_for_status()
# Keep only what the model needs: the URL, the title and the passages.
return [
{"url": x["url"], "title": x["title"], "passages": [p["text"] for p in x["passages"]]}
for x in r.json()["results"]
]

Each result also carries rank, source (web, or a structured source such as edgar), a published date when the page has one, and verified on each passage. A standard search usually takes 5 to 10 seconds.

The answer call, POST /v1/answers, has the same shape. It takes a question of up to 2,000 characters, a mode (fast 2¢ and usually a few seconds, standard 10¢, or 20¢ when it digs further, max 50¢, or auto, which picks one of the three and bills the mode that ran) and an optional max_cost_cents cap:

def ask(question: str) -> dict:
"""One short answer with the quotes it rests on, or a not-found status."""
r = requests.post(
f"{API}/answers",
headers=HEADERS,
json={"question": question, "mode": "standard", "max_cost_cents": 10},
timeout=180,
)
r.raise_for_status()
body = r.json()
return {"status": body["status"], "answer": body["answer"], "evidence": body["evidence"]}

fast answers from the open web only and does not query structured data sources; for a figure from a company filing, a government statistic or a registry (SEC EDGAR, FRED, Census, FDA, FEC, USPTO, ClinicalTrials.gov), use standard or auto. The sources page lists every structured source, what it holds and which modes reach it.

Setting max_cost_cents to 10 runs a standard ask with escalation off, so no call costs more than 10¢. Branch on status: answered, false_premise, unconfirmed, not_found or error. An error is a failure on our side, costs nothing, and still comes back as a 200 so the agent has one shape to handle. Every field is in the API reference.

Then describe each function to your model in its tool format. The descriptions do the routing:

{
"name": "data_and_web_answer",
"description": "Answer one factual question from the web. Returns a short answer with the quotes it rests on, or not_found. Prefer this for facts, figures and dates.",
"input_schema": {
"type": "object",
"properties": { "question": { "type": "string" } },
"required": ["question"]
}
}

Exa, Tavily, Parallel and the rest take a similar POST with a query and an API key, with their own field names and result shapes; their API references have the details.

Add search to an AI SDK app

In a TypeScript app on the AI SDK, the shortest route is a packaged tool. @hyperresearch/ai-sdk exports hyperresearchAnswer() and hyperresearchSearch(), built with the SDK’s tool(), and reads HYPERRESEARCH_API_KEY from the environment:

Terminal window
npm install ai zod @hyperresearch/ai-sdk
import { generateText, isStepCount } from "ai";
import { hyperresearchAnswer, hyperresearchSearch } from "@hyperresearch/ai-sdk";
const { text } = await generateText({
model, // your model
tools: {
answer: hyperresearchAnswer({ maxCostCents: 10 }),
search: hyperresearchSearch({ maxResults: 5 }),
},
stopWhen: isStepCount(5),
prompt: "What was the US unemployment rate in September 2026? Cite the source.",
});
console.log(text);

stopWhen lets the model call a tool, read the result and answer in further steps; without it the call stops after the first step. isStepCount is the name in ai 7; on ai 6 it is stepCountIs. Answers in the Vercel AI SDK lists every option.

To use a vendor’s MCP server instead, load its tools with the SDK’s MCP client from @ai-sdk/mcp. This works for any server in the table above:

import { createMCPClient } from "@ai-sdk/mcp";
import { generateText, isStepCount } from "ai";
const mcp = await createMCPClient({
transport: {
type: "http",
url: "https://answers.hyperresearch.ai/mcp",
headers: { Authorization: `Bearer ${process.env.HYPERRESEARCH_API_KEY}` },
},
});
try {
const { text } = await generateText({
model, // your model
tools: await mcp.tools(),
stopWhen: isStepCount(5),
prompt: "What was the US unemployment rate in September 2026? Cite the source.",
});
console.log(text);
} finally {
await mcp.close();
}

Close the client when you are done, as above.

Add search to a LangChain agent

LangChain has the same two tools in Python (langchain-hyperresearch on PyPI) and JavaScript (@hyperresearch/langchain on npm), plus a retriever:

Terminal window
pip install -U langchain langchain-hyperresearch
from langchain.agents import create_agent
from langchain_hyperresearch import HyperresearchAnswerTool, HyperresearchSearchTool
agent = create_agent(
model=model, # your model
tools=[HyperresearchAnswerTool(max_cost_cents=10), HyperresearchSearchTool(max_results=5)],
)
agent.invoke({"messages": [{"role": "user", "content": "What was the US federal deficit in fiscal 2025?"}]})

The JavaScript classes take the same options in camelCase (new HyperresearchAnswerTool({ maxCostCents: 10 })). Answers in LangChain has both languages side by side and the retriever.

Keep the bill and the context under control

  • Return less. Trim each result to the URL, the title and the passages before it reaches the model. Five results are often enough for a lookup.
  • Cap each call. Set the vendor’s limit per call where one exists, such as max_cost_cents on Hyperresearch or the result count everywhere.
  • Expect rate limits. Search limits run from 10 requests a minute on Firecrawl’s free plan to 600 a minute on Parallel. Hyperresearch allows 60 Answers calls a minute per key and 120 per workspace (rate limits). Retry a 429 after its Retry-After, and give parallel sub-agents their own keys if the vendor counts per key.
  • Treat results as data. Passages are text from web pages. Tell the model not to follow instructions found in them.
  • Keep keys out of files. Put them in environment variables or your platform’s secret store, never in an MCP config that is committed to a repository.

Every Hyperresearch account gets $5 of credit once, no card needed: 250 fast asks at 2¢ or 50 standard asks at 10¢. Answers has the install links and the price table.