🚀 Open-WebSearch MCP Server
Open-WebSearch MCP Server 是一个基于多引擎搜索结果的 Model Context Protocol (MCP) 服务器,支持无需 API 密钥的免费网络搜索,为用户提供便捷的网络信息获取途径。

中文
✨ 主要特性
- 多引擎网络搜索:支持使用多个搜索引擎进行网络搜索,包括 Bing、百度、CSDN、DuckDuckGo、Exa、Brave 等。不过,
linux.do 暂时不支持。
- HTTP 代理配置:支持配置 HTTP 代理,以便访问受限资源。
- 无需 API 密钥:使用该服务器进行搜索无需 API 密钥或身份验证。
- 结构化结果返回:搜索结果以结构化形式返回,包含标题、URL 和描述。
- 结果数量可配置:每次搜索返回的结果数量可以进行配置。
- 默认搜索引擎可定制:可以自定义默认的搜索引擎。
- 文章内容获取:支持获取 CSDN 博客文章的完整内容。
📋 待办事项
- 支持更多搜索引擎,如 Google 等(Bing、DuckDuckGo、Exa、Brave 已支持)。
- 支持更多博客、论坛和社交平台。
- 优化文章内容提取功能,增加对更多网站的支持。
📦 安装指南
本地安装
- 克隆或下载本仓库。
- 安装依赖:
npm install
- 构建服务器:
npm run build
- 将服务器添加到 MCP 配置中:
Cherry Studio:
{
"mcpServers": {
"web-search": {
"name": "Web Search MCP",
"type": "streamableHttp",
"description": "Multi-engine web search with article fetching",
"isActive": true,
"baseUrl": "http://localhost:3000/mcp"
}
}
}
VSCode (Claude Dev Extension):
{
"mcpServers": {
"web-search": {
"transport": {
"type": "streamableHttp",
"url": "http://localhost:3000/mcp"
}
},
"web-search-sse": {
"transport": {
"type": "sse",
"url": "http://localhost:3000/sse"
}
}
}
}
Claude Desktop:
{
"mcpServers": {
"web-search": {
"transport": {
"type": "streamableHttp",
"url": "http://localhost:3000/mcp"
}
},
"web-search-sse": {
"transport": {
"type": "sse",
"url": "http://localhost:3000/sse"
}
}
}
}
Docker 部署
使用 Docker Compose 快速部署:
docker-compose up -d
或者直接使用 Docker:
docker run -d --name web-search -p 3000:3000 -e ENABLE_CORS=true -e CORS_ORIGIN=* ghcr.io/aas-ee/open-web-search:latest
环境变量配置:
ENABLE_CORS=true
CORS_ORIGIN=*
DEFAULT_SEARCH_ENGINE=duckduckgo
USE_PROXY=true
PROXY_URL=http://your-proxy-server:port
PORT=8080
然后在 MCP 客户端中进行配置:
{
"mcpServers": {
"web-search": {
"name": "Web Search MCP",
"type": "streamableHttp",
"description": "Multi-engine web search with article fetching",
"isActive": true,
"baseUrl": "http://localhost:3000/mcp"
},
"web-search-sse": {
"transport": {
"name": "Web Search MCP",
"type": "sse",
"description": "Multi-engine web search with article fetching",
"isActive": true,
"url": "http://localhost:3000/sse"
}
}
}
}
💻 使用示例
search 工具使用
{
"query": string,
"limit": number,
"engines": string[]
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "search",
arguments: {
query: "search content",
limit: 3,
engines: ["bing", "csdn", "duckduckgo", "exa", "brave"]
}
})
响应示例:
[
{
"title": "Example Search Result",
"url": "https://example.com",
"description": "Description text of the search result...",
"source": "Source",
"engine": "Engine used"
}
]
fetchCsdnArticle 工具使用
用于获取 CSDN 博客文章的完整内容。
{
"url": string
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "fetchCsdnArticle",
arguments: {
url: "https://blog.csdn.net/xxx/article/details/xxx"
}
})
响应示例:
[
{
"content": "Example search result"
}
]
fetchLinuxDoArticle 工具使用
用于获取 Linux.do 论坛文章的完整内容。
{
"url": string
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "fetchLinuxDoArticle",
arguments: {
url: "https://xxxx.json"
}
})
响应示例:
[
{
"content": "Example search result"
}
]
⚠️ 使用限制
由于该工具通过抓取多引擎搜索结果来工作,请注意以下重要限制:
- 速率限制:
- 短时间内进行过多搜索可能会导致所使用的搜索引擎暂时阻止请求。
- 建议:
- 保持合理的搜索频率。
- 谨慎使用
limit 参数。
- 必要时在搜索之间添加延迟。
- 结果准确性:
- 结果准确性取决于相应搜索引擎的 HTML 结构,当搜索引擎更新时可能会失败。
- 部分结果可能缺少描述等元数据。
- 复杂的搜索运算符可能无法按预期工作。
- 法律条款:
- 本工具仅用于个人使用。
- 请遵守相应搜索引擎的服务条款。
- 根据实际使用情况实施适当的速率限制。
- 搜索引擎配置:
- 可以通过
DEFAULT_SEARCH_ENGINE 环境变量设置默认搜索引擎。
- 支持的搜索引擎:bing、duckduckgo、exa、brave。
- 搜索特定网站时使用默认引擎。
- 代理配置:
- 当某些搜索引擎在特定地区不可用时,可以配置 HTTP 代理。
- 使用环境变量
USE_PROXY=true 启用代理。
- 使用
PROXY_URL 配置代理服务器地址。
👥 贡献指南
欢迎提交问题报告和功能改进建议!
贡献者指南
如果您想分叉此仓库并发布自己的 Docker 镜像,需要进行以下配置:
GitHub 密钥配置
为了启用自动 Docker 镜像构建和发布,请在您的 GitHub 仓库设置(Settings → Secrets and variables → Actions)中添加以下密钥:
必需密钥:
GITHUB_TOKEN:由 GitHub 自动提供(无需设置)
可选密钥(适用于阿里云 ACR):
ACR_REGISTRY:您的阿里云容器镜像服务 URL(例如,registry.cn-hangzhou.aliyuncs.com)
ACR_USERNAME:您的阿里云 ACR 用户名
ACR_PASSWORD:您的阿里云 ACR 密码
ACR_IMAGE_NAME:您在 ACR 中的镜像名称(例如,your-namespace/open-web-search)
CI/CD 工作流
该仓库包含一个 GitHub Actions 工作流(.github/workflows/docker.yml),它会自动执行以下操作:
- 触发条件:
- 推送到
main 分支。
- 推送版本标签(
v*)。
- 手动触发工作流。
- 构建并推送到:
- GitHub Container Registry (ghcr.io) - 始终启用。
- 阿里云容器镜像服务 - 仅在配置了 ACR 密钥时启用。
- 镜像标签:
ghcr.io/your-username/open-web-search:latest
your-acr-address/your-image-name:latest(如果配置了 ACR)
分叉和发布步骤
- 将仓库分叉到您的 GitHub 账户。
- 配置密钥(如果需要 ACR 发布):
- 转到您分叉仓库的 Settings → Secrets and variables → Actions。
- 添加上述与 ACR 相关的密钥。
- 将更改推送到
main 分支或创建版本标签。
- GitHub Actions 将自动构建并推送您的 Docker 镜像。
- 使用您的镜像,更新 Docker 命令:
docker run -d --name web-search -p 3000:3000 -e ENABLE_CORS=true -e CORS_ORIGIN=* ghcr.io/your-username/open-web-search:latest
注意事项
- 如果您未配置 ACR 密钥,工作流将仅发布到 GitHub Container Registry。
- 确保您的 GitHub 仓库已启用 Actions。
- 工作流将使用您的 GitHub 用户名(转换为小写)作为 GHCR 镜像名称。
⭐ 星标历史
如果您觉得这个项目有帮助,请考虑给它一个 ⭐ 星标!
