网页搜索抓取服务器

一个集成了多搜索引擎的网络搜索、本地浏览器搜索和内容抓取功能的MCP服务器实现。

作者 By yokingma
本地部署 网页搜索 内容抓取
GitHub

🚀 OneSearch MCP服务器:网络搜索、抓取、抓取和内容准备

一种模型上下文协议(MCP)服务器实现,与多个搜索提供商集成,用于网络搜索、本地浏览器搜索和代理浏览器的抓取功能。

特性

  • 网络搜索、抓取、抓取和预处理网站内容。

  • 支持多个搜索引擎和网页抓取器: SearXNG, 塔维利, DuckDuckGo, 必应, 谷歌, Zhipu (智谱), 艾克萨, **Bocha (博查)**等等。

  • 本地网络搜索 (浏览器搜索),支持多个搜索引擎: 必应, 谷歌, 百度, 搜狗等等。

  • 使用 agent-browser 用于浏览器自动化。

  • 免费,不需要API密钥。

  • 启用的工具: one_search, one_scrape, one_map, one_extract

从v1.1.0及更早版本迁移

v1.1.0中的重大更改:

  • Firecrawl已删除:Firecrawl集成已被删除,取而代之的是 agent-browser,提供了类似的功能,而不需要外部API服务。
  • 新浏览器要求:您必须安装Chromium浏览器(请参阅先决条件部分)。
  • 环境变量: FIRECRAWL_API_URLFIRECRAWL_API_KEY 不再使用。

发生了什么变化:

  • one_scrapeone_map 现在使用 agent-browser 而不是Firecrawl
  • one_extract 现在预处理多URL页面内容以进行下游分析,而不是执行内置的LLM提取
  • 所有基于浏览器的操作现在都在本地处理,提供了更好的隐私,并且不需要API成本

迁移步骤:

  1. 安装Chromium浏览器(请参阅先决条件)
  2. 移除 FIRECRAWL_API_URLFIRECRAWL_API_KEY 根据您的环境变量
  3. 更新到最新版本: npm install -g one-search-mcp@latest

先决条件

浏览器要求:此服务器使用 agent-browser 用于网络抓取和本地搜索,这需要基于Chromium的浏览器。

好消息:服务器将自动检测并使用您系统上已安装的浏览器:

  • ✅ 谷歌浏览器
  • ✅ 微软边缘
  • ✅ 铬
  • ✅ 谷歌Chrome Canary

如果你没有安装这些浏览器,您可以:

BASH``` 1 2 3 4 5 6 7 8# Option 1: Install Google Chrome (Recommended)

Download from: https://www.google.com/chrome/

Option 2: Install Microsoft Edge

Download from: https://www.microsoft.com/edge

Option 3: Install Chromium via agent-browser

npx agent-browser install

Option 4: Install Chromium directly

Download from: https://www.chromium.org/getting-involved/download-chromium/


## 安装


### 使用Claude Code命令行界面(推荐)


BASH```
1
2
3
4
5
6# Add to Claude Code with default settings (local search)
claude mcp add one-search-mcp -- npx -y one-search-mcp
# Add with custom search provider (e.g., SearXNG)
claude mcp add one-search-mcp -e SEARCH_PROVIDER=searxng -e SEARCH_API_URL=http://127.0.0.1:8080 -- npx -y one-search-mcp
# Add with Tavily API
claude mcp add one-search-mcp -e SEARCH_PROVIDER=tavily -e SEARCH_API_KEY=your_api_key -- npx -y one-search-mcp

手动安装

BASH``` 1 2 3 4# Install globally (Optional) npm install -g one-search-mcp

Or run directly with npx

npx -y one-search-mcp


### 使用Docker


Docker镜像包括预安装的所有依赖项(Chromium浏览器),不需要额外的设置。


**拉取图像:**


BASH```
1
2
3
4# From GitHub Container Registry
docker pull ghcr.io/yokingma/one-search-mcp:latest
# Or from Docker Hub
docker pull zacma/one-search-mcp:latest

使用Claude Desktop进行配置:

JSON``` 1 2 3 4 5 6 7 8 9 10 11{ “mcpServers”: { “one-search-mcp”: { “command”: “docker”, “args”: [“run”, “-i”, “—rm”, “ghcr.io/yokingma/one-search-mcp:latest”], “env”: { “SEARCH_PROVIDER”: “local” } } } }


**使用自定义搜索提供程序:**


JSON```
1
2
3
4
5
6
7
8
9
10
11
12
13{
  "mcpServers": {
    "one-search-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "SEARCH_PROVIDER=tavily",
        "-e", "SEARCH_API_KEY=your_api_key",
        "ghcr.io/yokingma/one-search-mcp:latest"
      ]
    }
  }
}

