Introduction to Claude WebSearch With MCP
Explore Brave-API web search setup in Claude Multi-Context Programming
Article Outline: Setting up Claude for Web Search with MCP
- Introduction
- Overview of Claude Desktop and MCP integration
- Purpose of Brave Search integration
- Prerequisites
- Required software and tools
- API access requirements
- Directory Structure
- Location of configuration files
- System paths and organization
- Setup Process
- Getting Brave Search API key
- Configuration file setup
- Existing vs. new configuration options
- System restart requirements
- Testing and Verification
- Sample search commands
- Testing procedures
- Troubleshooting
- Common issues and solutions
- Debug procedures
- Configuration validation
- Security Considerations
- API key management
- Best practices
- Additional Resources
- Documentation links
- Reference materials
Setting Up Brave Search MCP Plugin for Claude Desktop (macOS)
Prerequisites
- Claude Desktop installed
- Node.js installed (verify with
node --version
) - Brave Search API key
- Terminal access
- VS Code or preferred text editor
Directory Structure
The Claude Desktop configuration lives in:
~/Library/Application Support/Claude/claude_desktop_config.json
Setup Steps
1. Get Brave Search API Key
- Visit https://brave.com/search/api/
- Sign up for a Brave Search API account
- Choose a plan (Free tier available with 2,000 queries/month)
- Generate your API key from the developer dashboard
2. Edit Existing Configuration
If you already have an existing configuration file (which might include other MCP servers like filesystem):
# Open the configuration file in VS Code
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add or merge the Brave Search configuration with your existing config. Your final configuration should look similar to this:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/richardhightower/src",
"/Users/richardhightower/clients"
]
},
"brave-search": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
Replace YOUR_API_KEY_HERE
with your actual Brave Search API key.
Or if this is your first MCP, then just do this
cat > ~/Library/Application\ Support/Claude/claude_desktop_config.json << 'EOL'
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
EOL
3. Verify Configuration
# Check that the configuration file exists and is valid JSON
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
4. Restart Claude Desktop
- Quit Claude Desktop (⌘+Q)
- Relaunch Claude Desktop
Testing the Setup
Try these commands in Claude Desktop:
-
Web search:
Can you search for recent news about artificial intelligence?
-
Local search:
Can you find pizza restaurants near me?
Troubleshooting
Common Issues
- Configuration Not Loading
- Verify JSON syntax is valid
- Check file permissions
- Ensure configuration file is in correct location
- API Key Issues
- Verify API key is correctly copied
- Check for extra spaces or characters
- Ensure API key is active in Brave dashboard
- Node.js Issues
- Verify Node.js installation:
node --version
- Try reinstalling Node.js if necessary
- Verify Node.js installation:
Debug Steps
-
Check configuration file:
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
-
Verify Node.js installation:
which node node --version
Security Notes
- Keep your API key secure and never share it publicly
- Regularly rotate your API key if using in a shared environment
- Monitor API usage through the Brave Search dashboard
References
- Brave Search API Documentation
- Claude Desktop Download
- Node.js Download
- Model Context Protocol Documentation
Sample Session with Claude
Me:
Can you search for recent news about artificial intelligence?
Claude:
I'll search for recent news about AI using the Brave search function.
Let me search for some more specific recent developments.
Based on these search results, I can provide an overview of recent AI developments and regulatory trends:
- Regulatory Landscape: 2024 has seen significant movement in AI regulation:
- At least 40 U.S. states, along with Puerto Rico, the U.S. Virgin Islands, and D.C., have introduced AI-related legislation
- The European Union has established comprehensive rules through the AI Act and AI Liability Directive
- The African Union is developing a continent-wide AI strategy to protect consumers and help African countries compete in the AI space
- Scientific and Technical Developments:
- MIT researchers are working on new AI methods that find novel connections between science and art to discover new materials
- In the medical field, there have been advances in specialized AI applications, such as the development of "UroBot," an AI chatbot capable of handling complex urology-related questions
- Industry Impact:
- Organizations are being advised to develop strategic approaches to AI adoption while keeping compliance in mind
- There's increasing focus on sector-specific regulations that will affect how different industries can implement AI
- Companies are working to balance innovation with regulatory requirements
- Global Perspective:
- There's a growing focus on international cooperation and competition in AI development
- Different regions are taking varied approaches to regulation, with some focusing on consumer protection while others prioritize innovation
Would you like me to explore any of these areas in more detail? I can search for more specific information about any particular aspect that interests you.
RH:
Can you find pizza restaurants near me?
Claude:
I notice you'd like to find pizza restaurants, but I can't determine your location from our conversation. To find pizza places near you, I'll need you to specify a location - it could be a city, neighborhood, landmark, or address. Could you please provide that information?
RH
I live in Manor Texas
Claude:
I'll search for pizza restaurants in Manor, Texas using the local search function.
View Result from brave_web_search from brave-search (local)
Based on the search results, here are some pizza options in Manor, TX:
- GRAZIE Pizzeria - A local pizzeria that's highly rated on Yelp
- DoubleDave's Pizzaworks
- Location: Manor location
- Known for: Peproni Rolls®, Philly Cheesesteak Stromboli, and specialty pizzas
- Services: Dine-in, Delivery, and Carry-Out available
- Domino's Pizza
- Address: 11211 US Highway 290 E, Ste 400
- Hours: Open until midnight
- Services: Delivery and takeout available
- Menu includes pizza, wings, sandwiches, and salads
- Pizza Hut
- Address: 11300 Highway 290 East Bldg 3
- Hours: 11:00 AM - 11:00 PM
- Services: Carryout and delivery
- Little Caesars
- Address: 12836 Hwy 290
- Phone: (737) 357-6622
Each of these places offers different specialties and service options. Would you like more specific information about any of these restaurants, such as their menus, pricing, or customer reviews? I can also search for other local pizzerias if these don't meet your preferences.