OpenWebSearch网络搜索(正确配置)
基于多引擎搜索结果的模型上下文协议(MCP)服务器,支持无需API密钥的免费网络搜索。它包括使用多个搜索引擎进行网络搜索、HTTP代理配置支持以及从各种来源获取单篇文章内容等功能。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"open-websearch-local": {
"args": [
"open-websearch@latest"
],
"command": "npx",
"env": {
"ALLOWED_SEARCH_ENGINES": "bing,exa,baidu,juejin,csdn",
"DEFAULT_SEARCH_ENGINE": "exa",
"MODE": "stdio"
}
},
"web-search-sse": {
"transport": {
"description": "Multi-engine web search with article fetching",
"isActive": true,
"name": "Web Search MCP",
"type": "sse",
"url": "http://localhost:3000/sse"
}
}
}
}
可用工具 (5 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
search 3 个参数 需填 1 项
Search the web using multiple engines (e.g., Baidu, Bing, DuckDuckGo, CSDN, Exa, Brave, Juejin(掘金)) with no API key required
必填参数:query
fetchLinuxDoArticle 1 个参数 需填 1 项
Fetch full article content from a linux.do post URL
必填参数:url
fetchCsdnArticle 1 个参数 需填 1 项
Fetch full article content from a csdn post URL
必填参数:url
fetchGithubReadme 1 个参数 需填 1 项
Fetch README content from a GitHub repository URL
必填参数:url
fetchJuejinArticle 1 个参数 需填 1 项
Fetch full article content from a Juejin(掘金) post URL
必填参数:url
服务介绍
Open-WebSearch MCP 服务器
🇨🇳 中文 | 🇺🇸 English
基于多引擎搜索结果的模型上下文协议(MCP)服务器,支持无需API密钥的免费网络搜索。
功能
- 使用多引擎结果进行网络搜索
- bing
- baidu
- ~~linux.do~~ 暂不支持
- csdn
- duckduckgo
- exa
- brave
- juejin
- 支持HTTP代理配置以访问受限资源
- 不需要API密钥或认证
- 返回带有标题、URL和描述的结构化结果
- 可配置每次搜索的结果数量
- 可自定义默认搜索引擎
- 支持获取单篇文章内容
- csdn
- github (README文件)
待办事项
- 支持~~Bing~~ (已支持), ~~DuckDuckGo~~ (已支持), ~~Exa~~ (已支持), ~~Brave~~ (已支持), Google及其他搜索引擎
- 支持更多博客、论坛及社交平台
- 优化文章内容提取,增加对更多站点的支持
- ~~支持GitHub README获取~~ (已支持)
安装指南
NPX快速启动(推荐)
最快捷的开始方式:
# Basic usage
npx open-websearch@latest
# With environment variables (Linux/macOS)
DEFAULT_SEARCH_ENGINE=duckduckgo ENABLE_CORS=true npx open-websearch@latest
# Windows PowerShell
$env:DEFAULT_SEARCH_ENGINE="duckduckgo"; $env:ENABLE_CORS="true"; npx open-websearch@latest
# Windows CMD
set MODE=stdio && set DEFAULT_SEARCH_ENGINE=duckduckgo && npx open-websearch@latest
# Cross-platform (requires cross-env, Used for local development)
npm install -g open-websearch
npx cross-env DEFAULT_SEARCH_ENGINE=duckduckgo ENABLE_CORS=true open-websearch
环境变量:
| 变量 | 默认值 | 选项 | 描述 |
|---|---|---|---|
ENABLE_CORS |
false |
true, false |
启用CORS |
CORS_ORIGIN |
* |
任何有效的来源 | CORS来源配置 |
DEFAULT_SEARCH_ENGINE |
bing |
bing, duckduckgo, exa, brave, baidu, csdn, juejin |
默认搜索引擎 |
USE_PROXY |
false |
true, false |
启用HTTP代理 |
PROXY_URL |
http://127.0.0.1:7890 |
任何有效的URL | 代理服务器URL |
MODE |
both |
both, http, stdio |
服务器模式:同时HTTP+STDIO, 仅HTTP, 或仅STDIO |
PORT |
3000 |
1-65535 | 服务器端口 |
ALLOWED_SEARCH_ENGINES |
空 (所有可用) | 逗号分隔的引擎名称 | 限制可以使用的搜索引擎;如果默认引擎不在这个列表中,则第一个允许的引擎成为默认引擎 |
MCP_TOOL_SEARCH_NAME |
search |
有效的MCP工具名称 | 自定义搜索工具名称 |
MCP_TOOL_FETCH_LINUXDO_NAME |
fetchLinuxDoArticle |
有效的MCP工具名称 | 自定义Linux.do文章抓取工具名称 |
MCP_TOOL_FETCH_CSDN_NAME |
fetchCsdnArticle |
有效的MCP工具名称 | 自定义CSDN文章抓取工具名称 |
MCP_TOOL_FETCH_GITHUB_NAME |
fetchGithubReadme |
有效的MCP工具名称 | 自定义GitHub README抓取工具名称 |
MCP_TOOL_FETCH_JUEJIN_NAME |
fetchJuejinArticle |
有效的MCP工具名称 | 自定义掘金文章抓取工具名称 |
常见配置:
# Enable proxy for restricted regions
USE_PROXY=true PROXY_URL=http://127.0.0.1:7890 npx open-websearch@latest
# Full configuration
DEFAULT_SEARCH_ENGINE=duckduckgo ENABLE_CORS=true USE_PROXY=true PROXY_URL=http://127.0.0.1:7890 PORT=8080 npx open-websearch@latest
本地安装
- 克隆或下载此仓库
- 安装依赖:
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 扩展):
{
"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"
}
}
}
}
NPX 命令行配置:
{
"mcpServers": {
"web-search": {
"args": [
"open-websearch@latest"
],
"command": "npx",
"env": {
"MODE": "stdio",
"DEFAULT_SEARCH_ENGINE": "duckduckgo",
"ALLOWED_SEARCH_ENGINES": "duckduckgo,bing,exa"
}
}
}
}
本地STDIO配置(适用于Windows上的Cherry Studio):
{
"mcpServers": {
"open-websearch-local": {
"command": "node",
"args": ["C:/path/to/your/project/build/index.js"],
"env": {
"MODE": "stdio",
"DEFAULT_SEARCH_ENGINE": "duckduckgo",
"ALLOWED_SEARCH_ENGINES": "duckduckgo,bing,exa"
}
}
}
}
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 | false | true, false | 启用CORS |
| CORS_ORIGIN | * | 任何有效的源 | CORS源配置 |
| DEFAULT_SEARCH_ENGINE | bing | bing, duckduckgo, exa, brave | 默认搜索引擎 |
| USE_PROXY | false | true, false | 启用HTTP代理 |
| PROXY_URL | http://127.0.0.1:7890 | 任何有效的URL | 代理服务器URL |
| PORT | 3000 | 1-65535 | 服务器端口 |
然后在您的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、fetchLinuxDoArticle、fetchCsdnArticle 和 fetchGithubReadme。
search 工具使用方法
{
"query": string, // Search query
"limit": number, // Optional: Number of results to return (default: 10)
"engines": string[] // Optional: Engines to use (bing,baidu,linuxdo,csdn,duckduckgo,exa,brave,juejin) default bing
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "search",
arguments: {
query: "search content",
limit: 3, // Optional parameter
engines: ["bing", "csdn", "duckduckgo", "exa", "brave", "juejin"] // Optional parameter, supports multi-engine combined search
}
})
响应示例:
[
{
"title": "Example Search Result",
"url": "https://example.com",
"description": "Description text of the search result...",
"source": "Source",
"engine": "Engine used"
}
]
fetchCsdnArticle 工具使用方法
用于获取完整的CSDN博客文章内容。
{
"url": string // URL from CSDN search results using the search tool
}
使用示例:
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 // URL from linuxdo search results using the search tool
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "fetchLinuxDoArticle",
arguments: {
url: "https://xxxx.json"
}
})
响应示例:
[
{
"content": "Example search result"
}
]
fetchGithubReadme 工具使用方法
用于从GitHub仓库中获取README内容。
{
"url": string // GitHub repository URL (supports HTTPS, SSH formats)
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "fetchGithubReadme",
arguments: {
url: "https://github.com/Aas-ee/open-webSearch"
}
})
支持的URL格式:
- HTTPS:
https://github.com/owner/repo - HTTPS with .git:
https://github.com/owner/repo.git - SSH:
git@github.com:owner/repo.git - 带参数的URL:
https://github.com/owner/repo?tab=readme
响应示例:
[
{
"content": "<div align=\"center\">\n\n# Open-WebSearch MCP Server..."
}
]
fetchJuejinArticle 工具使用方法
用于获取完整的掘金文章内容。
{
"url": string // Juejin article URL from search results
}
使用示例:
use_mcp_tool({
server_name: "web-search",
tool_name: "fetchJuejinArticle",
arguments: {
url: "https://juejin.cn/post/7520959840199360563"
}
})
支持的URL格式:
https://juejin.cn/post/{article_id}
响应示例:
[
{
"content": "🚀 开源 AI 联网搜索工具:Open-WebSearch MCP 全新升级,支持多引擎 + 流式响应..."
}
]
使用限制
由于此工具通过抓取多引擎搜索结果来工作,请注意以下重要限制:
-
速率限制:
- 在短时间内进行过多搜索可能会导致所使用的引擎暂时阻止请求
- 建议:
- 保持合理的搜索频率
- 慎重使用限制参数
- 必要时在搜索之间添加延迟
-
结果准确性:
- 取决于相应引擎的HTML结构,当引擎更新时可能会失败
- 某些结果可能缺少描述等元数据
- 复杂的搜索操作符可能无法按预期工作
-
法律条款:
- 此工具仅限个人使用
- 请遵守相应引擎的服务条款
- 根据实际使用情况实施适当的速率限制
-
搜索引擎配置:
- 可以通过
DEFAULT_SEARCH_ENGINE环境变量设置默认搜索引擎 - 支持的引擎:bing, duckduckgo, exa, brave
- 当搜索特定网站时,默认引擎将被使用
- 可以通过
-
代理配置:
- 当某些搜索引擎在特定地区不可用时,可以配置HTTP代理
- 通过环境变量
USE_PROXY=true启用代理 - 通过
PROXY_URL配置代理服务器地址
贡献
欢迎提交问题报告和功能改进建议!
贡献者指南
如果您想分叉此仓库并发布自己的Docker镜像,需要进行以下配置:
GitHub Secrets 配置
为了启用自动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:latestyour-acr-address/your-image-name:latest(如果配置了 ACR)
分叉和发布步骤:
- 将仓库分叉到您的 GitHub 账户
- 配置密钥(如果您需要发布到 ACR):
- 进入设置 → 密钥和变量 → 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 镜像名称
Star History
如果您觉得这个项目有帮助,请考虑给它一个 ⭐ Star!