欢迎使用勇敢搜索 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
,并按需修改配置。
Dockerfile
提供完整的 Docker 镜像构建支持。helm/brave-search-mcp-sse
),便于在 Kubernetes 环境中进行部署。brave_web_search
query
(字符串,必需):搜索查询。count
(数字,可选):返回结果的数量(1 - 20,默认为 10)。offset
(数字,可选):分页偏移量(0 - 9,默认为 0)。search_lang
、country
、freshness
、result_filter
、safesearch
可能被支持(具体参数请参见 src/services/braveSearchApi.ts
)。brave_local_search
query
(字符串,必需):本地搜索查询(例如 "pizza near me"、"downtown 的咖啡馆")。count
(数字,可选):返回结果的数量(默认为 10)。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));
}
}
git checkout -b feature/your-feature-name
git add .
git commit -m 'feat: 添加新功能'
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。