Web search for AI agents over MCP
Give an AI agent live web search through the Wayfern MCP server: the search_web tool and its inputs, the research_with_wayfern prompt, and what each call costs.
Updated
The Wayfern MCP server gives an AI agent a search_web tool and a research_with_wayfern prompt. This guide shows how to connect, what the tool takes, what the prompt does and what it costs.
Connect
The endpoint is https://api.wayfern.com/mcp. It uses Streamable HTTP. Authenticate with a wf_ API token that has the mcp scope. Your account needs an active paid plan or a positive credit balance.
{
"mcpServers": {
"wayfern": {
"type": "http",
"url": "https://api.wayfern.com/mcp",
"headers": {
"Authorization": "Bearer ${WAYFERN_API_TOKEN}"
}
}
}
} Keep the token in your client’s secret store, not in a committed file. Tokens made before MCP support do not have the mcp scope. For client setup, see Connect an agent.
The search_web tool
search_web runs the same search as the Search API and returns the same envelope.
| Input | Default | Notes |
|---|---|---|
query | required | 1 to 512 characters |
engines | ["google"] | Any of google, bing, duckduckgo |
language | none | Such as en or en-US |
region | none | Such as US |
date | none | YYYYMMDD..YYYYMMDD |
filetype | none | Such as pdf |
site | none | One domain |
limit | 50 | Results per engine, 1 to 200 |
start | 0 | Offset for the next page |
filter_duplicates | true | Hide near-duplicate results |
include_related | true | Return related queries in serp_features |
The REST API accepts a search with only site or filetype. The tool always needs query.
When a search fails, the tool returns an error result with the text Wayfern search_web failed: and the reason. The agent can read it and try again with other inputs.
These are free: the list_search_engines tool, the wayfern://search-engines and wayfern://mcp/help resources, and the prompt.
The research_with_wayfern prompt
The prompt takes two arguments:
topic: required, 1 to 512 characters.engines: optional text, such asgoogle, bing.
It returns one user message. For the topic “headless browser pricing” and the engines “google, bing”, the message is:
Research “headless browser pricing” using the Wayfern search_web tool with these providers: google, bing. Compare multiple independent sources, follow useful related searches, and cite the result URLs.
The prompt costs nothing. The search_web calls that the agent then makes are billed.
Call the tool without a client
A raw call with the current stateless protocol:
curl -X POST https://api.wayfern.com/mcp \
-H "Authorization: Bearer $WAYFERN_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2026-07-28" \
-H "Mcp-Method: tools/call" \
-H "Mcp-Name: search_web" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_web",
"arguments": { "query": "headless browser pricing", "limit": 10 },
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": {},
"io.modelcontextprotocol/clientInfo": { "name": "my-agent", "version": "1.0.0" }
}
}
}' Control the cost
search_web costs 2 credits for each provider page it fetches, cache hits included. Google returns up to 100 results a page. Bing and DuckDuckGo return 10.
- The default
limitof 50 is 1 Google page (2 credits), but up to 5 Bing pages (up to 10 credits). - Each extra engine fetches its own pages.
- A captcha that Wayfern solves during a search debits 1 credit more.
The search_web result does not report its cost. The Web Data tools report theirs in credits_charged. Check search spend on the Usage page of the dashboard. To cap what auto top-up can spend in a month, set a spend limit. When the limit stops a call, the tool returns an error that names the reason. See Credits and spend limits.
Tool inputs and the protocol are in the MCP reference.