Skip to main content
Glama

wechat-mcp

Read WeChat Official Account articles directly in Claude Code / Cursor / Windsurf. One config line. Zero API keys. Works in every MCP-compatible client.

English · 中文


中文

这是什么?

wechat-mcp 是一个 Model Context Protocol (MCP) server,让任意 MCP 兼容的 AI 客户端(Claude Code、Claude Desktop、Cursor、Windsurf、Cline 等)直接读取微信公众号文章。

为什么需要它?微信公众号的 robots.txt 禁止了自动化访问,fetch_web、curl 默认情况下都拿不到 mp.weixin.qq.com 下的文章正文。wechat-mcp 绕过这个限制,把文章转成结构化 Markdown 直接喂给你的 AI。

✨ 5 秒演示

把下面这段贴进 Claude Code:

帮我总结一下这篇文章:https://mp.weixin.qq.com/s/xxxxxxxxxxxxx

Claude Code 自动调用 read_wechat_article 工具 → 返回标题、作者、正文 → 总结给你。

🚀 安装

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json(macOS) 或 %APPDATA%\Claude\claude_desktop_config.json(Windows):

{
  "mcpServers": {
    "wechat": {
      "command": "npx",
      "args": ["-y", "wechat-mcp"]
    }
  }
}

重启 Claude Desktop。搞定。

Cursor

~/.cursor/mcp.json:

{
  "mcpServers": {
    "wechat": {
      "command": "npx",
      "args": ["-y", "wechat-mcp"]
    }
  }
}

Claude Code (CLI)

~/.claude.json 或项目内 .claude/settings.json:

{
  "mcpServers": {
    "wechat": {
      "command": "npx",
      "args": ["-y", "wechat-mcp"]
    }
  }
}

🛠 工具

read_wechat_article

读取一篇微信文章并返回 Markdown。

输入:

  • url (string, 必填) — mp.weixin.qq.com 域名的微信文章 URL

  • include_images (boolean, 默认 true) — 是否包含内联图片

  • max_length (number, 默认 20000) — 返回内容的最大字符数

输出: 标题 / 作者 / 发布时间 / 封面图(可选)/ Markdown 正文

read_multiple_wechat_articles

批量读取最多 10 篇文章。

输入:

  • urls (string[], 必填, 1-10 项) — URL 列表

🔍 它怎么绕过 robots.txt?

微信公众号对 fetch/curl 默认 UA 返回降级 HTML,且 robots.txt 声明禁爬。wechat-mcp 通过模拟桌面 Chrome UA 直接发 HTTP 请求拿原始 HTML,再用两套解析器兜底:

  1. 标准路径:从 js_content div 提取正文 + 处理内嵌图片

  2. 新版文章路径:从 JS 变量 cgiDataNew.content_noencode 解码(处理 type 9 / 10002 文章)

两套都拿不到时返回结构化错误(404、需关注公众号、登录墙)。

💾 缓存

默认 30 分钟 TTL,进程内最多缓存 200 篇文章。同 URL 重复调用直接命中缓存,不会反复打微信服务器。

🧩 兼容性

  • Node.js ≥ 18

  • MCP SDK ≥ 1.0

  • Claude Code / Claude Desktop / Cursor / Windsurf / Cline / 任意 stdio MCP 客户端

🚧 边界与限制

  • 不支持需要登录/付费的会员文章

  • 不支持视频号内容(仅图文文章)

  • 不支持已被删除/违规下架的文章

  • 高频调用建议加你自己的节流层

🗺 路线图

  • 知乎文章 Provider(同样的"读不到"痛点)

  • CSDN / 掘金 Provider

  • 微信公众号 RSS 监控模式(定时拉取更新)

  • 多账号 cookie 池(突破登录墙)

🤝 贡献

欢迎 PR!思路:

  1. 新增 Provider:在 src/providers/ 下实现 fetch(url) => Markdown 接口

  2. 新增 MCP 工具:在 server.ts 注册 + 在 README 文档化

  3. 修复微信页面结构变化:跑一下 pnpm test,附上原文链接

📜 License

MIT © 2026 lfc1402046


Related MCP server: readgzh

English

wechat-mcp is a Model Context Protocol server that lets any MCP-compatible AI client (Claude Code, Claude Desktop, Cursor, Windsurf, Cline, …) read WeChat Official Account articles directly.

Why? WeChat's robots.txt blocks automated access, and fetch/curl cannot reach mp.weixin.qq.com by default. wechat-mcp bypasses this and returns the article as clean Markdown.

Install

Add this to your MCP client config:

{
  "mcpServers": {
    "wechat": {
      "command": "npx",
      "args": ["-y", "wechat-mcp"]
    }
  }
}

That's it. Restart the client and ask your AI to read any mp.weixin.qq.com URL.

Tools

  • read_wechat_article — read one article, return Markdown

  • read_multiple_wechat_articles — batch up to 10 URLs

License

MIT

Available Tools

2 tools
read_multiple_wechat_articlesA

Read up to 10 WeChat articles at once and return each as Markdown. Use when the user provides a batch of URLs (e.g. from a list they want summarized).

Inputs: urls (required).

read_wechat_articleA

Read a WeChat Official Account (mp.weixin.qq.com) article and return its title, author and Markdown body. Use this whenever the user shares a mp.weixin.qq.com URL or asks you to summarize/read a WeChat article. Returns up to 20,000 chars by default.

Inputs: url (required), max_length, include_images.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 2 tools

    Disambiguation5/5

    The tools are clearly differentiated based on the input scale: one handles a single item, and the other handles a list of items. There is no ambiguity for an agent deciding which function to call based on the user's request format.

    Naming Consistency5/5

    The naming convention is highly consistent, using the verb 'read' as the core action for both tools. The snake_case format and structural similarity make the set very easy to read and predict.

    Tool Count4/5

    With only two tools, the set is appropriately scoped for its singular focus on article consumption. While minimal, having separate tools for single versus batch operations is a sensible division for this specific domain.

    Completeness4/5

    The tools cover the core 'read' lifecycle for individual and group articles. However, the surface lacks upstream functionality like searching by keyword or listing all available articles, which would make the set more robust.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Read WeChat (微信) Official Account articles with native multimodal output — body, images, and video keyframes returned as MCP content blocks. Handles all three embed types: Tencent Video, WeChat-native, and Channels (视频号 metadata via public API).
      1
      13
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI to read full-text WeChat Official Account articles, returning title, author, publish time, and clean Markdown content.
      9
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables 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