Skip to main content
Glama
Quqing-future

mcp-bing-search

mcp-bing-search

一个本地 MCP 服务器,用于网页搜索,可在中国境内使用,且无需任何 API 密钥。

  • 主要引擎:Bing(cn.bing.com)

  • 针对最新中文热门话题的自动回退:Qihoo 360 → Sogou

  • 将搜索引擎的重定向链接解析为真实 URL

它是为了替代公共 searxng 实例(例如 baresearch.org)而构建的,这些实例在中国大陆无法访问,并且对中文长尾查询无法返回结果。

并非微软官方 mcp-server-bing-search(该服务需要 API 密钥)——这是一个无需密钥、面向中国的替代方案。

为什么会存在这个问题

问题

本项目的解决方案

公共 searxng 实例在中国大陆无法访问

直接请求 cn.bing.com,该地址无需代理即可访问

无 API 密钥 / 无付费

爬取搜索结果页面(HTML 解析),无需密钥

Bing 对中国校区/热门话题的索引不佳

fallback 会自动使用 360 / Sogou 重试

Baidu 会通过验证码阻止自动请求

目标明确不使用 Baidu

Related MCP server: Heventure Search MCP

功能

  • web_search(query, max_results, fallback) — 优先使用 Bing;如果结果不相关(常见于非常新的中文话题),会自动尝试 360 → Sogou 进行重试。

  • cn_search(query, max_results) — 直接搜索中文引擎(360 → Sogou)。

  • 重定向链接解析 — 360/Sogou 的加密跳转链接(so.com/link?m=...)会被解析为最终真实地址(支持 HTTP 重定向和 JS 重定向)。

  • 自包含的单文件;仅依赖 mcp、httpx、lxml。

安装

方法 A:pip(推荐)

pip install mcp-bing-search

方法 B:从源码安装

git clone https://github.com/Quqing-future/mcp-bing-search.git
cd mcp-bing-search
pip install .
# or run directly without installing:
python mcp_bing_search.py

使用 Reasonix 配置

添加到全局 config.toml(所有项目)或项目上的 reasonix.toml:

[[plugins]]
name    = "bing-search"
command = "python"                      # or the absolute path to python.exe
args    = ["-m", "mcp_bing_search"]     # if installed via pip
# args = ["/path/to/mcp_bing_search.py"] # if running from source

或者使用标准的 .mcp.json:

{
  "mcpServers": {
    "bing-search": {
      "command": "python",
      "args": ["-m", "mcp_bing_search"]
    }
  }
}

更改会在下一个会话中生效。工具会显示为 mcp__bing-search__web_search 和 mcp__bing-search__cn_search。

与其他 MCP 客户端配置

任何 MCP 客户端都可以使用 — Claude Desktop、Cursor、VS Code 等。将其指向:

python -m mcp_bing_search
# or
python /path/to/mcp_bing_search.py

工具

web_search(query: str, max_results: int = 8, fallback: bool = True) -> str

搜索网页。优先使用 Bing;如果启用了 fallback,并且 Bing 没有返回相关结果(没有包含查询词的标题/URL),则使用 360,然后使用 Sogou 重试。

cn_search(query: str, max_results: int = 8) -> str

直接搜索中文引擎(360 → Sogou)。用于最新的中文热门话题、校园/微博新闻,或者任何 Bing 都无法很好地索引的内容。

工作原理

MCP client (Reasonix / Claude Desktop / ...)
   ↕  stdio + JSON-RPC
mcp_bing_search.py  (MCP server)
   ↕  HTTPS (plain HTTP GET, browser User-Agent)
cn.bing.com  →  www.so.com  →  www.sogou.com
  1. 请求 — httpx 使用桌面浏览器 User-Agent 发送 GET 请求到 https://cn.bing.com/search?q=...。

  2. 解析 — lxml XPath 从 li.b_algo 节点中提取 title / url / snippet。

  3. 相关性检查 — 如果没有任何题/URL 包含查询词(例如 "kubectl", "部署教程"),则结果集会被视为不相关。

  4. 回退 — 当 Bing 结果为空或不相关时,尝试 360 → Sogou,并使用第一个有相关结果的引擎。

  5. 链接清理 — 将重定向链接(so.com/link?m=..., /link?url=...)解析为它们的真实地址(支持 HTTP 重定向和 JS 重定向)。

已知限制

  • 抓取内容依赖搜索引擎的 HTML 结构;重新设计可能会导致解析失效。

  • 没有 key = 没有服务等级协议;频繁访问可能会被限流。

  • Bing 对最新中文社交媒体话题的覆盖较弱 — 在这些情况下使用 fallback 或 cn_search。

  • 有意不使用 Baidu:它对自动请求的验证码限制非常严格。

  • ToS 免责声明:本项目通过理解公共搜索结果页面的内容工作。它仅供个人/教育使用,并不不声称符合 Bing、Qihoo 360 或 Sogou 的服务条款。抓取内容可能违反这些条款;自动访问可能会被限流或阻止。请自行承担风险,并考虑在生产环境中使用官方搜索 API。

许可证

MIT © Quqing-future

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables web search without API keys using DuckDuckGo and Bing search engines, and retrieves webpage content. Supports multiple search engines simultaneously with privacy protection and asynchronous processing.
    2
    63 PyPI
    10
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables web search using Bing and DuckDuckGo combined, and fetching readable content from web pages, with no API key required.
    9 npm
    2
    MIT