Brave Search MCP for VS Code

A VS Code extension that integrates the Brave Search API with the Model Context Protocol (MCP), enabling AI Copilot to perform internet searches for research and planning purposes.
Features
This extension provides AI Copilot with the ability to:
- 🔍 Web Search: Search the web using Brave's independent search index
- 📰 News Search: Find recent news articles and current events
- 🖼️ Image Search: Search for images across the web
These capabilities are automatically available to GitHub Copilot and other AI assistants in VS Code when running in agent mode.
Prerequisites
- VS Code version 1.95.0 or higher
- A Brave Search API key (free tier available)
- Node.js installed (required for running the MCP server)
Installation
From VSIX File (Local Installation)
- Download or build the
.vsix file
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
- Click the "..." menu at the top of the Extensions view
- Select "Install from VSIX..."
- Choose the downloaded
.vsix file
From VS Code Marketplace
(Coming soon - once published)
Search for "Brave Search MCP" in the Extensions view and click Install.
Getting a Brave Search API Key
- Visit Brave Search API
- Sign up for a free account
- Create a new API key in your dashboard
- Copy your API key (starts with
BSA)
API Plans
- Free AI: 2,000 queries/month, 1 query/second
- Base AI: $5/1,000 requests, up to 20M queries/month
- Pro AI: $9/1,000 requests, unlimited queries
Configuration
Initial Setup
After installing the extension, you'll be prompted to configure your API key. You can also:
- Open VS Code Settings (Ctrl+, / Cmd+,)
- Search for "Brave Search MCP"
- Enter your API key in the
Brave Search Mcp: Api Key field
Using Command Palette
- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Type "Brave Search MCP: Configure API Key"
- Enter your API key when prompted
Settings
braveSearchMcp.apiKey: Your Brave Search API key
braveSearchMcp.enabled: Enable/disable the MCP server (default: true)
Usage
Once configured, the Brave Search tools are automatically available to AI assistants in VS Code:
Quick Start
- Open Copilot Chat - Click the chat icon in the sidebar or use Ctrl+Shift+I (Cmd+Shift+I on Mac)
- Enable Agent Mode - Click the sparkle icon (✨) in the chat input box
- Ask questions requiring web search - Use natural language prompts (see examples below)
The AI will automatically use Brave Search when your question requires current information from the internet.
Example Prompts
Try asking Copilot questions like these:
🔍 Web Search Examples
- "What are the latest features in TypeScript 5.7?"
- "Find documentation for the vscode.lm API"
- "Search for best practices for React Server Components"
- "Look up the current syntax for Python async/await"
- "Find examples of using the Fetch API with error handling"
- "What's the difference between REST and GraphQL?"
📰 News Search Examples
- "Find recent news about AI coding assistants"
- "What are the latest announcements from Microsoft Build?"
- "Search for news about the newest VS Code updates"
- "Find recent articles about GitHub Copilot features"
- "What's new in the JavaScript ecosystem this month?"
🖼️ Image Search Examples
- "Find images of the VS Code logo"
- "Search for TypeScript architecture diagrams"
- "Find screenshots of popular VS Code themes"
- "Look for icons representing API concepts"
💡 Tips for Best Results:
- Use natural language - No special syntax or commands needed
- Be specific - The more specific your question, the better the results
- Let the AI decide - Copilot automatically chooses which search tool to use
- Agent mode required - Make sure the sparkle icon (✨) is active in chat
How It Works
This extension uses the Model Context Protocol (MCP) to connect AI assistants to the Brave Search API:
- The extension registers an MCP server definition with VS Code
- When activated, it launches the official
@brave/brave-search-mcp-server package
- The MCP server exposes search tools to AI assistants
- AI assistants can invoke these tools automatically based on user intent
- Search results are returned and incorporated into AI responses
Troubleshooting
- Make sure you've entered your API key in the extension settings
- Verify the API key is correct and starts with
BSA
- Try reconfiguring using the Command Palette command
- Ensure you're using VS Code 1.95.0 or higher
- Make sure Copilot is in agent mode (sparkle icon)
- Check that
braveSearchMcp.enabled is set to true
- Restart VS Code after configuring the API key
"npx command not found" error
- Ensure Node.js and npm are installed on your system
- Restart VS Code after installing Node.js
- Verify npm is in your system PATH
Rate limiting errors
- Check your API usage in the Brave API Dashboard
- Consider upgrading to a paid plan if you hit the free tier limits
- See "Future Enhancements" below for planned rate limiting features
Privacy & Security
- Your API key is stored securely in VS Code's settings
- The API key is never transmitted except to Brave's API servers
- Search queries are processed by Brave Search (see Brave Privacy Policy)
- The extension only activates when the MCP server is requested by an AI assistant
Building from Source
# Clone the repository
git clone https://github.com/yourusername/brave-search-mcp-extension.git
cd brave-search-mcp-extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Package the extension
npm run package
# This creates a .vsix file you can install
Development
# Watch mode for development
npm run watch
# Run in Extension Development Host
# Press F5 in VS Code to launch a new window with the extension loaded
Future Enhancements
The following features are planned for future releases:
Rate Limiting & Quota Management
- Request throttling: Automatically limit requests to respect API rate limits
- Quota tracking: Display current API usage in status bar
- Warning notifications: Alert users when approaching monthly quota
- Request queuing: Queue requests when rate limit is hit
- Configurable limits: Allow users to set custom rate limits below API maximums
Caching
- Response caching: Cache search results to reduce API calls for repeated queries
- Configurable TTL: Allow users to set cache expiration times
- Cache statistics: Show cache hit/miss rates
- Manual cache clearing: Command to clear cached results
Additional Search Types
- Video search: Search for videos across the web
- Local search: Find local businesses and points of interest
- Spell check: Suggest corrections for misspelled queries
Enhanced Configuration
- Multiple API keys: Support for team/organization key rotation
- Search preferences: Configure default search parameters (country, language, etc.)
- Result filtering: Custom filters for search results
- Search history: View and manage recent searches
Monitoring & Analytics
- Usage dashboard: View API usage statistics within VS Code
- Error logging: Detailed logs for troubleshooting
- Performance metrics: Track search response times
- Cost estimation: Calculate estimated costs for paid tiers
User Experience
- Search result preview: View search results in VS Code before AI uses them
- Manual search command: Trigger searches directly from Command Palette
- Result annotations: Highlight and annotate search results
- Keyboard shortcuts: Quick access to search features
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
BSD 3-Clause License - see LICENSE file for details
Links
Acknowledgments
Note: This extension requires an active internet connection and a valid Brave Search API key to function.