--- title: "Add web search to Claude Code and OpenAI Codex with an MCP server" category: "guides" url: https://keirolabs.cloud/blog/web-search-for-claude-code-codex-mcp --- Coding agents are good at writing code and bad at knowing anything that happened after their training cut-off. The fix is a **Model Context Protocol (MCP) server that exposes a web-search tool**, so the agent can look things up — current library versions, error messages, changelogs, prices — mid-task instead of guessing. This guide wires one into Claude Code, OpenAI Codex, Cursor and Windsurf, with copy-paste config for each, using Keirolabs' hosted server as the example. ## Add web search to Claude Code Claude Code reads MCP servers from its own config. Adding a remote HTTP server is one command: ```bash claude mcp add --transport http keirolabs https://api.keirolabs.cloud/mcp/api \ --header "Authorization: Bearer $KEIRO_API_KEY" ``` Set `KEIRO_API_KEY` first (`export KEIRO_API_KEY=keiro_...`). Then start a session and Claude Code has `web_search`, `google_serp`, `extract_url`, `answer` and a few free utility tools. Ask it to "search the web for the latest Next.js 16 middleware API and show the current signature" and it calls the tool, reads the result and keeps going. Remove it any time with `claude mcp remove keirolabs`. Get a key with **750 free credits, no card** at [platform.keirolabs.cloud/register](https://platform.keirolabs.cloud/register). ## Add web search to OpenAI Codex (codex mcp server) Codex speaks MCP over stdio, so a remote HTTP server is bridged with `mcp-remote`. Add this to `~/.codex/config.toml`: ```toml [mcp_servers.keirolabs] command = "npx" args = [ "-y", "mcp-remote", "https://api.keirolabs.cloud/mcp/api", "--header", "Authorization: Bearer ${KEIRO_API_KEY}", ] ``` Restart Codex. The search tools appear in its tool list and it can call them inside a task — handy when it hits an API it doesn't recognise and needs the real docs. ## Cursor and Windsurf Both take a remote MCP server with headers. **Cursor** — `~/.cursor/mcp.json`: ```json { "mcpServers": { "keirolabs": { "url": "https://api.keirolabs.cloud/mcp/api", "headers": { "Authorization": "Bearer keiro_your_api_key" } } } } ``` **Windsurf** — `~/.codeium/windsurf/mcp_config.json` uses the same shape. Reload the window and the tools are live in the agent panel. ## What the tools cost Each tool call costs the same credits as the matching Keirolabs API endpoint. There is no MCP surcharge. | Tool | What it does | Cost | | :--- | :--- | :--- | | `web_search` / `lite_search` | Fast multi-engine search from Keirolabs' own index | $0.03–$0.10 per 1,000 | | `google_serp` | Live Google results, country/language targeting | $1.78–$5.33 per 1,000 | | `extract_url` | Any URL to clean markdown | metered by page | | `answer` | Short cited answer | deep-search credits | | `check_credits`, `get_rate_limits` | Account info | free | A coding agent that searches a few dozen times a day runs comfortably inside the 750 free credits while you evaluate it. ## Which MCP web search server should you use? Several providers ship a hosted or installable search MCP. The difference is what comes back and what it costs. | MCP server | Returns | Price per 1,000 | Notes | | :--- | :--- | :--- | :--- | | **Keirolabs** | Results **and** page markdown in one call | $0.03–$0.10 (lite) | Hosted HTTP, one endpoint, 750 free credits | | Tavily MCP | Results with inline content | $8 basic | Popular, pricier at volume | | Firecrawl MCP | Fresh-crawled page markdown | ~$1.66 | Extraction-first, not cheapest for search | | Exa MCP | Neural search, contents for ~10 results | $7 per 10 results | Strong for find-similar | If the agent mainly needs cheap, current web results with the option of full page text, the own-index route is the cheapest. If you specifically need Google's exact SERP, use the `google_serp` tool. ## Why not just let the agent scrape Google? Letting a coding agent hit Google directly looks simpler and goes wrong fast: Google now needs JavaScript to render results, so plain HTTP scraping returns little; you pick up CAPTCHAs and `429 Too Many Requests` under any real load; and you still have to parse the HTML. A search API with its own index absorbs all of that and returns structured results plus clean page markdown in one call, so the agent spends its tokens reasoning instead of fighting bot defences. The MCP server is just the adapter that hands those tools to the model. ## Next steps - Add the server to your client with the config above. - Try a real task: "search for the current pricing of \ and summarise the tiers." - Read the [web search MCP guide](/blog/mcp-model-context-protocol-web-search-2026-guide) for every client, or the [best MCP servers for web search and scraping](/blog/best-mcp-servers-web-search-scraping-2026).