Home / MCP / MCP Brave MCP Server

MCP Brave MCP Server

Provides MCP-based Brave API web search capabilities with configurable environment and local runtime via UV.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "mcp2brave": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "fastmcp",
                "--with",
                "python-dotenv",
                "--with",
                "beautifulsoup4",
                "--with",
                "requests",
                "fastmcp",
                "run",
                "C:\\Users\\\u4f60\u7684\u771f\u5b9e\u8def\u5f84\\mcp2brave.py"
            ],
            "env": {
                "BRAVE_API_KEY": "YOUR_BRAVE_API_KEY"
            }
        }
    }
}

You have an MCP server that uses the Brave API to perform network searches through the MCP protocol. It enables you to query Brave-backed web searches programmatically, making it easy to fetch search results within your MCP client workflows and automation.

How to use

You can interact with this MCP server from any MCP client. Send search requests to the server, and it will query Brave API-backed networks and return results you can present to users or use in downstream automation. Use the standard MCP client workflow to connect, issue a search command, and handle the structured results.

How to install

Prerequisites you need before installation: Python 3.11+, the UV package manager, and a Brave API key.

Step 1 — Clone the project and enter the directory. You will replace the placeholder with your actual repository address.

git clone <仓库地址>
cd mcp2brave

Step 2 — Create and configure the environment file with your Brave API key.

.env

Step 3 — Create and activate a virtual environment using UV.

uv venv
# Windows系统
.venv\Scripts\activate
# Linux/Mac系统
source .venv/bin/activate

Step 4 — Install dependencies using UV.

uv sync

手动将下列 MCP 配置添加到你的 MCP 客户端配置中,以便本服务器可以通过 UV 运行。请将实际路径和密钥替换为你的环境值。

"mcp2brave": {
  "command": "uv",
  "args": [
    "run",
    "--with",
    "fastmcp",
    "--with",
    "python-dotenv",
    "--with",
    "beautifulsoup4",
    "--with",
    "requests",
    "fastmcp",
    "run",
    "C:\\Users\\你的真实路径\\mcp2brave.py"
  ],
  "env": {
    "BRAVE_API_KEY": "API密钥"
  }
}

Additional guidance

以下是使用中可能用到的要点:你需要在环境变量中提供 Brave_API_KEY,在激活虚拟环境后再运行相关命令。如果遇到编码问题,请确保系统使用 UTF-8 编码。你也可以通过 MCP 检查器在开发模式下测试功能,浏览器访问地址通常是本地地址(例如 http://localhost:5173)。

Troubleshooting

确保 Brave API 密钥已正确设置并可用于加载 Brave 相关资源。若环境无法识别 uv 命令,请确认你已在当前会话中激活了虚拟环境,并且按步骤安装了依赖。若遇到路径问题,请将实际路径替换到配置片段中的示例路径。

Available tools

search_web

Query Brave API to perform a network search and retrieve results.

search_web_info

Query Brave API with中文描述 to obtain search results with description.