Brave Search Mcp Sse

Brave Search Mcp Sse

🚀 勇敢搜索代理服务器

欢迎使用勇敢搜索 MCP 代理服务器!本项目借助代理服务器实现与勇敢搜索的交互,并且支持通过实时流协议(Server - Sent Events, SSE)进行通信。以下为您详细介绍该项目。

🚀 快速开始

安装指南

克隆仓库

git clone git@github.com:yourusername/brave-search-mcp-server.git
cd brave-search-mcp-server

安装依赖

使用 npm 管理项目依赖:

npm install

项目运行

启动服务

node src/index.ts

配置环境变量

.env.example 文件重命名为 .env,并按需修改配置。

✨ 主要特性

  • 基于 Docker 的容器化部署:通过 Dockerfile 提供完整的 Docker 镜像构建支持。
  • Kubernetes 部署支持:提供 Helm Chart 文件 (helm/brave-search-mcp-sse),便于在 Kubernetes 环境中进行部署。
  • MCP 协议支持:通过 SSE 实现实时消息通信协议 (MCP),允许客户端与服务器进行交互。

📦 工具功能

1. brave_web_search

  • 描述:使用勇敢搜索 API 进行通用网络搜索。
  • 输入参数
    • query(字符串,必需):搜索查询。
    • count(数字,可选):返回结果的数量(1 - 20,默认为 10)。
    • offset(数字,可选):分页偏移量(0 - 9,默认为 0)。
    • 其他勇敢 API 参数如 search_langcountryfreshnessresult_filtersafesearch 可能被支持(具体参数请参见 src/services/braveSearchApi.ts)。
  • 输出:流式传输 MCP 消息,包含搜索结果(标题、链接、段落等)。

2. brave_local_search

  • 描述:使用勇敢搜索 API 进行本地商业和地点搜索。若没有本地结果,则回退到网络搜索。
  • 输入参数
    • query(字符串,必需):本地搜索查询(例如 "pizza near me"、"downtown 的咖啡馆")。
    • count(数字,可选):返回结果的数量(默认为 10)。
  • 输出:流式传输 MCP 消息,包含本地商家信息。

💻 使用示例

基础用法

const fetch = require('node-fetch');

async function search(query) {
const response = await fetch('http://localhost:3000', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"command": "brave_web_search",
"params": {
"query": query
}
})
});

const decoder = new TextDecoder();
const encoder = new TextEncoder();

for await (const chunk of response.body.get chunks()) {
console.log(decoder.decode(chunk));
}
}

🤝 贡献指南

提交代码

  1. 创建功能分支
git checkout -b feature/your-feature-name
  1. 提交更改
git add .
git commit -m 'feat: 添加新功能'
  1. 推送到远程仓库并创建 Pull Request
git push origin feature/your-feature-name

贡献准则

  • 请遵循项目代码风格和规范。
  • 提交的代码必须包含相应的测试用例。
  • 请确保提交的信息清晰明了。

📄 许可证

本项目使用 MIT 许可证,具体条款如下:

MIT License

Copyright (c) [年份] [作者姓名]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

更多详细信息请参考 MIT License

  • 0 关注
  • 0 收藏,8 浏览
  • system 提出于 2025-09-23 04:36

相似服务问题