Skip to main content

MCP service for WeChat Official Account (微信公众号) content retrieval

Project description

wechatmp-mcp

wechatmp-mcp 是一个面向 MCP 客户端使用者的微信公众号 MCP Server。它通过微信公众号后台接口,提供扫码登录、搜索公众号、获取文章列表、读取文章正文、批量抓取多账号近期文章等能力。

你可以把它接入支持 MCP 的客户端,例如 Claude Code、Cline、MCP Inspector,或任何兼容 stdio 的 MCP 工具。

它能做什么

  • 获取微信公众号后台登录二维码,扫码完成登录,自动保存登录态到本地
  • 登录态保存在 ~/.wechat-mcp/,重启后无需重新登录
  • 按关键词搜索公众号,获取 fakeid、昵称、简介等信息
  • 获取指定公众号的文章列表(标题、链接、摘要、封面、发布时间)
  • 读取指定文章 URL 的正文,以 Markdown 格式返回
  • 批量获取多个公众号的近期文章摘要

当前项目实际注册了 7 个 MCP tools

环境要求

  • Python 3.10 或更高版本
  • 能访问微信公众号网页(mp.weixin.qq.com)

通过 uvx 使用(推荐)

无需手动安装,uvx 会自动处理。

Claude Code 配置

claude mcp add wechat -- uvx wechatmp-mcp

快速调试

npx @modelcontextprotocol/inspector uvx wechatmp-mcp

⚠️ 注意: 请务必先使用 get_login_qrcode + check_login_status 完成登录后再使用其他工具!

MCP 客户端配置

Claude Code

claude mcp add wechat -- uvx wechatmp-mcp

Cline / JSON 配置

{
  "mcpServers": {
    "wechatmp-mcp": {
      "command": "uvx",
      "args": ["wechatmp-mcp"]
    }
  }
}

Tools 一览

账号登录

  • get_login_qrcode:获取微信公众号后台登录二维码,图片保存到本地,返回文件路径
  • check_login_status:检查登录状态;若用户已扫码则完成登录并保存 auth,否则验证已保存 auth 是否有效
  • logout:清除本地保存的 auth(token + cookies),退出登录

公众号搜索

  • search_account:按关键词搜索公众号,返回 fakeid、nickname、alias、intro、avatar

文章获取

  • get_account_articles:获取指定公众号的文章列表(按发布时间倒序),支持按 fakeid 或公众号名称查询,支持翻页
  • get_article_content:传入文章 URL,返回清洗后的 Markdown 正文
  • batch_get_articles:传入公众号名称列表,批量获取近期文章摘要

发布新版本到 PyPI

修改代码后,更新 src/wechat_mcp/__init__.py 中的版本号,然后:

# 安装构建工具(首次需要)
pip install hatch twine -i https://pypi.org/simple/

# 构建
hatch build

# 上传到 PyPI
# Username: __token__
# Password: 在 https://pypi.org/manage/account/ 的 API tokens 中创建
python -m twine upload dist/*

# 验证上传成功
uvx wechatmp-mcp==<新版本号> --help

注意:上传后 PyPI 同步约需 1-2 分钟,验证前稍等片刻。

使用建议

  • 使用其他工具前,请先通过 get_login_qrcode 获取二维码并扫码,再调用 check_login_status 完成登录
  • 登录态保存在 ~/.wechat-mcp/,重启服务后无需重新登录
  • get_account_articles 需要先通过 search_account 获取公众号的 fakeid

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wechatmp_mcp-0.0.2.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wechatmp_mcp-0.0.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file wechatmp_mcp-0.0.2.tar.gz.

File metadata

  • Download URL: wechatmp_mcp-0.0.2.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wechatmp_mcp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d0e597fff69316312a7389bbfaba3d0f52c749d99777bf52538f185826d8d884
MD5 91d92aeb5b56b79ced611530ee405bbe
BLAKE2b-256 4d502c3a6fa544810a61c26f98e7854efc76927d06f599d31520097b11442035

See more details on using hashes here.

File details

Details for the file wechatmp_mcp-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wechatmp_mcp-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wechatmp_mcp-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf6d581c5ac3fb776049164c2ed81800afa839a9c30f9739952d3e24e69af3c6
MD5 287261073e7bd075bc18a10920d07f1a
BLAKE2b-256 885b96a31495a1bc10ba90ebc4712e43992da28732d2c02b8b9b55d80f733dca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page