Skip to main content
Glama
mikechao

Brave Search MCP

by mikechao

Brave Search MCP 服务器

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

特征

  • 网络搜索:在网络上进行常规搜索

  • 图片搜索:在网络上搜索图片。图片搜索结果将作为资源提供

  • 新闻搜索:在网络上搜索新闻

  • 视频搜索:在网络上搜索视频

  • 本地兴趣点搜索:搜索本地实体位置、企业、餐厅、服务等

Related MCP server: Brave Search With Proxy

工具

  • 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文件。

Available Tools

5 tools

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.0.0
    • First observedbrave_image_search
    • First observedbrave_local_search
    • First observedbrave_news_search
    • First observedbrave_video_search
    • First observedbrave_web_search

TDQS

A4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose targeting different content types: images, local businesses, news articles, videos, and general web content. The descriptions explicitly differentiate use cases (e.g., 'near me' for local search, 'recent events' for news), eliminating any ambiguity between tools.

Naming Consistency5/5

All tool names follow a consistent 'brave_[content_type]_search' pattern, using snake_case uniformly. This predictable naming scheme makes it easy to identify the tool's function and ensures no confusion from mixed conventions.

Tool Count5/5

With 5 tools, this server is well-scoped for its purpose of providing specialized search capabilities across different content types. Each tool earns its place by covering distinct search domains, avoiding both redundancy and excessive fragmentation.

Completeness5/5

The tool set comprehensively covers the search domain by addressing all major content types: images, local information, news, videos, and general web content. There are no obvious gaps, as agents can handle any search query by selecting the appropriate specialized or general tool.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers