Claude Skills Guide

Brave Search MCP Server for Research Automation

Integrating Brave Search with Claude Code through MCP servers opens up powerful automation possibilities for developers and researchers. This guide covers setting up a Brave Search MCP server, configuring authentication, and building practical research workflows that save hours of manual searching.

Why Brave Search for Automation

Brave Search provides an API that works exceptionally well for programmatic queries. Unlike traditional search APIs that throttle requests or require complex OAuth flows, Brave offers straightforward API key authentication with generous rate limits. This makes it ideal for building research automation pipelines.

The search results include web results, news, and images, all accessible through a clean REST API. When combined with Claude Code’s natural language processing, you can query research topics and have Claude summarize, analyze, or synthesize the findings automatically. For a broader look at how MCP servers compare to native Claude skills, see MCP servers vs. Claude skills explained.

Setting Up Your Brave Search API Key

Before building the MCP server, obtain your Brave Search API key:

  1. Visit brave.com/search/api and create an account
  2. Navigate to the API keys section and generate a new key
  3. Copy the key—you’ll need it for configuration

Store this key securely. Never commit it to version control. The MCP credential management guide covers best practices for handling API keys across environments. Use environment variables or a secrets manager:

export BRAVE_SEARCH_API_KEY="your_api_key_here"

Building the Brave Search MCP Server

Create a new directory for your MCP server and initialize the project:

mkdir brave-search-mcp && cd brave-search-mcp
npm init -y
npm install @modelcontextprotocol/sdk axios dotenv

Create the server implementation in server.js:

#!/usr/bin/env node

import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
import axios from 'axios';

const BRAVE_API_KEY = process.env.BRAVE_SEARCH_API_KEY;

const server = new Server({
  name: 'brave-search-mcp',
  version: '1.0.0'
}, {
  capabilities: {
    tools: {}
  }
});

server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [
      {
        name: 'brave_web_search',
        description: 'Search the web using Brave Search API',
        inputSchema: {
          type: 'object',
          properties: {
            query: { type: 'string', description: 'Search query' },
            count: { type: 'number', description: 'Number of results (default 10)', default: 10 },
            offset: { type: 'number', description: 'Result offset for pagination', default: 0 }
          },
          required: ['query']
        }
      },
      {
        name: 'brave_news_search',
        description: 'Search news using Brave Search API',
        inputSchema: {
          type: 'object',
          properties: {
            query: { type: 'string', description: 'News search query' },
            count: { type: 'number', description: 'Number of results', default: 10 }
          },
          required: ['query']
        }
      }
    ]
  };
});

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { name, arguments: args } = request.params;

  try {
    if (name === 'brave_web_search') {
      const response = await axios.get('https://api.search.brave.com/res/v1/web/search', {
        headers: {
          'Accept': 'application/json',
          'X-Subscription-Token': BRAVE_API_KEY
        },
        params: {
          q: args.query,
          count: args.count || 10,
          offset: args.offset || 0
        }
      });

      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }

    if (name === 'brave_news_search') {
      const response = await axios.get('https://api.search.brave.com/res/v1/news/search', {
        headers: {
          'Accept': 'application/json',
          'X-Subscription-Token': BRAVE_API_KEY
        },
        params: {
          q: args.query,
          count: args.count || 10
        }
      });

      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      };
    }

    throw new Error(`Unknown tool: ${name}`);
  } catch (error) {
    return {
      content: [{
        type: 'text',
        text: `Error: ${error.message}`
      }]
    };
  }
});

const transport = new StdioServerTransport();
await server.connect(transport);

Configuring Claude Code

Add the MCP server to your Claude Code configuration in ~/.claude/settings.json:

{
  "mcpServers": {
    "brave-search": {
      "command": "node",
      "args": ["/path/to/brave-search-mcp/server.js"],
      "env": {
        "BRAVE_SEARCH_API_KEY": "your_api_key"
      }
    }
  }
}

Restart Claude Code to load the new server. You can now use the Brave Search tools directly in your conversations.

Practical Research Workflows

Automated Literature Review

Combine Brave Search with the pdf skill to build a literature review workflow. Query for academic papers, then use Claude to analyze and summarize them:

Search for recent papers on "machine learning model compression techniques" using Brave Search. Then analyze the top 5 results and create a summary of key approaches.

The workflow queries Brave, retrieves URLs and abstracts, then Claude can either visit the links directly or guide you through accessing the papers.

Competitive Analysis Automation

Use the supermemory skill to store research findings persistently, then query Brave Search for competitive intelligence. The competitive analysis automation workflow shows how to structure multi-source research pipelines:

Search Brave for competitor news about "AI coding assistants" from the last 30 days. Store the findings in supermemory for the competitive analysis project.

This creates a searchable knowledge base that accumulates research over time.

Technical Documentation Research

When investigating new technologies or debugging issues, chain Brave Search with code analysis:

Search for documentation on "Kubernetes pod eviction policies" and compare with our current cluster configuration.

The search results provide context, while Claude applies that knowledge to your specific situation.

Advanced: Multi-Step Research Pipelines

For complex research tasks, create a Claude skill that orchestrates multiple searches. Here’s a pattern for comprehensive research:

// research-pipeline.md
# Research Pipeline Skill

You help execute multi-step research workflows using Brave Search MCP.

## Process

1. **Initial Discovery**: Search broadly to map out the topic
2. **Deep Focus**: Query specific aspects identified in discovery
3. **Synthesis**: Combine findings into actionable insights

## Tools

- Use `brave_web_search` for general research
- Use `brave_news_search` for recent developments
- Use `tdd` skill to validate technical claims with tests
- Use `frontend-design` skill to review UI/UX research findings

Rate Limiting and Best Practices

Brave Search API has rate limits to consider:

Implement caching to reduce API calls:

const searchCache = new Map();

async function cachedSearch(query, type = 'web') {
  const cacheKey = `${type}:${query}`;
  
  if (searchCache.has(cacheKey)) {
    const cached = searchCache.get(cacheKey);
    if (Date.now() - cached.timestamp < 3600000) { // 1 hour cache
      return cached.results;
    }
  }

  const results = await braveSearch(query, type);
  searchCache.set(cacheKey, { results, timestamp: Date.now() });
  return results;
}

Conclusion

Brave Search MCP server integration enables powerful research automation within Claude Code. The straightforward API, combined with Claude’s analysis capabilities, creates a research workflow that would otherwise require significant manual effort. Start with the basic server setup, then expand into specialized skills like tdd for technical validation or supermemory for persistent knowledge storage.

Built by theluckystrike — More at zovo.one