Brave Search MCP Server
支持 SSE 的 Brave Search MCP
这是一个模型上下文协议 (MCP) 服务器,提供 Brave Search 功能,并集成了服务器发送事件 (SSE)。它可以部署到 Coolify 并用作实时搜索服务。
特征
通过 MCP 集成 Brave Search API
使用 SSE 的实时搜索结果
Docker 和 Coolify 已准备就绪
TypeScript 实现
Express.js SSE 端点
Related MCP server: WebSearch-MCP
先决条件
Brave Search API 密钥
Node.js 18+
Docker(用于容器化部署)
Coolify 实例
本地开发
克隆存储库
使用您的 Brave API 密钥创建一个
.env文件:BRAVE_API_KEY=your_api_key_here PORT=3001安装依赖项:
npm install启动开发服务器:
npm run dev
Docker 部署
使用 docker-compose 构建并运行:
docker-compose up --build
Coolify 部署
在 Coolify 仪表板中,创建一个新服务
选择“从源部署”
配置以下内容:
存储库 URL:您的存储库 URL
分支:主
构建命令:
npm run build启动命令:
npm start端口:3001
环境变量:
BRAVE_API_KEY=你的 API 密钥
端口=3001
使用 SSE 集成
SSE 端点
GET http://your-server:3001/sseSSE 端点提供实时搜索结果。使用 EventSource API 连接到该端点:
const eventSource = new EventSource('http://your-server:3001/sse');
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
// Handle the search results
console.log(data);
};
eventSource.onerror = (error) => {
console.error('SSE Error:', error);
eventSource.close();
};消息端点
POST http://your-server:3001/messages
Content-Type: application/json
{
"query": "your search query",
"count": 10 // optional, default: 10, max: 20
}使用此端点触发将广播到所有连接的 SSE 客户端的搜索。
MCP 使用
服务器提供以下MCP工具:
brave_web_search:使用 Brave Search API 执行网络搜索{ query: string; // Search query count?: number; // Number of results (1-20, default: 10) }
错误处理
服务器向所有连接的 SSE 客户端广播错误
错误格式如下:
{ "type": "error", "error": "error message" }
笔记
SSE 连接将保持打开状态,直到客户端关闭它
每个搜索结果都会广播给所有连接的客户端
服务器自动处理断开连接和清理
对于生产部署,请考虑对消息端点实施身份验证
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Web search API and MCP server for developers building AI agents.
Visit https://brave.com/search/api/ for a free API key. Search the web, local businesses, images,…
Related MCP Servers
- -licenseNot gradedqualityBmaintenanceAn MCP server implementation that integrates the Brave Search API, providing both web and local search capabilities.27,402 npm92,139MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI assistants to perform real-time web searches, retrieving up-to-date information from the internet via a Crawler API.155 npm42ISC
- AlicenseAqualityBmaintenanceA Model Context Protocol server that provides real-time web search capabilities to AI assistants through pluggable search providers, currently integrated with the Brave Search API.534 npm16MIT
- AlicenseAqualityDmaintenanceAn MCP Server implementation that integrates the Brave Search API, providing, Web Search, Local Points of Interest Search, Image Search, Video Search, News Search and LLM Context Search capabilities5131GPL 3.0