Why Claude Code Needs Web Search

Claude Code has a knowledge cutoff. When you're debugging a fresh library update, checking if an API endpoint changed, or looking up a recent CVE, Claude is working from stale data.

Adding web search fixes this. With a search MCP server connected, Claude Code can:

  • Look up current documentation for any library
  • Search Stack Overflow and GitHub issues for error messages
  • Verify API responses against live endpoints
  • Research best practices before writing code
  • Fact-check its own suggestions against current sources
  • Add Web Search to Cursor IDE via MCP

The setup takes less than a minute for any of the three methods below.

How MCP Servers Work with Claude Code

MCP (Model Context Protocol) is a standard that lets AI tools connect to external services. Claude Code acts as an MCP client — you configure servers in a JSON file, and Claude gets new tools it can call during your coding session.

The config lives in ~/.claude/settings.json (global) or .claude/settings.json (per-project). You add a server entry, restart Claude Code, and the search tools appear automatically.

// ~/.claude/settings.json
{
  "mcpServers": {
    "your-search-server": {
      "type": "streamable-http",
      "url": "https://example.com/mcp"
    }
  }
}

Now let's set up an actual search server.

Method 1: ContextWire (Free, 30 Seconds)

Best for: Most developers. Free tier with 1,000 queries/month, no credit card, 5 search tools including research mode.

Step 1: Get a free API key

Go to contextwire.dev and sign up. You'll get an API key instantly — no credit card required.

Step 2: Add to Claude Code config

// ~/.claude/settings.json
{
  "mcpServers": {
    "contextwire": {
      "type": "streamable-http",
      "url": "https://contextwire.dev/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Step 3: Restart Claude Code

Run /mcp in Claude Code to verify the connection. You should see 5 tools:

ToolWhat it does
askNatural-language question → sourced answer
searchWeb search across 105 engines, 22 profiles
extractPull content from any URL
researchMulti-step deep research with citations
batch_searchRun multiple searches in parallel

Example usage

Once connected, just ask Claude Code naturally:

"Search for the latest Next.js 15 migration guide"
"Research how to set up Postgres connection pooling with PgBouncer"
"What changed in the React 19 useEffect cleanup behavior?"

Claude will automatically use the ContextWire tools to search, then synthesize the results into its response.

Why ContextWire?

  • Free tier: 1,000 queries/month — enough for most solo developers
  • No LLM cost: Uses Trinity via OpenRouter (free) for answer synthesis
  • BYOK support: Bring your own API key for 50% credit savings
  • 105 search engines: Not just Google — academic, news, technical, and more
  • 94.3% SimpleQA accuracy: Independently benchmarked factual accuracy
  • Remote MCP: No npm install, no Docker — just a URL
  • Add Web Search to Cursor IDE via MCP

Method 2: Brave Search

Best for: Developers who want a Google alternative with independent indexing.

Step 1: Get a Brave API key

Sign up at brave.com/search/api. The free tier gives 2,000 queries/month.

Step 2: Install the MCP server

npm install -g @anthropic/brave-search-mcp

Step 3: Add to Claude Code config

{
  "mcpServers": {
    "brave-search": {
      "command": "brave-search-mcp",
      "env": {
        "BRAVE_API_KEY": "YOUR_BRAVE_KEY"
      }
    }
  }
}

Brave gives you one tool: web_search. It returns raw search results — Claude Code handles the synthesis.

Trade-offs

  • Requires npm install (not remote)
  • One tool only (search — no extract, research, or batch)
  • Independent index — sometimes misses niche technical content
  • Fastest latency (~669ms average)
  • Add Web Search to Cursor IDE via MCP

Method 3: Perplexity Sonar

Best for: Teams with budget who want LLM-synthesized answers with citations.

Step 1: Get a Perplexity API key

Sign up at perplexity.ai/settings/api. Pay-as-you-go at $1 per 1,000 requests.

Step 2: Install the MCP server

npm install -g @anthropic/perplexity-mcp

Step 3: Add to Claude Code config

{
  "mcpServers": {
    "perplexity": {
      "command": "perplexity-mcp",
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_KEY"
      }
    }
  }
}

Trade-offs

  • No free tier — $1/1K requests minimum
  • Requires npm install
  • Deep research mode available (Sonar Pro) but expensive ($2/$8 per million tokens)
  • Pre-synthesized answers — less raw data for Claude to work with
  • Add Web Search to Cursor IDE via MCP

Comparison Table

Feature ContextWire Brave Search Perplexity Sonar
Free tier1,000/mo2,000/moNone
SetupURL only (30s)npm installnpm install
Search tools5 (ask, search, extract, research, batch)1 (web_search)1 (search)
Engines1051 (Brave index)Proprietary
MCP typeRemote (streamable-http)Local (stdio)Local (stdio)
Research modeYes (multi-step)NoYes (Sonar Pro, paid)
URL extractionYesNoNo
BYOKYes (50% savings)NoNo
Accuracy94.3% SimpleQANot benchmarkedNot benchmarked
Paid plansFrom $10/moFrom $5/mo$1/1K requests

Tips for Effective Searches

1. Be specific in your prompts

Instead of "search for React hooks", try "search for React 19 useActionState hook migration from useFormState". Specific queries get better results from any search API.

2. Use search profiles (ContextWire)

ContextWire has 22 search profiles optimized for different query types — tech, academic, news, and more. The API automatically picks the best profile, but you can specify one for precision.

3. Combine search with extract

When Claude finds a relevant page, use the extract tool to pull the full content. This gives Claude much more context than a search snippet.

4. Project-level config for team consistency

Add your MCP config to .claude/settings.json in your repo root (with the API key in an env var) so your whole team gets the same search setup.

// .claude/settings.json (committed to repo)
{
  "mcpServers": {
    "contextwire": {
      "type": "streamable-http",
      "url": "https://contextwire.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${CONTEXTWIRE_API_KEY}"
      }
    }
  }
}

FAQ

Does Claude Code have built-in web search?

Claude Code has a WebSearch tool in some configurations, but it's limited. MCP servers give you more control, better accuracy, and additional tools like content extraction and deep research.

Can I use multiple search servers at once?

Yes. You can configure multiple MCP servers in your settings file. Claude Code will have access to all their tools and can choose the best one for each query.

Will this slow down Claude Code?

Search calls add 1-3 seconds per query. Claude Code runs them as tool calls — your normal coding workflow isn't affected until Claude decides to search.

What about API key security?

Use environment variables for API keys in shared configs. For personal setups, the global ~/.claude/settings.json file is only readable by your user.

How many searches will I actually use?

In practice, a typical developer session triggers 10-30 searches. At that rate, 1,000 free queries from ContextWire lasts most solo developers a full month.

Get Started with ContextWire

Free API key in 30 seconds. 1,000 queries/month. No credit card.

Sign Up Free →

Related Articles