mcpField
B
brave-search

brave-search

github.com/ratacatProductivity58274 installsUpdated 37w ago
Repository

About brave-search

brave-search is a skill for using the Brave Search API to find web pages, images, and news, or request cited AI Grounding answers. It also supports suggestions and filters such as region and freshness.

Key features

  1. 01Search web, images, and news
  2. 02Get cited AI Grounding answers
  3. 03Retrieve search suggestions
  4. 04Filter by region, language, and freshness
  5. 05Run multiple searches in parallel

Use cases

  1. 01Look up current web information
  2. 02Find images on a topic
  3. 03Search for recent news
  4. 04Get a cited research answer

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ratacat/claude-skills --skill brave-search

After installing, type/brave-searchin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.gitignore
AGENTS-BLURB.md
brave.py
pyproject.toml
src/brave_search/
__init__.py
cli.py

Details

From the project README

Brave Search API

Overview

Search the web, images, and news using Brave's privacy-focused Search API. Also supports AI Grounding for cited answers via OpenAI SDK compatibility.

Prerequisites

API Key required. Get one at https://api-dashboard.search.brave.com

export BRAVE_API_KEY="your-api-key"

Free tier: 2,000 queries/month. Pro plans unlock Local POI search and AI Grounding.

When to Use

  • Searching the web for current information
  • Finding images on a topic
  • Getting recent news articles
  • AI-grounded answers with citations
  • Autocomplete suggestions
  • Location/POI searches (Pro plan)

High-Throughput Usage

Go wide, go fast. This API supports high concurrency—up to 50 requests/second. Don't hold back:

  • Fire searches in parallel. Need to research 10 different topics? Launch 10 searches simultaneously. Use multiple Bash tool calls in a single message.
  • Use subagents for heavy results. When expecting lots of context (many results, extra snippets, research mode), dispatch a subagent to run the search and synthesize findings. This preserves your main context window.
  • Batch related queries. Searching for competitors, alternatives, or multiple aspects of a topic? Run them all at once.
digraph parallel_search {
    rankdir=LR;
    node [shape=box];

    task [label="Research task"];
    q1 [label="Query 1"];
    q2 [label="Query 2"];
    q3 [label="Query 3"];
    subagent [label="Subagent\n(preserves context)"];
    synthesize [label="Synthesized\nfindings"];

    task -> q1;
    task -> q2;
    task -> q3;
    q1 -> subagent [style=dashed];
    q2 -> subagent [style=dashed];
    q3 -> subagent [style=dashed];
    subagent -> synthesize;
}

When to use subagents:

  • Searching for many sources on a topic (launch search subagent, return summary)
  • Deep research with AI Grounding (high token usage, let subagent handle)
  • Comparing multiple options (run parallel searches, subagent synthesizes)

When to search directly:

  • Quick single queries where you need the raw URLs/snippets
  • Low result counts where context isn't a concern

Quick Reference

TaskCommand
Web searchbrave-search web "query"
Image searchbrave-search images "query"
News searchbrave-search news "query"
AI answerbrave-search ai "question"
Suggestionsbrave-search suggest "partial query"
Check keybrave-search check-key

API Endpoints

APIEndpointPlan
Web Search/res/v1/web/searchFree
Image Search/res/v1/images/searchFree
News Search/res/v1/news/searchFree
Suggest/res/v1/suggest/searchFree
AI Grounding/res/v1/chat/completionsAI Grounding
Local POI/res/v1/local/poisPro
Summarizer/res/v1/summarizer/searchPro

Common Parameters

Web Search
# Basic search
brave-search web "python async tutorial" --count 10

# Filter by freshness (pd=24h, pw=7d, pm=31d, py=365d)
brave-search web "latest news" --freshness pd

# Filter by country and language
brave-search web "local restaurants" --country US --lang en

# Safe search (off, moderate, strict)
brave-search web "query" --safesearch strict

# Get extra snippets
brave-search web "query" --extra-snippets

# Filter result types (web, news, videos, images, discussions)
brave-search web "query" --filter web,news
Image Search
# Basic image search
brave-search images "mountain sunset"

# With safe search
brave-search images "landscape" --safesearch strict --count 20
News Search
# Recent news
brave-search news "AI developments" --count 10

# News with freshness filter
brave-search news "election results" --freshness pd
AI Grounding (Cited Answers)
# Get an AI answer with citations
brave-search ai "What is the tallest building in the world?"

# Enable deep research (multiple searches, slower)
brave-search ai "Compare React and Vue in 2024" --research

Workflow

digraph brave_search {
    rankdir=TB;
    node [shape=box];

    need [label="What do you need?" shape=diamond];
    web [label="Web Search\nbrave.py web"];
    images [label="Image Search\nbrave.py images"];
    news [label="News Search\nbrave.py news"];
    ai [label="AI Answer\nbrave.py ai"];

    results [label="Parse JSON results"];
    cite [label="Include citations\nfor AI answers"];

    need -> web [label="web pages"];
    need -> images [label="images"];
    need -> news [label="recent news"];
    need -> ai [label="cited answer"];

    web -> results;
    images -> results;
    news -> results;
    ai -> cite;
}

Response Structure

Web Search Results
{
  "web": {
    "results": [
      {
        "title": "Page Title",
        "url": "https://example.com",
        "description": "Snippet from the page...",
        "extra_snippets": ["Additional context..."]
      }
    ]
  },
  "query": {
    "original": "search query",
    "altered": "modified query if spellchecked"
  }
}
AI Grounding Response

Returns OpenAI-compatible format with inline citations:

The tallest building is the Burj Khalifa[1] at 828 meters...

[1] https://source-url.com

Common Options

OptionValuesDescription
--count1-20 (web), 1-200 (images)Number of results
--countryUS, GB, DE, FR, etc.Search region
--langen, de, fr, es, etc.Search language
--safesearchoff, moderate, strictAdult content filter
--freshnesspd, pw, pm, pyTime filter
--jsonflagOutput raw JSON

Error Handling

ErrorCauseFix
401 UnauthorizedInvalid/missing API keyCheck BRAVE_API_KEY
429 Rate LimitedToo many requestsWait or upgrade plan
422 ValidationInvalid parametersCheck parameter values

Rate Limits

  • Free: 1 req/sec, 2,000/month
  • Pro: Higher limits, check dashboard
  • Response headers show remaining quota: X-RateLimit-Remaining

Common Mistakes

MistakeFix
API key not setexport BRAVE_API_KEY="..."
Wrong endpoint for planCheck subscription at dashboard
Too many resultsWeb max is 20, use offset for pagination
No AI groundingRequires AI Grounding subscription

Comments

Markdown supported