Skip to main content
Glama
datoushiwo

wechat-writer-mcp

by datoushiwo

wechat-writer-mcp

面向技术博主的 AI 内容加工流水线 MCP —— 从原始素材到公众号草稿箱,只存草稿,不自动发布

⚡ 快速开始

一键启动

npx wechat-writer-mcp

MCP 配置

{
  "mcpServers": {
    "wechat-writer": {
      "command": "npx",
      "args": ["wechat-writer-mcp"],
      "env": {
        "WECHAT_APP_ID": "your_app_id",
        "WECHAT_APP_SECRET": "your_app_secret"
      }
    }
  }
}

立即体验

AI指令: "导入 ./my-article.md,帮我排版成公众号格式,检查原创度后存入草稿箱"

Related MCP server: Wenyan MCP Server

🛠️ 核心功能

  • 4 个专业工具 - 导入素材、智能排版、原创检测、存入草稿箱

  • 官方 API - 基于微信公众号草稿箱 API,完全合规

  • 内容加工 - 段落切分、代码块处理、超链接转脚注、头尾模板、标题候选

  • 安全第一 - 永远只存草稿箱,永远不自动群发/发布

  • 即插即用 - 支持 Claude Code、Cursor、Claude Desktop

📦 工具列表

工具

说明

输入

输出

import_source

导入原始内容

本地 markdown 文件或网页 URL

raw_markdown + 标题/字数等元数据

transform_for_wechat

公众号智能排版

markdown 内容

适配 HTML + 3 个标题候选 + 摘要建议

estimate_originality

原创度自评

文章内容

原创度评分 + 与历史草稿的相似段落

save_to_wechat_draft

存入草稿箱

标题 + HTML 内容

media_id + 后台链接

💡 使用流程

用户: 导入 ./my-article.md
AI:   [调 import_source] 已读入 838 字 markdown
      标题识别:《我用 Claude Code 三周做了一个 MCP Server》

用户: 帮我按公众号风格排版
AI:   [调 transform_for_wechat]
      - 代码块已处理为公众号可显示格式
      - 已应用头尾模板
      - 3 个标题候选:
        1. 我用 Claude Code 三周做了一个 MCP Server
        2. 我用 Claude Code 三周做了一个 MCP Server:完整实践指南
        3. 一文读懂我用 Claude Code 三周做了一个 MCP Server
      要哪个?

用户: 用 1,检查下原创度
AI:   [调 estimate_originality]
      深度原创(92/100)
      建议:可以标记"原创"
      历史比对:无重复内容

用户: OK 存草稿箱
AI:   [调 save_to_wechat_draft]
      ✅ 已存入公众号草稿箱
      → 请前往 mp.weixin.qq.com → 内容管理 → 草稿箱 手动发送

⚙️ 安装配置

方式一:npx 直接运行(推荐)

npx wechat-writer-mcp

方式二:本地安装

git clone https://github.com/datoushiwo/wechat-writer-mcp.git
cd wechat-writer-mcp
npm install
npm run build

环境变量

cp .env.example .env

变量

必填

说明

WECHAT_APP_ID

公众号 AppID

WECHAT_APP_SECRET

公众号 AppSecret

WECHAT_COVERS_DIR

封面图片目录,默认 ~/Pictures/wechat-covers

WECHAT_DEFAULT_AUTHOR

默认作者名

WECHAT_API_TIMEOUT

API 超时毫秒数,默认 15000

前置条件

  1. 公众号 AppID/AppSecret:mp.weixin.qq.com → 开发 → 基本配置

  2. IP 白名单:将你的出口 IP 添加到公众号后台 → 开发 → 基本配置 → IP 白名单

客户端配置

~/.claude/mcp.json 或项目下 .claude/mcp.json 中添加:

{
  "mcpServers": {
    "wechat-writer": {
      "command": "npx",
      "args": ["wechat-writer-mcp"],
      "env": {
        "WECHAT_APP_ID": "your_app_id",
        "WECHAT_APP_SECRET": "your_app_secret"
      }
    }
  }
}

