wechat-mp-search
This server searches Sogou Weixin for WeChat public-account articles and retrieves article text, with no configuration required.
weixin_search: search a single page byquery; optionalpagedefaults to 1.weixin_search_all: automatically paginate and aggregate results byquery; optionalmax_pagesdefaults to 10 and cannot exceed the server hard limit.get_weixin_article_content: fetch plain text of a WeChat article fromreal_url; optionalreferer; failures return a获取文章内容失败:string instead of throwing.Search results include
title,link,real_url,publish_time, andpage; responses may includeblockedorerrorto distinguish anti-bot blocking, failures, and genuinely empty results.Includes built-in anti-scraping/rate-limit handling: cookie jar, request delays/jitter, retry with a fresh session, and a
maxPageshard cap.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@wechat-mp-search Search WeChat official account articles about artificial intelligence and show me the top results."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dsh-wechat-mp-search
deepseek-harness (dsh) 插件,同时提供同构的 MCP server 入口:零配置抓取搜狗微信搜索(weixin.sogou.com),用于检索微信公众号文章并抓取正文。
两种分发形态共享同一套核心逻辑(src/sogou.ts),工具名、参数与返回字段完全一致:
dsh 插件(
src/index.ts):进程内 Cordis 插件,随宿主 dsh 运行时加载;MCP server(
src/mcp-server.ts):标准 Model Context Protocol stdio server,供 Claude Code、Cursor、Codex 等任意 MCP 客户端使用。
工具
工具名 | 参数 | 说明 |
|
| 搜索单页结果,返回 |
|
| 按页翻页搜索,直到达到页数上限、空页、命中反爬拦截或某页出错; |
|
| 抓取文章正文纯文本;失败时返回 |
weixin_search/weixin_search_all 返回的每条结果字段:title、link(搜狗跳转链接)、real_url(还原后的微信公众号真实链接,解析失败为空串)、publish_time(取自该条结果所属的结果块,缺失为空串)、page。
Related MCP server: wechat-mp-mcp
反爬 / 限流策略
本插件进行了四项反爬增强,均可通过插件配置调整:
会话级 cookie jar:同一次搜索会话内(一次
weixin_search调用及其后续链接解析请求)共享并累积Set-Cookie,使后续请求携带前序请求获得的 cookie。cookie 只发给weixin.sogou.com,也只从该域采集。请求间限速抖动:链接解析之间使用
linkDelayMs+[0, linkDelayJitterMs)随机抖动延迟;weixin_search_all翻页之间使用pageDelayMs+[0, pageDelayJitterMs)随机抖动延迟。反爬重试:命中反爬验证(响应体或跳转后 URL 出现反爬特征),或返回
403/429/503这类拒绝/限流状态码时,重建一个全新会话(全新 cookie jar)重试一次;仍失败才判定为blocked: true。max_pages硬上限:weixin_search_all的max_pages参数无法突破插件配置项maxPages(默认 30)。
跳转由本插件手动跟随(上限 5 跳)而非交给 fetch 的 redirect: 'follow':跨域跳转目标因此拿不到会话 cookie,其下发的 Set-Cookie 也不会被收进 jar。这两点是代码里的显式约束,而不是依赖运行时的隐式行为——follow 只暴露最终响应的 Set-Cookie,而中间跳转响应上的会被丢弃;jar 又是扁平的 name→value、不区分 domain,混入第三方域的 cookie 后会被随后的搜狗域请求一起发回。
失败语义:blocked 与 error
两个字段分工明确,避免把失败伪装成“搜索无结果”:
blocked: true:搜狗在拦我们。命中反爬验证页,或返回403/429/503这类明确的拒绝/限流状态码,且重建会话重试一次后仍然失败。error(可选,存在即表示本次调用失败):传输层异常(超时、DNS、连接失败)或非预期状态码(如500)。此时results必为空数组。两者都没有且
results为空:搜索确实没有结果。
weixin_search_all 在任意一页出现 blocked 或 error 时停止翻页,并把该页的字段原样带出、保留已聚合的结果——中间页的失败不会被“聚合成功”掩盖。
配置项
配置项 | 默认值 | 说明 |
|
| 单次 HTTP 请求超时(毫秒)。 |
|
| 响应体最大字节数;流式读取达到上限即停止下载并按字符边界截断。 |
|
| 链接解析之间的最小延迟与随机抖动上限。 |
|
| 翻页之间的最小延迟与随机抖动上限。 |
|
| 命中反爬后重建会话重试前的最小延迟。 |
|
|
|
各数值配置项均有下界(如 requestTimeoutMs >= 1,延迟类 >= 0):dsh 形态下非法值会在插件加载时被校验拒绝;MCP 形态(不经过配置校验)会将非法值(负数、NaN 等)回退为默认值。
兼容性(dsh 版本)
peerDependencies 声明 @deepseek-ai/dsh-tools: "^0.1.1-rc.2 || ^0.2.0-rc.1",即同时支持 0.1.x 与 0.2.x 两条 API 线,加载时不会被 dsh 的兼容性护栏拦下。
本插件只用到 defineTool、InferValue、ValueSchemaSpec、ToolDefinition、ToolRunContext 这几个 API。dsh-tools 0.2 的改动(code-mode 模块重命名为 ptc、CallId 改名 ToolCallId、JsonValue 的导入源由 dsh-session 迁到 dsh-util-values)都不在本插件的使用面上,因此两条线可共用同一份代码。
dsh 的兼容性护栏(pluginCompatibilityWarning)只校验 @deepseek-ai/dsh / @deepseek-ai/dsh-* 命名的 peer,比较对象是 dsh 自身版本,且判定用 semver.satisfies(version, range, { includePrerelease: true })。两个要点:
caret 的范围不会跨 minor:
^0.1.1-rc.2不含 0.2.x,所以 dsh 升级到 0.2.0 后必须显式补上^0.2.0-rc.x,否则就会被拦下(这正是 0.1.0 遇到的问题);0.2.x 的下界取
rc.1而非rc.2:^0.2.0-rc.2会把仍在0.2.0-rc.1的运行时判成不兼容。
下界是实测出来的:0.1.1-rc.2、0.2.0-rc.1、0.2.0-rc.2 三个版本各自安装后,tsc -p tsconfig.test.json 与 vitest run(82 个用例)全部通过。升级 dsh 的 minor 线时,请同步更新 devDependencies 里的 @deepseek-ai/dsh-tools,让类型检查跟得上运行时。
安装
dsh 插件
# 本地路径安装
dsh plugin --profile <profile-name> add ${workspace}/dsh-wechat-mp-search
# 发布到 npm 后
dsh plugin --profile <profile-name> add dsh-wechat-mp-searchMCP server(任意 MCP 客户端)
本包的默认可执行入口即 MCP stdio server。
本地路径使用(无需发布到 npm):先用 npm install && npm run build 生成 lib/,然后在支持 MCP 的客户端中添加:
{
"mcpServers": {
"wechat-mp-search": {
"command": "node",
"args": ["${workspace}/dsh-wechat-mp-search/lib/mcp-server.js"]
}
}
}Claude Code 也可以一行命令添加:
claude mcp add wechat-mp-search -- node ${workspace}/dsh-wechat-mp-search/lib/mcp-server.js修改源码后重新 npm run build 即生效。频繁迭代可在项目目录执行 npm link,之后配置直接写 "command": "dsh-wechat-mp-search"。
发布到 npm 后:
{
"mcpServers": {
"wechat-mp-search": {
"command": "npx",
"args": ["-y", "dsh-wechat-mp-search"]
}
}
}或全局安装后直接使用命令:
npm install -g dsh-wechat-mp-search
# 客户端配置: { "command": "dsh-wechat-mp-search" }MCP 入口零配置运行,各反爬参数使用上文默认值;需要自定义时可在 dsh 形态下通过插件 config 调整。
开发
npm install
npm run build # tsc -p tsconfig.json(仅 src,产出 lib/)
npm run typecheck # tsc -p tsconfig.test.json(src + tests,含测试)
npm test # vitest run
typecheck特意覆盖tests/。构建用的tsconfig.json只include: ["src"](测试以../src/x.ts直接导入 TS 源码,需要allowImportingTsExtensions,与 emit 冲突), 而 vitest 只做转译不做类型检查——若不给测试单独配一份tsconfig.test.json, 测试文件里的类型错误无人把关,dsh-tools 之类的 peer API 变更就会静默溜进发布。
peerDependencies中的@deepseek-ai/cordis、@deepseek-ai/dsh-tools由宿主 dsh 运行时提供。 本仓库的.npmrc已将 registry 指向官方https://registry.npmjs.org/,因为这几个包 (含其自身的@deepseek-ai/dsh-llm、@deepseek-ai/dsh-session等传递 peer 依赖)已在公网 npm 发布对应版本,可直接npm install;若你的环境配置了指向其他镜像源的全局 registry, 请临时使用--registry=https://registry.npmjs.org/或本仓库自带的.npmrc。
免责声明
仅学习研究使用,请控制请求频率,遵守搜狗 / 微信与相关法规。目标站点接口变更可能导致解析逻辑失效
Available Tools
3 toolsget_weixin_article_contentA
抓取微信公众号文章正文纯文本。失败时返回以"获取文章内容失败:"开头的说明,而非报错。
Inputs: real_url (required), referer.
weixin_searchA
在搜狗微信搜索(weixin.sogou.com)中搜索微信公众号文章,返回单页结果。
Inputs: query (required), page.
weixin_search_allA
自动翻页搜索多页微信公众号文章并聚合结果,直到空页、命中反爬拦截或达到页数上限为止。
Inputs: query (required), max_pages.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
weixin_search and weixin_search_all both search Sogou WeChat articles, but their descriptions clearly distinguish single-page vs aggregated multi-page results. get_weixin_article_content is a separate retrieval step with no overlap.
The weixin_search and weixin_search_all names share a consistent prefix and action style, but get_weixin_article_content breaks the pattern by leading with get_ and placing article before content. The naming is still readable, just not uniformly structured.
Three tools is appropriately scoped for a focused WeChat article search-and-read server. Each tool has a distinct role: one-page search, multi-page search, and content retrieval.
For the stated purpose of searching WeChat public account articles and reading article text, the surface is complete. Search covers both quick single-page and full paginated needs, and content fetching provides the end-to-end workflow.
Maintenance
Related MCP Connectors
Search public LinkedIn posts by keyword, name or hashtag, with engagement, via a hosted MCP server.
Scrape, crawl and search the web for AI agents via MCP.
Web scraping, extraction and search for AI agents. Hosted MCP with workspace API keys.
Unified social scraper MCP — profiles, posts, videos across ~40 platforms via Streamable HTTP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables fetching, searching, and summarizing WeChat public account articles through browser automation. Supports multiple output formats and provides article metadata and statistics.-
- AlicenseAqualityCmaintenanceEnables crawling WeChat Official Account articles via the mp.weixin.qq.com search interface, including account search, article listing, incremental crawling, and fetching articles as Markdown with local SQLite storage.261MIT
- FlicenseNot gradedqualityDmaintenanceEnables searching for WeChat official account articles through the Sogou WeChat platform, returning structured article information.9-
- AlicenseNot gradedqualityBmaintenanceEnables fetching WeChat public account articles, caching them in SQLite, and reading them as paginated Markdown via MCP, with optional DeepSeek summarization and HTML/Markdown export.MIT