npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@liyutianbigpower/wechat-official-account-mcp

v0.0.6

Published

微信公众号 MCP 服务器 - 支持 Markdown 文章推送到草稿箱,自动处理图片上传

Readme

微信公众号 MCP 服务器 / WeChat Official Account MCP Server

npm version License: MIT

一个基于 Model Context Protocol (MCP) 的微信公众号内容管理工具,支持将 Markdown 文章一键推送到微信公众号草稿箱,自动处理图片上传和样式转换。

A Model Context Protocol (MCP) based tool for managing WeChat Official Account content. Push Markdown articles to draft box with automatic image upload and style conversion.


作者 / Author

  • 作者: 李玉田 (Li Yutian)
  • 邮箱: [email protected]
  • 项目: 微信公众号文章管理 MCP

功能特性 / Features

  • Markdown 转微信 HTML - 将 Markdown 格式转换为微信公众号兼容的 HTML 样式

  • 自动图片上传 - 自动处理本地和网络图片,上传到微信素材库

  • 草稿箱管理 - 支持创建、获取、删除草稿

  • 代码高亮 - 使用 highlight.js 进行语法高亮

  • 专业样式 - 内置精美的文章样式模板

  • 环境变量配置 - 支持通过环境变量或配置文件进行配置

  • Markdown to WeChat HTML - Convert Markdown to WeChat-compatible HTML

  • Automatic Image Upload - Handle local and network images automatically

  • Draft Management - Create, get, and delete drafts

  • Code Highlighting - Syntax highlighting with highlight.js

  • Professional Styling - Built-in beautiful article templates

  • Flexible Configuration - Environment variables or config file support


安装 / Installation

npm install -g @liyutianbigpower/wechat-official-account-mcp

或通过源码构建 / Or build from source:

git clone https://github.com/liyutianbigpower/wechat-official-account-mcp.git
cd wechat-official-account-mcp
npm install
npm run build

配置 / Configuration

方式 1:环境变量(推荐) / Method 1: Environment Variables (Recommended)

export WECHAT_APP_ID=your-app-id
export WECHAT_APP_SECRET=your-app-secret
export WECHAT_DEFAULT_AUTHOR=作者名  # Optional
export WECHAT_NEED_OPEN_COMMENT=true  # Optional
export WECHAT_ONLY_FANS_CAN_COMMENT=false  # Optional

方式 2:配置文件 / Method 2: Config File

在项目根目录创建 wechat-config.jsonconfig.json

Create wechat-config.json or config.json in project root:

{
  "wechat": {
    "appId": "your-app-id",
    "appSecret": "your-app-secret",
    "defaultAuthor": "作者名",
    "needOpenComment": true,
    "onlyFansCanComment": false
  }
}

MCP 工具列表 / MCP Tools

| 工具 / Tool | 描述 / Description | |-------------|-------------------| | push-markdown-file-to-draft | 从文件推送 Markdown 文章到草稿箱 / Push Markdown file to draft box | | push-text-to-draft | 推送文本内容到草稿箱 / Push text content to draft box | | markdown-to-html | Markdown 转 HTML(含图片处理) / Convert Markdown to HTML with image processing | | get-draft-list | 获取草稿列表 / Get draft list | | get-draft-detail | 获取草稿详情 / Get draft details | | delete-draft | 删除指定草稿 / Delete a specific draft | | delete-all-drafts | 批量删除所有草稿 / Delete all drafts | | upload-image | 上传图片到素材库 / Upload image to media library | | test-connection | 测试 API 连接 / Test API connection |


使用示例 / Usage Examples

在 Claude 等 MCP 客户端中使用 / Use with Claude or other MCP clients

在 MCP 配置文件中添加:

Add to your MCP configuration file:

{
  "mcpServers": {
    "wechat": {
      "command": "node",
      "args": ["/path/to/wechat-official-account-mcp/build/index.js"],
      "env": {
        "WECHAT_APP_ID": "your-app-id",
        "WECHAT_APP_SECRET": "your-app-secret"
      }
    }
  }
}

调用示例 / Tool Call Examples

推送 Markdown 文件到草稿箱 / Push Markdown file to draft:

push-markdown-file-to-draft(
  filePath: "/path/to/article.md",
  title: "文章标题",
  digest: "文章摘要",
  sourceUrl: "https://example.com/original"
)

直接推送文本内容 / Push text content directly:

push-text-to-draft(
  content: "# 标题\n\n正文内容...",
  title: "文章标题",
  isMarkdown: true
)

