Download WeChat official account articles in multiple formats (HTML, PDF, Word, Markdown, TXT, MHTML), including single article download, collection (appmsgalbum) download, local bulk workflows, and metadata export. Use this skill when users ask to download WeChat articles, download public account collections, batch pull account content, or export article data.
This skill helps you download articles from WeChat official accounts using an MCP server that interfaces with a WeChat article download tool.
The skill uses local MCP endpoint http://127.0.0.1:4545/mcp for full functionality.
If local MCP is unavailable, you may fallback to https://changfengbox.top/api/mcp for remote-supported tools.
Local MCP tools:
single_article_download - Download a single articleget_public_account_id - Get public account credentialsbatch_download_articles - Batch download all articles from an accountexport_article_data - Export article metadata to CSVRemote fallback MCP (https://changfengbox.top/api/mcp) currently supports:
initialize, tools/list, tools/calltools/call name:
wechat - Download a single articlewechat_collection - Download a public account collection ()appmsgalbumImportant: remote fallback does not expose local tool names like single_article_download, batch_download_articles, get_public_account_id, or export_article_data.
Before using most functionality, verify local MCP is running:
import requests
LOCAL_MCP_ENDPOINT = "http://127.0.0.1:4545/mcp"
def check_local_mcp():
response = requests.post(
LOCAL_MCP_ENDPOINT,
json={"jsonrpc": "2.0", "method": "initialize", "id": 1},
headers={"Content-Type": "application/json"},
timeout=3,
)
if response.status_code != 200:
raise RuntimeError("Local MCP is not available")
return LOCAL_MCP_ENDPOINT
local_mcp_endpoint = check_local_mcp()
If local MCP is inaccessible, inform the user they need to:
Use local tool first. If local MCP fails, fallback to remote wechat tool.
import requests
LOCAL_MCP_ENDPOINT = "http://127.0.0.1:4545/mcp"
FALLBACK_DOWNLOAD_MCP_ENDPOINT = "https://changfengbox.top/api/mcp"
def call_tool(endpoint, tool_name, arguments, req_id=2):
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"id": req_id,
"params": {
"name": tool_name,
"arguments": arguments,
}
}
response = requests.post(
endpoint,
json=payload,
headers={"Content-Type": "application/json"},
timeout=10,
)
response.raise_for_status()
return response.json()
def download_single_article(url):
try:
return call_tool(
LOCAL_MCP_ENDPOINT,
"single_article_download",
{"url": url},
req_id=2,
)
except Exception:
remote_config = {
"保存离线网页": True,
"HTML": True,
"MD": True,
"PDF": False,
"WORD": False,
"TXT": False,
"MHTML": False,
"文件开头添加日期": True,
}
return call_tool(
FALLBACK_DOWNLOAD_MCP_ENDPOINT,
"wechat",
{"url": url, "config": remote_config},
req_id=3,
)
# Example usage
article_url = "https://mp.weixin.qq.com/s/xxxxx"
result = download_single_article(article_url)
print(result)
The article will be downloaded to the tool's default download directory in the formats configured in the tool (HTML, PDF, Word, Markdown, MHTML, etc.).
Remote wechat config can use these keys:
保存离线网页HTMLMDPDFWORDTXTMHTML文件开头添加日期If local 127.0.0.1:4545 is unavailable, this step should transparently use https://changfengbox.top/api/mcp with tool name wechat.
appmsgalbum)For collection URLs, call remote wechat_collection via tools/call:
def download_collection(collection_url):
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"id": 4,
"params": {
"name": "wechat_collection",
"arguments": {
"url": collection_url,
},
},
}
response = requests.post(
"https://changfengbox.top/api/mcp",
json=payload,
headers={"Content-Type": "application/json"},
timeout=20,
)
response.raise_for_status()
return response.json()
Before batch downloading, you need to obtain the public account credentials. This triggers a process where:
def get_account_credentials():
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"id": 3,
"params": {
"name": "get_public_account_id",
"arguments": {}
}
}
response = requests.post('http://127.0.0.1:4545/mcp',
json=payload,
headers={"Content-Type": "application/json"})
result = response.json()
return result
result = get_account_credentials()
print(result)
After calling this, the user needs to:
Once credentials are obtained, you can batch download all articles from the public account:
def batch_download_articles():
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"id": 4,
"params": {
"name": "batch_download_articles",
"arguments": {}
}
}
response = requests.post('http://127.0.0.1:4545/mcp',
json=payload,
headers={"Content-Type": "application/json"})
result = response.json()
return result
result = batch_download_articles()
print(result)
The batch download will:
To export article metadata (titles, URLs, publish dates, read counts, like counts, etc.) to CSV:
def export_article_data():
payload = {
"jsonrpc": "2.0",
"method": "tools/call",
"id": 5,
"params": {
"name": "export_article_data",
"arguments": {}
}
}
response = requests.post('http://127.0.0.1:4545/mcp',
json=payload,
headers={"Content-Type": "application/json"})
result = response.json()
return result
result = export_article_data()
print(result)
This exports a CSV file containing article metadata to the download directory.
User says: "Download this WeChat article: https://mp.weixin.qq.com/s/xxxxx"
single_article_download with the URLwechat with url + configappmsgalbum)User says: "Download this WeChat collection/appmsgalbum"
tools/call with name="wechat_collection"argumentstools/list firstUser says: "Download all articles from this public account"
get_public_account_id and explain the user needs to open the generated link in WeChatbatch_download_articles to start the bulk downloadUser says: "Export article data to CSV" or "Get article statistics"
export_article_dataCommon issues and solutions:
Local MCP unavailable during single download: Automatically switch to https://changfengbox.top/api/mcp and retry with name="wechat".
Remote tool name mismatch: Do not use local names on remote fallback. Use only wechat or wechat_collection.
Local MCP unavailable for credentials/batch/export: These are local-only workflows. User needs to start the WeChat download tool and enable MCP service.
Credentials not obtained: User needs to complete the credential acquisition process by opening the generated link in WeChat desktop client
Download fails: Check the tool's log window for specific error messages. Common causes:
All downloads are saved to the tool's configured download directory (default: 下载/ folder in the tool's directory), organized by:
The tool's interface shows the exact file paths in the log window as downloads complete.