环境变量

搜索引擎:

  • 搜索_提供者 (可选):要使用的搜索提供程序,支持 searxng, duckduckgo, bing, tavily, google, zhipu, exa, bocha, local,默认值为 local.
  • 搜索_API_URL (可选):SearxNG API的URL,或的Google自定义搜索引擎ID google.
  • 搜索_API_KEY (可选):搜索提供程序的API密钥,对于 tavily, bing, google, zhipu, exa, bocha.

TS``` 1 2// supported search providers export type SearchProvider = ‘searxng’ | ‘duckduckgo’ | ‘bing’ | ‘tavily’ | ‘google’ | ‘zhipu’ | ‘exa’ | ‘bocha’ | ‘local’;


### 搜索提供程序配置


| 提供程序 | 需要API密钥 | 需要API URL | 注释 |
| --- | --- | --- | --- |
| `local` | 否 | 否 | 免费,使用浏览器自动化 |
| `duckduckgo` | 否 | 否 | 免费,不需要API密钥 |
| `searxng` | 可选 | 是 | 自托管元搜索引擎 |
| `bing` | 是 | 否 | [必应搜索API](https://learn.microsoft.com/en-us/previous-versions/bing/search-apis/bing-web-search/create-bing-search-service-resource) |
| `tavily` | 是 | 否 | [美味API](https://tavily.com/) |
| `google` | 是 | 是(搜索引擎ID) | [谷歌自定义搜索](https://developers.google.com/custom-search/v1/overview) |
| `zhipu` | 是 | 否 | [智谱 AI](https://bigmodel.cn/dev/api/search-tool/web-search) |
| `exa` | 是 | 否 | [Exa AI](https://exa.ai/) |
| `bocha` | 是 | 否 | [博查 AI](https://open.bochaai.com/) |


## 其他MCP客户端的配置


### 克劳德桌面版


添加到您的Claude Desktop配置文件中:


**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**视窗**: `%APPDATA%\Claude\claude_desktop_config.json`


JSON```
1
2
3
4
5
6
7
8
9
10
11{
  "mcpServers": {
    "one-search-mcp": {
      "command": "npx",
      "args": ["-y", "one-search-mcp"],
      "env": {
        "SEARCH_PROVIDER": "local"
      }
    }
  }
}

光标

添加到您的 mcp.json 文件:

JSON``` 1 2 3 4 5 6 7 8 9 10 11{ “mcpServers”: { “one-search-mcp”: { “command”: “npx”, “args”: [“-y”, “one-search-mcp”], “env”: { “SEARCH_PROVIDER”: “local” } } } }


### 帆板运动


添加到您的 `./codeium/windsurf/model_config.json` 文件:


JSON```
1
2
3
4
5
6
7
8
9
10
11{
  "mcpServers": {
    "one-search-mcp": {
      "command": "npx",
      "args": ["-y", "one-search-mcp"],
      "env": {
        "SEARCH_PROVIDER": "local"
      }
    }
  }
}

自托管SearXNG(可选)

如果你想使用SearXNG作为你的搜索提供商,你可以使用Docker在本地部署它:

先决条件:

  • Docker已安装并正在运行(20.10.0或更高版本)
  • 至少4GB可用RAM

快速入门:

BASH``` 1 2 3 4 5# Clone SearXNG Docker repository git clone https://github.com/searxng/searxng-docker.git cd searxng-docker

Start SearXNG

docker compose up -d


部署后,SearXNG将在 `http://127.0.0.1:8080` 默认情况下。


**配置OneSearch以使用SearXNG:**


BASH```
1
2
3# Set environment variables
export SEARCH_PROVIDER=searxng
export SEARCH_API_URL=http://127.0.0.1:8080

有关更多详细信息,请参阅 SearXNG Docker官方文档.

故障排除

浏览器未找到错误

如果您看到“未找到浏览器”之类的错误,则服务器无法检测到任何已安装的基于Chromium的浏览器。请安装以下之一:

或通过代理浏览器安装:

BASH``` 1npx agent-browser install


## 许可证


MIT许可证-请参阅 许可证 文件以获取详细信息。