md2wechat is a TypeScript CLI, Codex Skill, and MCP server for turning Markdown into WeChat Official Account HTML. It runs locally, uses deterministic conversion, and lets Codex or Claude handle any AI writing before calling the tool.
npm install -g @gangtiser/md2wechatNode.js 20 or newer is required. Initialize customer configuration before using WeChat account features:
md2wechat config initOpen the generated config file and fill in:
{
"WECHAT_APP_ID": "your_app_id",
"WECHAT_APP_SECRET": "your_app_secret"
}Environment variables can override the file:
export WECHAT_APP_ID="your_app_id"
export WECHAT_APP_SECRET="your_app_secret"- Runtime: Node.js 20+
- Markdown conversion: local deterministic renderer
- AI authoring/editing: use the host agent, such as Codex or Claude CLI
- No hosted md2wechat conversion service is used.
md2wechat inspect article.md --json
md2wechat config init --json
md2wechat config status --json
md2wechat themes list --json
md2wechat convert article.md --theme default --output article.html --json
md2wechat preview article.md --theme default --output preview.html --jsonTheme management:
md2wechat themes register custom ./themes/custom.json --json
md2wechat themes remove custom --jsonStart the stdio MCP server:
md2wechat mcpExample MCP client configuration:
{
"mcpServers": {
"md2wechat": {
"command": "md2wechat",
"args": ["mcp"],
"env": {
"WECHAT_APP_ID": "your_app_id",
"WECHAT_APP_SECRET": "your_app_secret"
}
}
}
}Available tools:
convert_articlepreview_articlelist_themesregister_themeremove_theme
WECHAT_APP_ID: optional environment override for the configured WeChat AppIDWECHAT_APP_SECRET: optional environment override for the configured WeChat AppSecretMD2WECHAT_CONFIG: optional path to the JSON config fileMD2WECHAT_THEME_REGISTRY: optional custom theme registry fileMD2WECHAT_THEMES_DIR: optional custom theme directory
Custom themes are JSON files:
{
"id": "custom",
"name": "Custom",
"description": "Optional description",
"prompt": "Style guidance for the renderer."
}npm install
npm run typecheck
npm test
npm run verifyGenerated build output lives in dist/ and is packaged for npm, but not committed to git.