Skip to main content
Glama
fdslk

wechat-mp-mcp

by fdslk

wechat-mp-mcp

A Model Context Protocol (MCP) server for crawling WeChat Official Account articles via the mp.weixin.qq.com subscription-account search interface.

Works with any MCP-compatible client (Claude Code, Claude Desktop, Cline, Continue, Cursor, etc.).

What it does

Given a WeChat Official Account name, this server can:

  • search for the account and resolve its internal fakeid

  • pull the article list (full history on first crawl, incremental afterwards)

  • fetch a single article and convert its body to Markdown

  • store everything in a local SQLite database (deduped by URL)

Requirements

  • Python 3.10+

  • A personal WeChat subscription account (订阅号). You log in once via QR code at https://mp.weixin.qq.com/, then this server reuses your login session to call the public-account search interface.

Note: the subscription-account search interface has a daily quota (roughly ~200 calls/day per account). A first-time full crawl of a large public account may need to be spread across multiple days. Incremental crawls cost very few calls.

Install

cd ~/Documents/code/wechat-mp-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Step 1 — Log in (one-time, repeat when session expires)

wechat-mp-mcp-login

The script will:

  1. open https://mp.weixin.qq.com/ in your browser

  2. ask you to paste the dashboard URL after login (it extracts token from it)

  3. ask you to paste the Cookie: header value (copy from DevTools → Network)

Credentials are saved to ~/.config/wechat-mp-mcp/auth.json (chmod 600).

Sessions typically last 1–2 hours. When the server returns "session expired", just re-run wechat-mp-mcp-login.

Step 2 — Run the MCP server

wechat-mp-mcp

It speaks MCP over stdio. You won't normally run it by hand — your MCP client launches it.

Step 3 — Wire it into an MCP client

Generic config (works for Claude Desktop, Cline, Continue, etc.):

{
  "mcpServers": {
    "wechat-mp": {
      "command": "/Users/YOUR_USER/Documents/code/wechat-mp-mcp/.venv/bin/wechat-mp-mcp"
    }
  }
}

For Claude Code (CLI):

claude mcp add wechat-mp /Users/YOUR_USER/Documents/code/wechat-mp-mcp/.venv/bin/wechat-mp-mcp

Tools exposed

Tool

Purpose

search_account(query, limit=5)

Resolve account name → fakeid

list_articles_page(fakeid, begin=0, count=5)

Pull one page of metadata; use for full-history crawl

crawl_incremental(fakeid, max_pages=10, page_size=5, delay_seconds=1.5)

Pull only articles newer than what is stored

fetch_article(url, save=True)

Fetch + parse one article body to Markdown

list_stored_articles(fakeid, limit=20, offset=0, with_body=False)

Query the local store

Typical workflow

  1. Find the account: ask the LLM "search WeChat account 'XX'". It calls search_account → you confirm the right fakeid.

  2. First-time full crawl: ask "crawl all history". The LLM walks list_articles_page with begin=0, 5, 10, ... until empty. Stop and resume any time — pagination state lives in the DB.

  3. Daily incremental: schedule a prompt "pull new posts from 'XX'" — the LLM calls crawl_incremental (cheap, a few API calls).

  4. Read a post: "fetch and summarize <mp.weixin.qq.com/s/...>" — the LLM calls fetch_article.

Storage

SQLite at ~/.config/wechat-mp-mcp/wechat.db by default. Override with WECHAT_MP_MCP_DB=/path/to/file.db.

Schema: account(fakeid PK, nickname, ...), article(link PK, fakeid, title, update_time, body_markdown, ...). Inspect with any SQLite client.

Caveats

  • The subscription-account search interface is undocumented. The Weixin team can change it at any time; expect to re-tune the request shape occasionally.

  • Read counts / likes / "看一看" are not available through this path. Those require intercepting the WeChat App's traffic (out of scope).

  • Be polite: keep delay_seconds ≥ 1.0 between requests, or you'll get rate-limited for 24 hours.

A
license - permissive license
-
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

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/fdslk/WECHAT-MP-MCP'

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