Skip to main content
Glama
MDZZ-123

web-search-mcp

by MDZZ-123

web-search-mcp

对外提供 HTTP 的 web_search 服务:把搜索请求转发给支持服务端搜索的 LLM API 网关 (如 fengwind 的 -search 后缀模型),返回带来源引用的答案。多供应商自动兜底。

零依赖 Node.js(18+,自带 fetch),Docker 镜像无需 npm install,跨平台 (amd64 / arm64)。

为什么有这个东西

参照 fengwind 网关实测结论:

  • 普通模型不支持服务端搜索;-search 后缀模型(如 deepseek-v4-flash-search)可用, chat 与 responses 两种格式均返回实时结果 + [n](url) 来源引用。

  • 中文请求体必须 ASCII 转义(\uXXXX)发送,直接发中文会随机乱码或 HTTP 000 断连 (本服务已对所有供应商统一处理,见 src/ascii.js)。

  • 同一家网关可能波动,多供应商按优先级兜底更稳。

Related MCP server: evo-scry

快速开始(Docker)

cp .env.example .env    # 填入你的 key / 网关
docker compose up -d --build
curl http://localhost:3000/health

配置(JSON 环境变量)

环境变量

说明

WEBSEARCH_CONFIG

JSON 对象:{ "port", "timeoutMs", "providers": [...] }

WEBSEARCH_PROVIDERS

JSON 数组,与 CONFIG 的 providers 合并

WEBSEARCH_TIMEOUT_MS

可选,单次请求超时(毫秒),默认 90000

PORT

可选,监听端口,默认 3000

单个 provider:

{
  "name": "fengwind",
  "baseURL": "https://api.fengwind.com",
  "apiKey": "sk-...",
  "model": ["deepseek-v4-flash-search", "deepseek-v4-pro-search"],
  "format": "chat",
  "timeoutMs": 120000,
  "priority": 0
}

字段

必填

说明

name

标识,/search 可用它定向

baseURL

API 网关地址(兼容别名 gateway

apiKey

密钥

model

模型名,字符串或数组(同网关多模型依次尝试)

format

chat(默认,/v1/chat/completions)或 responses/v1/responses + tools:[{type:"web_search"}]

priority

数字越小越优先;缺省按数组顺序

配置项非法不会导致启动失败:坏条目被跳过并打印告警,可通过 /healthproviderCount 核对。全部为空时 /search 返回 503。

HTTP API

POST /mcp(MCP Streamable HTTP 端点)

符合 MCP 协议(JSON-RPC 2.0,2025-03-26),供 Reasonix / Claude Desktop 等 MCP 客户端直接接入:

方法

说明

initialize

握手,返回 Mcp-Session-Id

tools/list

暴露 web_search 工具(query 必填,provider 可选)

tools/call

执行搜索,返回答案文本 + 来源引用列表

Reasonix 配置(config.toml.mcp.json):

[[plugins]]
name = "web-search"
type = "http"
url  = "https://box6-cu.15546991.xyz:14443/web_search/mcp"
# call_timeout_seconds = 180   # 搜索可能耗时较长,建议放宽

本实现只支持非流式 POST 响应(GET /mcp 返回 405)。

POST /search

curl -s http://localhost:3000/search \
  -H 'Content-Type: application/json' \
  -d '{"query":"今天有什么重大新闻?"}'
{
  "ok": true,
  "query": "今天有什么重大新闻?",
  "answer": "……实时内容(带 [1](url) 引用)……",
  "sources": ["https://news.cn/..."],
  "provider": "fengwind",
  "model": "deepseek-v4-flash-search",
  "format": "chat",
  "latencyMs": 8421
}

可选字段 provider:指定只用某一家({"query":"...","provider":"fengwind"}),用于单独验证。

全部供应商失败时返回 502errors 列表(每家失败原因),方便排查。

⚠️ Windows 下 curl 命令行直接写中文会按本地代码页(GBK)编码,导致请求体损坏 (实测会变成乱码)。请用 UTF-8 文件发送:curl -d @request.json,或使用 Node/Python 等客户端(它们默认 UTF-8)。

GET /health

运行状态、供应商列表、超时配置。Docker HEALTHCHECK 使用此端点。

GET /providers

已配置供应商(key 脱敏为 sk-81b7...e785)。

本地运行(不用 Docker)

WEBSEARCH_CONFIG='{"providers":[...]}' node src/server.js
npm test   # 冒烟测试:假网关验证双格式 / ASCII 转义 / 兜底

目录结构

src/ascii.js     中文 → \uXXXX ASCII 转义(fengwind 实测坑)
src/providers.js JSON 环境变量解析、校验、排序、脱敏
src/search.js    双格式调用、引用提取、多供应商兜底
src/server.js    HTTP 服务与入口
test/smoke.mjs   冒烟测试(本地假网关,不发真实请求)
F
license - not found
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    MCP server for internet search via direct Google and DuckDuckGo HTML scraping with AI-powered result normalization and optional summarization, requiring no API keys for search.
    Last updated
    MIT
  • F
    license
    -
    quality
    C
    maintenance
    A remote MCP server that routes web search queries across multiple providers (HTTP APIs, external MCP servers, LLM with grounding) with intelligent fallback and quota management.
    Last updated

View all related MCP servers

Related MCP Connectors

  • MCP server for Google search results via SERP API

  • Multi-engine search for AI agents. Trust scoring, local corpus, MCP-native. Self-hostable, BYOK.

  • MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MDZZ-123/web-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server