Back to MCP directory
publicPublicdnsLocal runtime

brave-search-mcp

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

article

README

🚀 勇敢搜索 MCP 服务器

这是一个集成了 Brave Search API 的 MCP 服务器。它支持多种搜索功能,能为用户提供网页、本地地点、视频、图片和新闻等多方面的搜索服务,满足多样化的搜索需求。

🚀 快速开始

安装依赖

  • 确保已安装 Node.js 和 npm。
  • 运行 npm install 安装项目所需的依赖包。

配置环境变量

  • 创建 .env 文件并添加以下内容:
API_KEY=your_api_key_here

启动服务器

  • 执行命令 node index.jsnpm start 启动 MCP 服务。

调用接口

  • 发送请求至 http://localhost:3000/v1/search/{type},根据需要替换 {type} 为具体的功能模块 ID。
  • 示例:curl http://localhost:3000/v1/search/web?q= Brave Search

✨ 主要特性

  • 网页搜索:通过 Brave Search 进行网页内容的搜索与检索。
  • 本地地点搜索(POI):在地图上查找附近的兴趣点,如餐馆、酒店等。
  • 视频搜索:通过 YouTube 和 Twitch 等平台进行视频内容的搜索与播放。
  • 图片搜索:通过 Google Images 进行图片资源的搜索与查看。
  • 新闻搜索:聚合多个新闻来源,提供实时新闻资讯。

💻 使用示例

基础用法

以下是各功能模块的使用示例:

网页搜索 (brave_web_search)

{
  "id": "search#web",
  "name": "网页搜索",
  "description": "通过 Brave Search 实现网页内容的搜索。",
  "parameters": [
    {
      "name": "query",
      "type": "string",
      "required": true,
      "description": "要搜索的内容关键词。"
    },
    {
      "name": "count",
      "type": "number",
      "default": 10,
      "description": "返回结果的最大数量(默认为 10)。"
    }
  ]
}

本地地点搜索 (brave_location_search)

{
  "id": "search#location",
  "name": "位置搜索",
  "description": "在地图上查找附近的兴趣点。",
  "parameters": [
    {
      "name": "latitude",
      "type": "number",
      "required": true,
      "description": "搜索的纬度值。"
    },
    {
      "name": "longitude",
      "type": "number",
      "required": true,
      "description": "搜索的经度值。"
    },
    {
      "name": "radius",
      "type": "number",
      "default": 5000,
      "description": "搜索范围(以米为单位,默认为 5000 米)。"
    }
  ]
}

视频搜索 (brave_video_search)

{
  "id": "search#video",
  "name": "视频搜索",
  "description": "通过 YouTube 和 Twitch 进行视频内容的搜索与播放。",
  "parameters": [
    {
      "name": "query",
      "type": "string",
      "required": true,
      "description": "要搜索的视频关键词。"
    },
    {
      "name": "platform",
      "type": "string",
      "default": "youtube",
      "description": "指定搜索的平台(支持 youtube 和 twitch)。"
    }
  ]
}

图片搜索 (brave_image_search)

{
  "id": "search#image",
  "name": "图片搜索",
  "description": "通过 Google Images 进行图片资源的搜索与查看。",
  "parameters": [
    {
      "name": "query",
      "type": "string",
      "required": true,
      "description": "要搜索的图片关键词。"
    },
    {
      "name": "count",
      "type": "number",
      "default": 10,
      "description": "返回结果的最大数量(默认为 10)。"
    }
  ]
}

新闻搜索 (brave_news_search)

{
  "id": "search#news",
  "name": "新闻搜索",
  "description": "聚合多个新闻来源,提供实时新闻资讯。",
  "parameters": [
    {
      "name": "query",
      "type": "string",
      "required": true,
      "description": "要搜索的新闻关键词。"
    },
    {
      "name": "language",
      "type": "string",
      "default": "zh-CN",
      "description": "指定新闻的语言版本(默认为简体中文)。"
    }
  ]
}

📚 详细文档

注意事项

  • API Key:请在项目中配置合法有效的 API Key。
  • 数据安全:处理敏感信息时,需做好加密和防护措施。
  • 性能优化:根据实际需求调整服务器配置,确保服务稳定运行。

项目结构

brave-search-mcp/
├── index.js          # 主程序入口
├── config/           # 配置文件夹
│   └── keys.js      # API Key 管理
├── services/         # 各功能模块实现
│   ├── webSearch.js  # 网页搜索服务
│   ├── location.js  # 位置搜索服务
│   ├── video.js     # 视频搜索服务
│   ├── image.js     # 图片搜索服务
│   └── news.js      # 新闻搜索服务
└── package.json      # 项目依赖及脚本配置

贡献指南

欢迎社区贡献代码!如发现任何问题或有改进建议,请通过 GitHub 提交 Issues 或 Pull Request。

📄 许可证

  • 开源协议:MIT License
  • 版权声明:版权归原作者所有,未经授权禁止商业使用。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client