Configuration & CLIMCP & Search

OpenClaw + Brave Search API: Steal This Free Search Setup

2,000 free searches per month, zero tracking, and a clean MCP integration that takes under 10 minutes to configure. Brave Search API is the fastest way to give your OpenClaw agents real-time web access.

JD
J. Donovan
Search Integration Expert · aiagentsguides.com
Feb 17, 202512 min read7.4k views
Updated Feb 17, 2025
Key Takeaways
  • Brave Search API's free tier gives 2,000 queries/month — enough for most personal and small team deployments
  • Setup takes under 10 minutes: get key, install MCP server, add config block, restart
  • Brave does not track API queries — strong choice for privacy-sensitive deployments
  • Enable result caching to stay well within free tier limits even with active agents
  • The most common setup error is a missing BRAVE_API_KEY environment variable

Every agent that searches the web via OpenClaw needs a search provider. Brave Search API is the best starting point: it's free up to 2,000 queries per month, it doesn't track your queries, and its MCP server is maintained by the same team that built the core protocol. Most builders never need to switch.

Why Brave Search API?

Three things make Brave the default choice for OpenClaw search integration. Cost: the free tier covers 2,000 monthly queries at zero cost, with no credit card required. Privacy: Brave's documentation is explicit that API queries are not used for personalization or tracking — your agent's research stays private. Quality: Brave maintains an independent search index, not a resold version of Google or Bing, which means results aren't subject to the same filtering and ranking decisions.

Compare that to Google Custom Search API, which charges from the first query and logs everything. Or Bing Search API, which requires Azure and has a complex pricing structure. For 90% of OpenClaw deployments, Brave's free tier is all you need and it takes 10 minutes to set up.

💡
Free Tier Math

2,000 queries per month is about 65 per day. An agent session that does 5-10 searches uses roughly 5 minutes of your daily budget. With result caching enabled, you can comfortably run multiple agents within the free tier.

Get Your API Key

Navigate to api.search.brave.com and create an account. Under the API dashboard, create a new application — the name doesn't matter. Your API key appears immediately on the application page. Copy it and store it as an environment variable.

The free tier activates automatically. You see your current usage, remaining quota, and reset date in the dashboard. If you need more than 2,000 queries, paid plans start at $3 per 1,000 queries above the free tier.

# Add to your shell profile or .env file
export BRAVE_API_KEY="BSA_your_key_here"

# Verify it's set
echo $BRAVE_API_KEY

MCP Server Setup

The official Brave Search MCP server is distributed as an npm package. You don't need to install it manually — the npx -y flag tells npm to download and run it on demand. OpenClaw handles this through its stdio transport.

This is one of those things that trips people up. You don't run npm install for MCP servers that use npx. OpenClaw's MCP client launches the server process automatically when it starts up. The first launch downloads the package; subsequent launches use the cached version.

OpenClaw Config

Add the Brave Search server to your MCP config block. This is the exact configuration that works in production:

# ~/.openclaw/config.yaml
mcp:
  enabled: true
  servers:
    - name: brave-search
      transport: stdio
      command: npx
      args:
        - "-y"
        - "@modelcontextprotocol/server-brave-search"
      env:
        BRAVE_API_KEY: "${BRAVE_API_KEY}"
      auto_approve: true        # search is read-only, safe to auto-approve
      timeout_ms: 20000         # brave typically responds in 1-3 seconds
      restart_on_crash: true

Why auto_approve: true here? Search is a read-only operation. It doesn't mutate state, spend significant money on the free tier, or expose sensitive data. Requiring human approval for every web search would make agents nearly unusable. For read-only tools, auto-approval is the right default.

⚠️
Environment Variable Scope

The BRAVE_API_KEY must be available in the environment where OpenClaw runs, not just your interactive shell. If you're running OpenClaw as a systemd service, add the variable to the service's environment file, not your .bashrc.

Test the Integration

After restarting OpenClaw, verify the connection before testing with an agent:

# Check Brave Search appears in connected servers
openclaw mcp list

# Expected output:
# ✓ brave-search (stdio) — 1 tool: brave_web_search

# Test a direct tool call
openclaw mcp call brave-search brave_web_search '{"query":"OpenClaw AI agent"}'

# If successful, you'll see JSON results with titles, URLs, and snippets

Now test inside an agent conversation. Ask your agent something that requires current information — "What happened in AI news today?" or "What's the current price of X?" If it searches and returns results, you're done.

Optimize for Production

Two settings make a meaningful difference in production. Result caching stores search results locally for a configurable period. If your agent runs similar queries repeatedly — like checking the same topic across multiple sessions — cached results serve instantly without consuming API quota.

mcp:
  servers:
    - name: brave-search
      transport: stdio
      command: npx
      args: ["-y", "@modelcontextprotocol/server-brave-search"]
      env:
        BRAVE_API_KEY: "${BRAVE_API_KEY}"
      auto_approve: true
      cache_ttl_seconds: 3600   # cache results for 1 hour
      max_results: 5            # agent rarely needs more than 5 results per query

Setting max_results: 5 matters more than most people realize. The default returns 10 results, but agents rarely use more than the top 5. Fewer results means less token usage in the model's context window, faster responses, and lower cost if you're using a paid model.

Common Mistakes

The mistake most people make is forgetting to export the environment variable in the right scope. If you add BRAVE_API_KEY to your .bashrc but OpenClaw runs as a different user or as a service, it won't see the variable. Check with openclaw mcp list — if brave-search shows a connection error, check the logs for "invalid API key" or "missing environment variable."

  • Not testing the API key first — curl the Brave API directly to confirm your key works before touching OpenClaw config
  • Using polling mode for Brave — not relevant here, but agents that search repeatedly in a loop can burn through the free tier faster than expected. Add caching
  • Exceeding free tier without monitoring — set up a simple cron job or alert to notify you when you hit 80% of your monthly quota

Frequently Asked Questions

Is Brave Search API free for OpenClaw?

Brave offers a free tier with 2,000 queries per month — enough for most personal and small team deployments. Paid plans start at $3 per 1,000 queries above the free tier. With caching enabled, most deployments stay within the free tier indefinitely.

How do I get a Brave Search API key?

Sign up at api.search.brave.com, create an application, and copy the API key from your dashboard. The free tier activates immediately — no credit card required. The key is valid until you revoke it from the dashboard.

Does Brave Search track my agent's queries?

Brave's API documentation states that API queries are not used for personalization or tracking. This makes it a strong choice for privacy-sensitive deployments compared to Google or Bing search APIs, which log queries by default.

Can I use Brave Search without an API key?

The MCP server requires an API key — all calls fail without it. The free tier provides 2,000 monthly queries at no cost, so there's no reason to skip the registration step. The signup process takes under two minutes.

What search results does Brave return compared to Google?

Brave maintains an independent search index — not a resold Google or Bing feed. Coverage is strong for English-language web content. For very niche technical queries, Google may have better coverage, but Brave handles the vast majority of agent research tasks excellently.

How do I handle Brave API rate limits in OpenClaw?

Enable result caching with cache_ttl_seconds in the MCP server config. This stores results locally and serves cached responses for repeated queries, dramatically reducing API calls in agents that run similar searches across multiple sessions.

Can I switch from Brave to another search provider later?

Yes. OpenClaw's MCP architecture makes provider switching simple. Remove the Brave server entry and add a Tavily or SearXNG entry. The tool names change slightly, but agent behavior adapts automatically on the next conversation without any other configuration changes.

JD
J. Donovan
Search Integration Expert · aiagentsguides.com

J. Donovan has integrated and benchmarked every major search API available for OpenClaw, from Brave and Tavily to SearXNG and Perplexity. He runs the search performance comparisons published quarterly on this site.

Get new guides every week.

Join 50,000 AI agent enthusiasts. No spam, ever.