xhs-image-mcp
Uses Google Gemini to generate AI-powered cover images for the image cards based on article content.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@xhs-image-mcp Convert this text into a warm 3:4 image card: '5 morning habits for success'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
XHS Image MCP
将文章/文本转换为小红书风格图片卡片的 MCP Server,支持 AI 生成封面图。
功能
智能分页 - 使用浏览器实际测量自动分页,确保内容不溢出
4种主题 - minimal / elegant / warm / dark
3种比例 - 3:4 (推荐) / 1:1 / 4:3
AI 封面 - 使用 Gemini 根据文章内容生成艺术封面(设置 API Key 后自动启用)
Markdown 支持 - 直接读取 .md 文件并自动清理格式
MCP 协议 - 可与 Claude Desktop / Claude Code 集成
Related MCP server: Xiaohongshu (RedBook) MCP Server
v1.1.0 更新
✨ 智能 AI 封面 - 设置
GEMINI_API_KEY后自动生成 AI 封面,无需手动开启🔧 自动分页优化 - 使用浏览器实际测量替代字数估算,彻底解决内容溢出问题
📐 AI 封面空间适配 - 第一页自动为 AI 封面横幅预留空间
小红书尺寸
比例 | 尺寸 | 说明 |
3:4 | 1080×1440px | 推荐,占据最大屏幕空间 |
1:1 | 1080×1080px | 方形,适合产品展示 |
4:3 | 1080×810px | 横版,适合风景照 |
安装
npm install -g xhs-image-mcp
npx playwright install chromium或从源码安装:
git clone https://github.com/dthinkr/xhs-image-mcp.git
cd xhs-image-mcp
npm install
npx playwright install chromium
npm run build使用
MCP Server 配置
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"xhs-image": {
"command": "npx",
"args": ["-y", "xhs-image-mcp"],
"env": {
"GEMINI_API_KEY": "your_api_key_here"
}
}
}
}Claude Code (~/.claude/settings.json):
{
"mcpServers": {
"xhs-image": {
"command": "npx",
"args": ["-y", "xhs-image-mcp"]
}
}
}测试
npm testMCP Tools
text_to_images
将文本转换为图片序列。
参数 | 类型 | 必填 | 说明 |
| string | Yes | 文本内容 |
| string | 标题(用于封面) | |
| string |
| |
| string |
| |
| string |
| |
| boolean | 是否生成封面页 | |
| boolean | 使用 AI 生成封面图(设置 API Key 后默认开启,传 | |
| string | 输出目录,图片保存为 PNG |
file_to_images
将 Markdown/文本文件转换为图片。
参数 | 类型 | 必填 | 说明 |
| string | Yes | 文件路径 (.md/.txt) |
| string | 覆盖自动提取的标题 | |
| string | 主题 | |
| boolean | AI 封面(设置 API Key 后默认开启,传 | |
| string | 输出目录 |
estimate_pages
估算页数(不生成图片)。
list_themes
列出所有可用主题。
主题
主题 | 风格 | 适用场景 |
| 白底黑字,简约 | 知识干货、教程 |
| 米白衬线,书卷气 | 小说、散文、诗歌 |
| 暖色渐变,卡片式 | 情感生活、分享 |
| 深色护眼 | 夜间阅读、科技 |
环境变量
变量 | 说明 |
| Google Gemini API Key,用于 AI 封面生成(设置后自动启用 AI 封面) |
获取 API Key: https://aistudio.google.com/app/apikey
License
MIT
Available Tools
4 toolsestimate_pagesA
Estimate how many pages the text will be split into without generating images
Inputs: text (required), ratio, fontSize, charsPerPage.
file_to_imagesA
Convert a local markdown or text file to a series of images. Supports .md, .txt, .text files. Automatically extracts title from the first # heading in markdown files. Cleans up markdown formatting for cleaner text display.
Inputs: filePath (required), ratio, theme, title, +5 more.
list_themesA
List all available themes with descriptions
Inputs: no named parameters.
text_to_imagesB
Convert text content to a series of images with Xiaohongshu (小红书) style themes.
Supported themes:
minimal: Clean white background, good for knowledge/tips content
elegant: Warm beige with serif font, good for novels/essays
warm: Warm gradient with card style, good for lifestyle/emotional content
dark: Dark mode, eye-friendly for night reading
Image ratios:
3:4 (1080x1440): Best for Xiaohongshu feed, takes most screen space
1:1 (1080x1080): Square format
4:3 (1080x810): Landscape format
Inputs: text (required), ratio, theme, title, +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: estimating page count, listing themes, converting text to images, and converting files to images. There is no overlap in functionality, making selection unambiguous.
Most tool names follow a descriptive pattern with underscores, but there is a mix of verb_noun (estimate_pages, list_themes) and noun_to_noun (text_to_images, file_to_images). This is a minor deviation from a fully consistent naming convention.
With just 4 tools, the set is well-scoped for its purpose. Each tool is essential and contributes to the workflow without redundancy or bloat.
The tool set covers the full conversion lifecycle: estimating output size, selecting themes, and converting from two input methods (text and file). No critical operations are missing for the stated purpose.
Maintenance
Related MCP Connectors
Turn any idea, URL, doc, or PDF into on-brand visuals: 100+ formats, native in 150+ languages
Markdown editor for notes, diagrams, drawing and painting with your AI, and a JPEG XL converter.
Markdown editor for notes, diagrams, drawing and painting with your AI, and a JPEG XL converter.
71Turn a URL, YouTube video or text into a branded LinkedIn/Instagram carousel PDF. No key needed.
Related MCP Servers
- AlicenseBqualityDmaintenanceConverts Markdown documents into beautifully styled knowledge cards with 18 different themes and generates them as HTML or image files (PNG/JPEG) in various sizes.314 npm5MIT
- AlicenseAqualityFmaintenanceEnables generation of Xiaohongshu (Little Red Book) social media content including intelligent outlines, AI-generated images, and multi-page posts through natural language commands.58 npm15MIT
- AlicenseBqualityDmaintenanceConverts Markdown content into beautifully designed knowledge cards with customizable styles and sizes. Also supports fetching and converting WeChat public account articles to Markdown.210 npm80MIT
- FlicenseNot gradedqualityDmaintenanceConverts Markdown documents into visually appealing image cards through the MCP protocol. Supports 19 theme styles and intelligent content splitting.8-