MCP server
Web search, page reading and geocoding as tools for agents, over MCP streamable HTTP.
The MCP server gives an agent the Web API as tools. It speaks MCP streamable HTTP and takes the same relay.fast key as the REST API.
| URL | https://api.websearch.fast/mcp |
| Also served at | https://api.websearch.fast/v1/web/mcp, https://relay.fast/v1/web/mcp |
| Auth | Authorization: Bearer sk-... or X-API-KEY: sk-... on every request |
Client setup
Put the key in the environment variable WEBSEARCH_API_KEY and let the client read it from there, so it does not have to be written into a config file.
claude mcp add --transport http websearch https://api.websearch.fast/mcp \
--header "Authorization: Bearer $WEBSEARCH_API_KEY"{
"mcpServers": {
"websearch": {
"url": "https://api.websearch.fast/mcp",
"headers": {"Authorization": "Bearer ${env:WEBSEARCH_API_KEY}"}
}
}
}# ~/.codex/config.toml
[mcp_servers.websearch]
url = "https://api.websearch.fast/mcp"
bearer_token_env_var = "WEBSEARCH_API_KEY"{
"mcpServers": {
"websearch": {
"type": "http",
"url": "https://api.websearch.fast/mcp",
"headers": {"Authorization": "Bearer ${WEBSEARCH_API_KEY}"}
}
}
}Cursor reads ~/.cursor/mcp.json or the .cursor/mcp.json of a project. Clients that accept only a command, not a URL, can run a local bridge such as mcp-remote with the URL and the header.
Tools
| Tool | What it does | REST counterpart | State |
|---|---|---|---|
web_search | Ranked results with title, URL and snippet. With content_pages, the text of the top pages too. | search | available |
web_fetch | The main text of a page or PDF as Markdown. | fetch | available |
geocode | An address or place name to coordinates and a structured address. | geocode | available |
reverse_geocode | The address or place at a latitude and longitude. | reverse geocode | available |
autocomplete | Completions for the start of a search query. | autocomplete | available |
knowledge | The knowledge panel of a person, place, organisation or thing, with its sources. | knowledge | available |
web_extract | Data that matches a JSON Schema, from one or more pages. | extract | planned |
places_search | Places by text near a location. | search, type: places | planned |
research_start, research_get | Start a research job and read its report. | research | planned |
crawl_start, crawl_get | Start a crawl of one site and read its pages. | crawl | planned |
tools/list lists only the tools that are available. Every tool is read-only. The MCP tools keep smaller maximums than REST (num 20, content_pages 5), so one tool call cannot run up a large bill.
Results and errors
Every tool returns structuredContent (the REST response without the frame fields a model does not need) and one text block with a short Markdown rendering, because many clients show only text to the model. A tool error is a normal tool result with isError: true, a short text and structuredContent.error.code, so the model sees it and can react. A missing or invalid key returns HTTP 401 before the JSON-RPC layer.
Each tool call is charged exactly like the REST call it maps to. The result carries usage in structuredContent.
Protocol
POST carries JSON-RPC messages and answers with application/json. The server keeps no session. It issues no Mcp-Session-Id, and GET and DELETE answer 405. It accepts the protocol revisions 2025-03-26, 2025-06-18, 2025-11-25 and 2026-07-28. A request with a foreign Origin gets 403, a body that is not JSON gets 415, and an Accept header without application/json gets 406.
Tool definitions for direct calls
Agents that call the REST API directly can use the same tools as function definitions. Map web_search to POST /v1/web/search (content_pages becomes content.pages) and web_fetch to POST /v1/web/fetch.
[
{"type": "function", "function": {"name": "web_search", "description": "Search the web. Returns ranked results with title, URL and snippet; content_pages adds the cleaned text of the top results.",
"parameters": {
"type": "object",
"required": ["q"],
"additionalProperties": false,
"properties": {
"q": {
"type": "string",
"minLength": 1,
"maxLength": 2048,
"description": "The search query. Operators such as site:, quotes and -term work."
},
"num": {
"type": "integer",
"minimum": 1,
"maximum": 20,
"default": 10,
"description": "Number of results."
},
"page": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 1,
"description": "Result page, starting at 1."
},
"country": {
"type": "string",
"minLength": 2,
"maxLength": 2,
"description": "Country to search from as an ISO 3166-1 alpha-2 code, for example us."
},
"language": {
"type": "string",
"description": "Language of the results as a BCP 47 tag, for example en or de."
},
"location": {
"type": "string",
"minLength": 2,
"maxLength": 256,
"description": "City or region to search from, for example Berlin, Germany."
},
"freshness": {
"type": "string",
"enum": ["day", "week", "month", "year"],
"description": "Only results published within this period."
},
"include_domains": {
"type": "array",
"maxItems": 20,
"items": {"type": "string"},
"description": "Only results from these host names."
},
"exclude_domains": {
"type": "array",
"maxItems": 50,
"items": {"type": "string"},
"description": "No results from these host names."
},
"content_pages": {
"type": "integer",
"minimum": 0,
"maximum": 5,
"default": 0,
"description": "Read the text of this many top results."
}
}
}}},
{"type": "function", "function": {"name": "web_fetch", "description": "Read one web page or PDF and return its main text as Markdown.",
"parameters": {
"type": "object",
"required": ["url"],
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"format": "uri",
"maxLength": 2048,
"description": "The http or https URL to read."
},
"max_chars": {
"type": "integer",
"minimum": 1000,
"maximum": 100000,
"default": 20000,
"description": "Longest text to return."
},
"query": {
"type": "string",
"maxLength": 512,
"description": "What you look for on the page; the passages that match it are returned too."
},
"include_links": {
"type": "boolean",
"default": false,
"description": "Also return the links of the page."
}
}
}}}
][
{"name": "web_search", "description": "Search the web. Returns ranked results with title, URL and snippet; content_pages adds the cleaned text of the top results.",
"input_schema": {
"type": "object",
"required": ["q"],
"additionalProperties": false,
"properties": {
"q": {
"type": "string",
"minLength": 1,
"maxLength": 2048,
"description": "The search query. Operators such as site:, quotes and -term work."
},
"num": {
"type": "integer",
"minimum": 1,
"maximum": 20,
"default": 10,
"description": "Number of results."
},
"page": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 1,
"description": "Result page, starting at 1."
},
"country": {
"type": "string",
"minLength": 2,
"maxLength": 2,
"description": "Country to search from as an ISO 3166-1 alpha-2 code, for example us."
},
"language": {
"type": "string",
"description": "Language of the results as a BCP 47 tag, for example en or de."
},
"location": {
"type": "string",
"minLength": 2,
"maxLength": 256,
"description": "City or region to search from, for example Berlin, Germany."
},
"freshness": {
"type": "string",
"enum": ["day", "week", "month", "year"],
"description": "Only results published within this period."
},
"include_domains": {
"type": "array",
"maxItems": 20,
"items": {"type": "string"},
"description": "Only results from these host names."
},
"exclude_domains": {
"type": "array",
"maxItems": 50,
"items": {"type": "string"},
"description": "No results from these host names."
},
"content_pages": {
"type": "integer",
"minimum": 0,
"maximum": 5,
"default": 0,
"description": "Read the text of this many top results."
}
}
}},
{"name": "web_fetch", "description": "Read one web page or PDF and return its main text as Markdown.",
"input_schema": {
"type": "object",
"required": ["url"],
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"format": "uri",
"maxLength": 2048,
"description": "The http or https URL to read."
},
"max_chars": {
"type": "integer",
"minimum": 1000,
"maximum": 100000,
"default": 20000,
"description": "Longest text to return."
},
"query": {
"type": "string",
"maxLength": 512,
"description": "What you look for on the page; the passages that match it are returned too."
},
"include_links": {
"type": "boolean",
"default": false,
"description": "Also return the links of the page."
}
}
}}
]