← Back to Plugins
Tools

CrossSearch MCP

Bryan-cmf By Bryan-cmf 👁 56 views ▲ 0 votes

🔍 Multi-engine cross-validated search plugin for OpenClaw — parallel query across Brave/Tavily/DuckDuckGo/Wikipedia/Bing/Mojeek with confidence scoring

GitHub

Install

npm install
openclaw

Configuration Example

{
  "mcpServers": {
    "cross-search": {
      "command": "node",
      "args": ["/path/to/CrossSearch-MCP/dist/mcp-server.js"],
      "env": {
        "BRAVE_API_KEY": "BSA...",
        "TAVILY_API_KEY": "tvly-..."
      }
    }
  }
}

README

# Cross Search

🔍 多引擎並行搜索 + 交叉驗證 — 同時調用多個搜索引擎,去重合併、標註置信度,追求絕對準確的事實。

支援**兩種模式**,覆蓋幾乎所有 AI 智能體:

| 模式 | 適用於 | 安裝方式 |
|------|--------|---------|
| **OpenClaw Plugin** | [OpenClaw](https://github.com/openclaw/openclaw) 用戶 | `openclaw plugins install` |
| **MCP Server** | Claude Desktop、Cursor、ZCode、任何 [MCP](https://modelcontextprotocol.io) client | `node dist/mcp-server.js` |

## ✨ 功能

同時調用 **Brave + Tavily + DuckDuckGo + Wikipedia + Bing + Mojeek**,`Promise.all` 並行發送、URL 去重合併、交叉驗證,每個結果標註來源引擎同意數同置信度。

## 🎯 置信度層級

| 層級 | 條件 | 說明 |
|------|------|------|
| 🟢 HIGH | ≥50% engines 同意 | 多引擎獨立驗證,極高可信度 |
| 🟡 MEDIUM | 2+ engines 同意 | 部分驗證,可靠 |
| 🔴 LOW | 單一 engine | 未經交叉驗證,需謹慎對待 |

---

## 📦 模式一:OpenClaw Plugin

適用於 OpenClaw 用戶。Agent 自動使用 `cross_search` 工具。

```bash
# 從 GitHub 安裝(推薦)
openclaw plugins install https://github.com/Bryan-cmf/CrossSearch-MCP

# 或 clone 後本地 link 安裝(適合開發)
git clone https://github.com/Bryan-cmf/CrossSearch-MCP.git
cd CrossSearch-MCP
npm install
openclaw plugins install --link .
```

## ⚙️ 配置

在 `~/.openclaw/openclaw.json` 加入:

```json5
{
  plugins: {
    entries: {
      "cross-search": {
        enabled: true,
        config: {
          braveApiKey: "BSA...",           // https://brave.com/search/api/
          tavilyApiKey: "tvly-...",         // https://tavily.com/
          bingApiKey: "xxx",                // optional
          defaultEngines: ["brave", "tavily", "ddg", "wikipedia"],
          maxResultsPerEngine: 10,
          timeoutMs: 10000
        }
      }
    }
  }
}
```

改完執行 `openclaw mcp reload`,再重啟 gateway 讓 plugin 生效。

---

## 📦 模式二:MCP Server(Claude Desktop / Cursor / ZCode / 任何 MCP client)

把 cross_search 作為 **MCP server** 運行,任何支援 Model Context Protocol 的智能體都能用。

### 安裝 + 建構

```bash
git clone https://github.com/Bryan-cmf/CrossSearch-MCP.git
cd CrossSearch-MCP
npm install
npm run build      # 產生 dist/mcp-server.js
```

### 配置 API Key(環境變數)

MCP server 從環境變數讀取 API key(冇 key 的引擎會自動跳過,免費引擎仍可運作):

```bash
export BRAVE_API_KEY="BSA..."          # https://brave.com/search/api/
export TAVILY_API_KEY="tvly-..."        # https://tavily.com/
export BING_API_KEY="xxx"               # 可選

# 可選調整
export CROSS_SEARCH_ENGINES="brave,tavily,ddg,wikipedia"   # 預設引擎
export CROSS_SEARCH_MAX_RESULTS="10"                       # 每引擎最大結果數
export CROSS_SEARCH_TIMEOUT_MS="10000"                     # 超時(ms)
```

> 💡 **冇任何 API key 也能用**:`ddg` + `wikipedia` + `mojeek` 三個免費引擎仍提供交叉驗證。

### 接入 MCP client

**Claude Desktop**(`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "cross-search": {
      "command": "node",
      "args": ["/path/to/CrossSearch-MCP/dist/mcp-server.js"],
      "env": {
        "BRAVE_API_KEY": "BSA...",
        "TAVILY_API_KEY": "tvly-..."
      }
    }
  }
}
```

**Cursor / 其他 MCP client**:同樣格式,指定 `node dist/mcp-server.js` + env。

**OpenClaw 自己也能用 MCP 模式**(`~/.openclaw/openclaw.json`):

```json
{
  "mcp": {
    "servers": {
      "cross-search": {
        "command": "node",
        "args": ["/path/to/CrossSearch-MCP/dist/mcp-server.js"],
        "env": { "BRAVE_API_KEY": "BSA...", "TAVILY_API_KEY": "tvly-..." }
      }
    }
  }
}
```

### 驗證

```bash
# 測試 server 能否啟動 + 列出工具
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | \
  BRAVE_API_KEY="BSA..." node dist/mcp-server.js
```

成功會回傳 `serverInfo: cross-search 0.1.0` 同 `cross_search` 工具定義。

### MCP 模式特色

- **同時返回文字 + JSON**:`content` 含可讀報告 + 結構化數據,畀 agent 自行揀用
- **自動引擎過濾**:缺 key 的付費引擎會被靜默跳過,唔會報錯
- **跨平台**:任何 OS、任何 MCP client,只要識行 `node`

---

## 🧰 可用引擎

| 引擎 | 需要 API Key | 免費額度 | 說明 |
|------|:---:|------|------|
| brave | ✅ | 2000/月 | Brave Search API(獨立索引+新聞+社群) |
| tavily | ✅ | 1000/月 | Tavily AI Search(結構化摘要) |
| ddg | ❌ | 無限 | DuckDuckGo(HTML 抓取) |
| wikipedia | ❌ | 無限 | Wikipedia REST API |
| bing | ✅ | 視計劃 | Bing Web Search API |
| mojeek | ❌ | 無限 | Mojeek(獨立索引) |

> 💡 即使冇任何 API key,`ddg` + `wikipedia` + `mojeek` 三個免費引擎仍可提供交叉驗證。

## 🚀 使用

裝好後,agent 會自動使用 `cross_search` 工具。你也可以明確指示:

- 「用 cross_search 查一下...」
- 「用交叉驗證搜索幫我查...」
- 「同時用多個引擎搜尋...」

工具會返回每條結果的來源引擎、同意數、置信度標記。

## 📋 配置項

| 項目 | 類型 | 預設 | 說明 |
|------|------|------|------|
| `braveApiKey` | string | — | Brave Search API Key |
| `tavilyApiKey` | string | — | Tavily API Key |
| `bingApiKey` | string | — | Bing Search API Key(可選) |
| `defaultEngines` | string[] | `["brave","tavily","ddg","wikipedia"]` | 預設啟用的引擎 |
| `maxResultsPerEngine` | number | 10 | 每個引擎返回最大結果數(1-20) |
| `timeoutMs` | number | 10000 | 每個引擎請求超時(3000-30000ms) |

## 🔧 開發

```bash
git clone https://github.com/Bryan-cmf/CrossSearch-MCP.git
cd CrossSearch-MCP
npm install
npm run build    # tsc → dist/
```

## 📄 License

MIT — 見 [LICENSE](./LICENSE)

tools

Comments

Sign in to leave a comment

Loading comments...