在 Cursor Settings → MCP 中添加,配置同上。

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "wechat-writer": {
      "command": "npx",
      "args": ["wechat-writer-mcp"],
      "env": {
        "WECHAT_APP_ID": "your_app_id",
        "WECHAT_APP_SECRET": "your_app_secret"
      }
    }
  }
}

⚠️ 注意事项

  • 安全:AppSecret 永远不要提交到 Git,.env 已在 .gitignore

  • 权限:只调用 draft/add,永远不调用 freepublish/submitmass/send

  • 查重estimate_originality 只与你自己的历史草稿比对,不能替代微信官方查重

  • 封面:默认从 ~/Pictures/wechat-covers/ 随机选取,无封面时自动生成占位图

  • 模板:可自定义 templates/wechat-header.htmltemplates/wechat-footer.html

🗺️ Roadmap

  • v0.1 - MVP:4 个核心 tool + 公众号草稿箱 API

  • 自定义排版主题

  • 封面图片 AI 推荐

  • 掘金同步发布(v2)

  • 发布后数据反馈

  • 多标题 A/B 建议

🤝 贡献

欢迎提 Issue 和 PR。

git clone https://github.com/datoushiwo/wechat-writer-mcp.git
cd wechat-writer-mcp
npm install
npm run dev  # 开发模式

📄 License

MIT


让 AI 帮你搞定公众号排版,你只管写内容。 ✍️

Available Tools

4 tools
estimate_originalityA

对内容做原创度自评,辅助决策是否点"原创"标记。基于用户自己的历史草稿做比对,不能替代微信官方查重。

ParametersJSON Schema
NameRequiredDescriptionDefault
contentYes待检查的文章内容(markdown 或纯文本)
check_against_historyNo是否与草稿箱历史内容比对

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully explain behavior. It discloses that the tool compares against the user's own draft history and is not official. However, it does not mention whether the tool is read-only, any required permissions, rate limits, or what happens if history is empty. This leaves some behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: two sentences in Chinese that capture purpose, scope, and limitation. No redundant information. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has few parameters and no output schema. The description explains what it does and its limitations but omits details about the return format (e.g., score, label) and how the result can be used. Given the simplicity, it is minimally adequate but not rich.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with both parameters described. The description adds no new semantic information beyond the schema; it only restates concepts already present (e.g., comparing against history). Therefore, the standard baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The tool name 'estimate_originality' is self-explanatory, and the description clearly states it assesses originality of content to assist in deciding whether to mark as 'original'. It distinguishes from official WeChat check and implies a scope limited to user's own drafts, which differentiates it from sibling tools like import_source or save_to_wechat_draft.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context: this is a self-assessment for marking content as original, based on user's draft history. It explicitly warns that it cannot replace WeChat's official plagiarism check, giving a clear limitation. However, it does not directly compare with alternative tools among siblings, though siblings perform different functions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

import_sourceA

导入原始内容(本地 markdown 文件或 URL 网页),准备进行公众号加工。返回 raw_markdown 和元数据。

ParametersJSON Schema
NameRequiredDescriptionDefault
urlNo网页 URL(source_type=url 时必填)
pathNo本地文件路径(source_type=file 时必填)
source_typeYes来源类型:file 读取本地文件,url 抓取网页正文

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses the return value (raw_markdown and metadata) but fails to mention any side effects, permissions, or error conditions (e.g., what happens if URL is unreachable or file not found). This is insufficient for a clear behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, comprising two short sentences. The first sentence states the purpose and input, the second defines the output. No unnecessary words, and key information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (3 parameters, no nested objects) and lack of an output schema, the description adequately covers input and output. It mentions both local files and URLs, and specifies the return type. Minor gap: no guidance on mutual exclusivity of parameters (url/path) beyond the schema's 'required' field.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with all parameters documented in the input schema. The description merely restates the source types without adding new meaning or constraints, matching the baseline score per the rubric.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the verb 'import' and resource 'original content (local markdown file or URL webpage)', distinguishing it from sibling tools (estimate_originality, transform_for_wechat, save_to_wechat_draft) which handle estimation, transformation, or saving.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for preparing content for WeChat public account processing, which indirectly suggests when to use it (before transformation/saving). However, it does not explicitly state when not to use it or mention alternatives among siblings, providing only minimal guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

