brave-search-mcp is an MCP Server implementation for integrating the Brave Search API, providing a variety of search capabilities for AI applications.
Purpose
The tool is designed to enable AI agents, LLM applications, or RAG pipelines to call the Brave search service through the standardized MCP protocol to retrieve web pages, images, news, videos, local points of interest, and pre-extracted web content.
Main Capabilities
- Web Search (brave_web_search): Performs a regular web search. Input parameters include query (search term), count (number of results to return, maximum 20, default 10), offset (pagination offset, default 0), freshness (filter by discovery time, supports pd, pw, pm, py, or a custom date range YYYY-MM-DDtoYYYY-MM-DD).
- Image Search (brave_image_search): Searches web images. Input parameters include query, count (maximum 50, default 10).
- News Search (brave_news_search): Searches news. Input parameters include query, count (maximum 20, default 10), offset (maximum 9), freshness (same as Web Search).
- Local Points of Interest Search (brave_local_search): Searches local businesses, services, and points of interest. Input parameters include query, count (maximum 20, default 5), offset (maximum 9). If no location results are found on the initial page, it falls back to brave_web_search.
- Video Search (brave_video_search): Searches videos. Input parameters include query, count (maximum 20, default 10), offset (maximum 9), freshness (same as Web Search).
- LLM Context Search (brave_llm_context_search): Retrieves and extracts full web content optimized for reading and synthesizing sources, suitable for AI agents, LLM grounding, and RAG pipelines. compact mode uses Brave's balanced context threshold mode, while full mode disables Brave relevance filtering. Input parameters include query (maximum 400 characters, 50 words), url (optional; if specified, only snippets for that URL are returned), count (default 8, range 1-50), maximumNumberOfUrls (default 8, range 1-50), maximumNumberOfTokens (default 2048, range 1024-32768), maximumNumberOfSnippets (default 16, range 1-100), maximumNumberOfTokensPerUrl (default 512, range 512-8192), maximumNumberOfSnippetsPerUrl (default 2, range 1-100), responseMode (compact or full, default compact), maxSnippetChars (default 400, range 80-4000), maxOutputChars (default 8000, range 1000-100000).
Usage
- You need to first register a Brave Search API account and generate an API key in the developer dashboard.
- By default, it runs in stdio mode.
- Streamable HTTP mode can be enabled, listening by default on port 3001, with the URL being http://localhost:3001/mcp(根据资料推断,实际 The URL does not explicitly give the full path, only stating the default port 3001).
- There are two configuration modes:
- Env mode: BRAVE_MCP_CONFIG is not set, and feature toggles come from environment variables.
- File mode: BRAVE_MCP_CONFIG=/path/to/config.toml is set, the TOML file becomes the sole source of feature settings, and overlapping feature environment variables are ignored with a warning.
- Environment variable settings (always read from the process environment): BRAVE_API_KEY (required), PORT (optional, default 3001), HOST (optional, default 0.0.0.0), BRAVE_MCP_CONFIG (optional).
- Env mode feature settings: ALLOWED_HOSTS (HTTP mode only, a comma-separated list of hostnames used for Host header validation, for example ALLOWED_HOSTS=localhost,127.0.0.1,my-app.ngrok-free.app, using only hostnames, without protocol or path).
- Supports OpenAI Apps and MCP Apps: when UI mode is enabled for each tool, there is a corresponding UI widget that can control what is added to the model context.
Use cases
- Provide real-time web search capabilities for AI agents.
- Build AI applications that need images, news, videos, or local information.
- Provide LLMs with pre-extracted and optimized web content for RAG or grounding.
- Integrate into AI development platforms or chat applications that support the MCP protocol via the MCP protocol.
Limitations
- Requires a valid Brave Search API key.
- Parameters such as the number of results returned, offset, and freshness for each search tool have explicit upper limits.
- The query for LLM Context Search has character and word count limits.
- The materials do not provide specific installation commands, code examples, pricing information, or platform compatibility details; these contents are not provided for now.