获取草稿列表 / Get draft list:

get-draft-list(count: 20, offset: 0)

样式预览 / Style Preview

转换器支持以下样式元素:

The converter supports the following style elements:

  • 标题 (H1) - 居中,红色 (#DC143C), 24px
  • 二级标题 (H2) - 左侧边框,蓝色 (#0000CD), 22px
  • 三级标题 (H3) - 蓝色 (#0000CD), 20px
  • 段落 - 16px, 行高 1.75
  • 引用块 - 灰色背景,左侧红色边框
  • 代码块 - 语法高亮,浅灰背景
  • 列表 - 转换为带序号的段落(微信兼容)
  • 表格 - 完整边框样式
  • 图片 - 圆角,阴影,居中显示

开发 / Development

# 构建 / Build
npm run build

# 运行 / Run
npm start

# 开发模式 / Development mode
npm run dev

依赖 / Dependencies

  • @modelcontextprotocol/sdk - MCP 协议支持
  • marked - Markdown 解析
  • highlight.js - 代码高亮
  • sanitize-html - HTML 清理
  • cheerio - HTML 处理
  • sharp - 图片处理
  • axios - HTTP 请求
  • form-data - 表单数据

许可证 / License

MIT License


集成到 OpenClaw / Integration with OpenClaw

你可以通过 McPorter 将此 MCP 服务器集成到 OpenClaw,实现通过 AI 助手管理微信公众号。

You can integrate this MCP server with OpenClaw via McPorter to manage WeChat Official Account through AI assistant.

前置要求 / Prerequisites

  • 已安装 Node.js 和 npm
  • 已安装 OpenClaw
  • 已安装 McPorter

步骤 1:安装 MCP 和 McPorter / Step 1: Install MCP and McPorter

npm install -g @liyutianbigpower/wechat-official-account-mcp@latest
npm install -g mcporter

步骤 2:配置 MCP 服务 / Step 2: Configure MCP Server

mcporter config add wechat-official-account-mcp `
  --command "npx" `
  --arg "@liyutianbigpower/wechat-official-account-mcp@latest" `
  --env "WECHAT_APP_ID=wx 你的 APPID" `
  --env "WECHAT_APP_SECRET=你的密钥" `
  --env "WECHAT_DEFAULT_AUTHOR=作者名" `
  --env "WECHAT_NEED_OPEN_COMMENT=true" `
  --env "WECHAT_ONLY_FANS_CAN_COMMENT=true"
mcporter config add wechat-official-account-mcp \
  --command "npx" \
  --arg "@liyutianbigpower/wechat-official-account-mcp@latest" \
  --env "WECHAT_APP_ID=wx 你的 APPID" \
  --env "WECHAT_APP_SECRET=你的密钥" \
  --env "WECHAT_DEFAULT_AUTHOR=作者名" \
  --env "WECHAT_NEED_OPEN_COMMENT=true" \
  --env "WECHAT_ONLY_FANS_CAN_COMMENT=true"

注意:请将 wx 你的 APPID你的密钥 替换为你自己的公众号凭据。 Note: Replace wx 你的 APPID and 你的密钥 with your actual WeChat Official Account credentials.

步骤 3:集成到 OpenClaw / Step 3: Integrate with OpenClaw

# 1. 启用 mcporter / Enable mcporter
openclaw config set skills.entries.mcporter.enabled true

# 2. 设置 mcporter.json 配置文件路径 / Set mcporter.json config path
openclaw config set skills.entries.mcporter.env.MCPORTER_CONFIG "/path/to/mcporter.json"

配置说明 / Config Notes:

  • Windows 路径示例:C:\Users\YourName\.mcporter\mcporter.json
  • macOS/Linux 路径示例:~/.mcporter/mcporter.json

步骤 4:验证配置 / Step 4: Verify Configuration

# 查看 OpenClaw 中的 mcporter 配置 / Check mcporter config in OpenClaw
openclaw config get skills.entries.mcporter

# 查看 McPorter 中已配置的 MCP 服务器 / List configured MCP servers in McPorter
mcporter config list

# 查看微信公众号 MCP 配置详情 / Check WeChat MCP config details
mcporter config get wechat-official-account-mcp --json

配置完成后重启 OpenClaw:

Restart OpenClaw after configuration:

openclaw gateway restart

许可证 / License

MIT License


问题反馈 / Issues

如有问题请提交到 GitHub Issues

Please report issues at GitHub Issues