Add web search to Claude Code, Cursor and Codex with one MCP server

One remote MCP server gives a coding agent 15 tools: web search, page scraping to markdown, maps, Amazon, YouTube transcripts. Setup for three clients, tested.

A coding agent that cannot read the web guesses at library versions and invents API flags. The fix is not a custom tool per project: it is one remote MCP server, added once per client, that the agent can call to search and to read pages.

FastAF runs one at https://api.fastaf.co/mcp (Streamable HTTP, stateless, spec 2026-07-28), authenticated with the same Bearer key as the REST API. Below is the setup for three clients, the raw protocol, and what a session costs. Every call was made on 19 October 2026.

What does the agent get from the server?

tools/list returns 15 tools: scrape_page, search_web, search_places, search_amazon, search_news, search_shopping, get_trends, search_scholar, search_jobs, ask_google_ai, search_walmart, search_x, search_youtube, youtube_transcript, get_linkedin_profile. Each one is marked readOnlyHint: true and has a strict input schema with a description on every parameter, so the model knows what it can pass.

The costs are the REST costs: search_web is 5 credits, scrape_page is 1 (5 with render_js: true), search_amazon and youtube_transcript are 1, get_linkedin_profile is 60. The full list is on the API pages and in the MCP docs.

Put the key in an environment variable first, so it never lands in a config file you might commit:

export FASTAF_API_KEY="..."   # in ~/.zshrc or ~/.bashrc

How do you add it to Claude Code?

Per the Claude Code MCP docs (code.claude.com/docs/en/mcp, checked 19 October 2026), remote servers use --transport http and a header:

claude mcp add --transport http fastaf https://api.fastaf.co/mcp \
  --header "Authorization: Bearer $FASTAF_API_KEY"

Your shell expands the variable, so the key ends up stored in ~/.claude.json. To share the server with a team, use a project .mcp.json: Claude Code expands ${VAR} inside headers, so the file holds no secret.

{
  "mcpServers": {
    "fastaf": {
      "type": "http",
      "url": "https://api.fastaf.co/mcp",
      "headers": { "Authorization": "Bearer ${FASTAF_API_KEY}" }
    }
  }
}

claude mcp list shows whether it connected. We ran this exact file with Claude Code 2.1.197 in headless mode; the model received the tool’s JSON (text, truncated, total_chars, credits_used, credits_remaining).

How do you add it to Cursor?

Cursor’s docs (cursor.com/docs/context/mcp, checked 19 October 2026) read ~/.cursor/mcp.json globally or .cursor/mcp.json per project, and resolve ${env:NAME} in url and headers:

{
  "mcpServers": {
    "fastaf": {
      "url": "https://api.fastaf.co/mcp",
      "headers": { "Authorization": "Bearer ${env:FASTAF_API_KEY}" }
    }
  }
}

We did not run Cursor for this post; the config follows its documentation.

How do you add it to Codex CLI?

The Codex MCP docs (developers.openai.com/codex/mcp, checked 19 October 2026) use bearer_token_env_var, which names the variable instead of holding the token. In ~/.codex/config.toml:

[mcp_servers.fastaf]
url = "https://api.fastaf.co/mcp"
bearer_token_env_var = "FASTAF_API_KEY"

Or codex mcp add fastaf --url https://api.fastaf.co/mcp --bearer-token-env-var FASTAF_API_KEY (flag present in codex-cli 0.159.2). codex mcp list or /mcp in the TUI shows it. A codex exec run with this config called search_web and returned three results for 5 credits.

What does a raw MCP call look like?

The 2026-07-28 spec is stateless: there is no handshake, and initialize returns -32601 Method not found. Each request carries the version in a header and in _meta, plus an Mcp-Method header (without it the server answers -32020, headers and body disagree):

curl -s https://api.fastaf.co/mcp \
  -H "Authorization: Bearer $FASTAF_API_KEY" \
  -H "Content-Type: application/json" \
  -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":"python 3.14 free-threaded","results":3},
       "_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28",
                "io.modelcontextprotocol/clientCapabilities":{}}}}'

Trimmed real output:

{"results":[
  {"title":"Python support for free threading ...",
   "url":"https://docs.python.org/3/howto/free-threading-python.html","position":1},
  {"title":"Python Free-Threading Guide","url":"https://py-free-threading.github.io/","position":3}],
 "credits_used":5,"credits_remaining":937}

The same call with scrape_page on that URL and max_chars: 4000 returned "truncated":true,"total_chars":20229,"credits_used":1.

Why markdown with a cap and not raw HTML?

Context is the real budget. The Python 3.14 “What’s new” page is 554,786 bytes of HTML fetched with curl. scrape_page turned it into 266,828 characters of markdown and returned the first 12,000 (the default max_chars, adjustable from 1,000 to 30,000), in 1.3 seconds for 1 credit. The smaller free-threading guide went from 41,838 bytes of HTML to 20,229 characters.

At roughly four characters per token, 12,000 characters is about 3,000 tokens. Claude Code’s docs say it warns above 10,000 tokens of tool output and caps at 25,000 by default, so raw HTML would be cut or saved to a file before the model saw anything useful. truncated and total_chars tell the agent there is more, so it can ask again with a larger cap.

Search results are compact the same way: title, url, snippet and position, nothing else.

What does a coding session cost?

A heavy research session of 10 searches and 10 page reads costs 10 x 5 + 10 x 1 = 60 credits. The free 500 credits cover eight of those; the $10 Starter pack (20,000 credits) covers 333, about 3 cents each. See pricing.

The hard cap is the account balance. Every result reports credits_remaining, and at zero the tools stop charging and return an error. Use one key per machine so you can revoke a lost laptop’s key alone, but the balance is shared by all keys on the account: there are no per-key budgets. The spending cap post covers per-run limits.

What goes wrong and how do you fix it?

  • HTTP 401, -32001 Authentication required: the header is missing or the variable is empty in the client’s environment. GUI apps often do not read your shell profile.
  • Out of credits (402 on REST): the tool returns INSUFFICIENT_CREDITS with credits_used: 0. Top up; nothing was charged.
  • Too many at once (429 on REST): tool results come back RATE_LIMITED when the agent fires more parallel calls than your pack’s concurrency (1 on Free, 5 on Starter). Our Codex run hit it twice before succeeding. A burst on the endpoint itself returns HTTP 429 with Retry-After: 10.

The short version

Export FASTAF_API_KEY, add https://api.fastaf.co/mcp with a Bearer header in Claude Code, Cursor or Codex, and the agent gets search, page reads as capped markdown, and 13 more tools, with the balance as the ceiling. Get a key with 500 free credits.