Brave Search MCP

by mikechao
Verified
GPL 3.0
94
1
  • Linux
  • Apple

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides Web Search, Local Points of Interest Search, Video Search, Image Search and News Search capabilities through the Brave Search API, allowing users to retrieve various types of search results.

Brave Search MCP 服务器

集成Brave Search API 的MCP 服务器实现,提供网页搜索、本地兴趣点搜索、视频搜索、图片搜索和新闻搜索功能

特征

  • 网络搜索:在网络上进行常规搜索
  • 图片搜索:在网络上搜索图片。图片搜索结果将作为资源提供
  • 新闻搜索:在网络上搜索新闻
  • 视频搜索:在网络上搜索视频
  • 本地兴趣点搜索:搜索本地实体位置、企业、餐厅、服务等

工具

  • brave_web_search
    • 使用 Brave 的 API 执行网络搜索
    • 输入:
      • query (字符串):在互联网上搜索的术语
      • count (数字,可选):返回的结果数(最大 20,默认 10)
  • brave_image_search
    • 从网络上获取与查询相关的图像
    • 输入:
      • query (字符串):用于在互联网上搜索图片的术语
      • count (数字,可选):要返回的图像数量(最多 3 个,默认 1 个)
  • brave_news_search
    • 在网上搜索新闻
    • 输入:
      • query (字符串):在互联网上搜索新闻文章、热门话题或最近事件的术语
      • count (数字,可选):返回的结果数(最大 20,默认 10)
  • brave_local_search
    • 搜索本地商家、服务和兴趣点
    • 需要订阅 Pro API 计划才能获取位置结果
    • 如果未找到位置结果,则返回 brave_web_search
    • 输入:
      • query (字符串):本地搜索词
      • count (数字,可选):返回的结果数(最多 20 个,默认为 5 个)
  • brave_video_search
    • 在网上搜索视频
    • 输入:
      • query :(字符串):搜索视频的术语
      • count :(数字,可选):要返回的视频数量(最多 20 个,默认为 10 个)

配置

获取 API 密钥

  1. 注册Brave Search API 帐户
  2. 选择计划(免费套餐,每月 2,000 次查询)
  3. 从开发者仪表板生成您的 API 密钥

与 Claude Desktop 一起使用

Docker

  1. 克隆 repo
  2. Docker 构建
docker build -t brave-search-mcp:latest -f ./Dockerfile .
  1. 将其添加到您的claude_desktop_config.json中:
{ "mcp-servers": { "brave-search": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "BRAVE_API_KEY", "brave-search-mcp" ], "env": { "BRAVE_API_KEY": "YOUR API KEY HERE" } } } }

NPX

将其添加到您的claude_desktop_config.json中:

{ "mcp-servers": { "brave-search": { "command": "npx", "args": [ "-y", "brave-search-mcp" ], "env": { "BRAVE_API_KEY": "YOUR API KEY HERE" } } } }

与 LibreChat 一起使用

将其添加到 librechat.yaml

brave-search: command: sh args: - -c - BRAVE_API_KEY=API KEY npx -y brave-search-mcp

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

调试

  1. 克隆 repo
  2. 安装依赖项并构建它
npm install
  1. 构建应用程序
npm run build

使用 VS Code 运行和调试功能

⚠ 似乎在 Windows 10/11 上不起作用,但在 WSL2 中起作用

使用 VS Code Run 和 Debug 启动器,并在代码中设置功能齐全的断点:

  1. 找到并选择运行调试。
  2. 在下拉菜单中选择标有“ MCP Server Launcher ”的配置。
  3. 选择运行/调试按钮。我们可以使用MCP Inspector和 VS Code 调试各种工具。

VS Code 调试设置

要设置带断点的本地调试:

  1. 在 VS Code 中存储 Brave API 密钥
    • 打开命令面板(Cmd/Ctrl + Shift + P)。
    • 类型Preferences: Open User Settings (JSON)
    • 添加以下代码片段:
    { "brave.search.api.key": "your-api-key-here" }
  2. 创建或更新.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "MCP Server Launcher", "skipFiles": ["<node_internals>/**"], "program": "${workspaceFolder}/node_modules/@modelcontextprotocol/inspector/cli/build/cli.js", "outFiles": ["${workspaceFolder}/dist/**/*.js"], "env": { "BRAVE_API_KEY": "${config:brave.search.api.key}", "DEBUG": "true" }, "args": ["dist/index.js"], "sourceMaps": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "preLaunchTask": "npm: build:watch" }, { "type": "node", "request": "attach", "name": "Attach to Debug Hook Process", "port": 9332, "skipFiles": ["<node_internals>/**"], "sourceMaps": true, "outFiles": ["${workspaceFolder}/dist/**/*.js"] }, { "type": "node", "request": "attach", "name": "Attach to REPL Process", "port": 9333, "skipFiles": ["<node_internals>/**"], "sourceMaps": true, "outFiles": ["${workspaceFolder}/dist/**/*.js"] } ], "compounds": [ { "name": "Attach to MCP Server", "configurations": ["Attach to Debug Hook Process", "Attach to REPL Process"] } ] }
  1. 创建.vscode/tasks.json
{ "version": "2.0.0", "tasks": [ { "type": "npm", "script": "build:watch", "group": { "kind": "build", "isDefault": true }, "problemMatcher": ["$tsc"] } ] }

免责声明

此库与 Brave Software 没有正式关联。它是 Brave Search API 与 MCP 服务器的第三方实现。

执照

该项目根据 GNU 通用公共许可证 v3.0 获得许可 - 有关详细信息,请参阅LICENSE文件。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

通过Brave Search API提供网页搜索、本地兴趣点搜索、视频搜索、图片搜索和新闻搜索功能,让用户可以检索各种类型的搜索结果。

  1. Features
    1. Tools
      1. Configuration
        1. Getting an API Key
        2. Usage with Claude Desktop
      2. Docker
        1. NPX
        2. Usage with LibreChat
      3. Contributing
        1. Debugging
          1. Use the VS Code Run and Debug Function
          2. VS Code Debug setup
        2. Disclaimer
          1. License
            ID: kku1cfh7ea