save_to_wechat_draftA

将加工好的内容存入公众号草稿箱。永远只存草稿,不会自动群发/发布。存入后需手动到公众号后台发布。

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYes文章标题
authorNo作者名(默认使用环境变量配置)
digestNo摘要(不超过 120 字)
cover_pathNo封面图片路径(cover_strategy=specified 时使用)
html_contentYes文章 HTML 正文(transform_for_wechat 的输出)
cover_strategyNo封面策略:random_from_folder 从目录随机选、specified 指定路径、none 不设封面random_from_folder
need_open_commentNo是否打开评论
content_source_urlNo原文链接(可选)
only_fans_can_commentNo是否仅粉丝可评论

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, description clearly states the tool only saves as draft and never auto-publishes, which is critical for agent decisions. No mention of side effects or failure modes, but core behavior is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, no redundancy. Efficiently conveys purpose, constraint, and post-action step.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, description adequately covers key behaviors for a 9-parameter tool. Could mention expected success feedback or error handling, but sufficient for core usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with all parameters described. The description adds value by linking html_content to transform_for_wechat output, providing workflow context beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Explicitly states it saves processed content to WeChat draft box, distinguishing from siblings (estimate_originality, import_source, transform_for_wechat) which handle earlier stages. Emphasizes it only creates drafts, not auto-publish.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Indicates when to use (after processing) and what not to expect (no auto-publish). Could be more explicit about prerequisites or when not to use, but context with siblings implies it's the final step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

transform_for_wechatA

将 markdown 内容转换为公众号适配的 HTML 格式。自动段落切分、代码块处理、超链接转脚注、添加头尾模板,并生成 3 个标题候选。

ParametersJSON Schema
NameRequiredDescriptionDefault
titleNo文章原标题(用于生成标题候选)
raw_markdownYes原始 markdown 内容
apply_templateNo是否应用头尾模板

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It lists key automatic processes (paragraph splitting, code handling, etc.) but omits details like whether the transformation is reversible, what happens with unsupported markdown, or error handling. Adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single-sentence description packs multiple features efficiently. While it could be broken into bullet points for clarity, it is front-loaded with the primary action and free of fluff. Minor deduction for dense structure that might be harder to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (multiple automatic steps) and no output schema, the description covers core behaviors well. It mentions title candidates, templates, and specific markdown conversions. Lacks details on edge cases (e.g., images, tables) but sufficient for general use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so description adds value beyond field names. It explains that 'title' influences title candidates and 'apply_template' controls header/footer templates. This contextualizes the parameters' roles in the transformation, justifying a score above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool converts markdown to WeChat-optimized HTML, listing specific transformations (paragraph splitting, code blocks, hyperlinks to footnotes, templates, title candidates). This distinguishes it from siblings that likely handle different stages like importing or saving.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings like 'import_source' or 'save_to_wechat_draft'. The description does not specify prerequisites, exclusions, or alternative tools, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 4 tool updatesv0.1.0
    • First observedestimate_originality
    • First observedimport_source
    • First observedsave_to_wechat_draft
    • First observedtransform_for_wechat

TDQS

A4.1/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct purpose: importing source content, transforming it for WeChat, checking originality, and saving as draft. No functional overlap exists.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern (estimate_originality, import_source, transform_for_wechat, save_to_wechat_draft).

Tool Count5/5

Four tools cover the end-to-end workflow of preparing a WeChat article without superfluous or missing pieces, appropriate for the focused domain.

Completeness4/5

The set covers the core cycle of import, transform, originality check, and save. Minor gaps like listing/editing existing drafts are absent but not critical for the primary use case.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers