xhs-image-mcp
Uses Google Gemini to generate AI-powered cover images for the image cards based on article content.
Click on "Install 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-mcpConvert 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: Little Red Book Card MCP
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
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text content to estimate | |
| ratio | No | 3:4 | |
| fontSize | No | medium | |
| charsPerPage | No | Custom characters per page |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does disclose the key behavior that no images are generated, which is a significant trait distinguishing it from siblings. However, it does not mention any side effects, permissions, or what the function returns, leaving some behavioral aspects undisclosed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence front-loaded with the purpose: 'Estimate how many pages the text will be split into'. Every word earns its place, with no extraneous details or repetition of schema information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity, the description is largely complete for a single-purpose estimation tool. It clarifies the non-generation aspect and works with sibling names to frame its role. However, it lacks any mention of output format or edge cases, which would be more critical for a complex tool, but for this basic estimator it is sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 50% description coverage. The required 'text' parameter and 'charsPerPage' have descriptions, while 'ratio' and 'fontSize' lack descriptions but have enums and defaults that provide self-documenting semantics. The tool description itself adds no parameter-specific information, so it neither compensates nor detracts from the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Estimate how many pages the text will be split into'. It specifies the verb (estimate) and resource (pages from text), and explicitly distinguishes from sibling tools by adding 'without generating images', which sets it apart from text_to_images and file_to_images.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by stating 'without generating images', suggesting it is a non-rendering alternative to image generation tools. However, it does not explicitly state when to use it versus alternatives, nor does it provide exclusions or prerequisites. The guidance remains implicit rather than direct.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| ratio | No | Image aspect ratio | 3:4 |
| theme | No | Visual theme for the images | minimal |
| title | No | Override the auto-extracted title | |
| filePath | Yes | Absolute path to the markdown or text file | |
| fontSize | No | Font size for content | medium |
| outputDir | No | Directory path to save generated images. If provided, images will be saved as PNG files. | |
| showCover | No | Whether to generate a cover page (defaults to true for files) | |
| charsPerPage | No | Custom characters per page | |
| generateAiCover | No | Generate AI cover image using Gemini. Defaults to true if GEMINI_API_KEY is set. Set to false to disable. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the safety and behavior disclosure burden. It discloses input file types, markdown cleanup, and title extraction, but omits important runtime behavior such as what happens when outputDir is not provided (e.g., whether images are returned inline) and the potential side effect of writing PNG files. The mention of AI cover generation is absent, leaving a significant behavioral gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences long, starts with the core purpose, and every sentence adds value. There is no redundancy or filler, making it highly scannable for an AI agent.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has 9 parameters, no output schema, and no annotations, so the description should clarify the output contract. It fails to explain whether the function returns image data, file paths, or requires outputDir for persistence. While the schema covers parameter semantics, the overall usage contract is incomplete for an agent to confidently invoke the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds meaningful context to parameters: 'Automatically extracts title from the first # heading in markdown files' clarifies the default behavior of the title parameter, and 'Cleans up markdown formatting for cleaner text display' explains the conversion process. This goes beyond pure schema descriptions and raises the score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource ('Convert a local markdown or text file to a series of images') and clearly distinguishes this file-based tool from the sibling text_to_images by emphasizing local file input and supported extensions (.md, .txt, .text). This makes the tool's scope and differentiation immediately evident.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context (file input, markdown handling) but does not explicitly say when to choose this over alternatives like text_to_images or list_themes. It mentions auto-extraction of title from headings, which hints at markdown-centric usage, but offers no exclusions or when-not-to-use guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_themesA
List all available themes with descriptions
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral burden. It conveys that this is a read-only listing operation and that the result includes descriptions. It does not mention pagination, sorting, or potential volume, but for a simple list tool, this is sufficient transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that is front-loaded with the action and object. Every word adds value; there is no fluff or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a zero-parameter, no-output-schema tool. The description fully explains what the tool does and what output to expect (themes with descriptions). Given its simplicity, no additional context is required.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so the baseline is 4. The description adds no parameter-level details, but none are needed since the schema already covers everything (100% schema description coverage, no parameters).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the specific verb 'List' with the resource 'themes' and specifies the content ('with descriptions'), clearly distinguishing it from sibling tools that deal with pages or images. It unambiguously states the tool's purpose and scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance is given about when to use this tool versus alternatives. The usage is implied: an agent would call it to discover available themes. However, there are no exclusions or alternative tool mentions, so it lacks clear usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text content to convert to images | |
| ratio | No | Image aspect ratio | 3:4 |
| theme | No | Visual theme for the images | minimal |
| title | No | Optional title for cover page | |
| fontSize | No | Font size for content | medium |
| outputDir | No | Directory path to save generated images. If provided, images will be saved as PNG files. | |
| showCover | No | Whether to generate a cover page | |
| charsPerPage | No | Custom characters per page (overrides automatic calculation) | |
| generateAiCover | No | Generate AI cover image using Gemini. Defaults to true if GEMINI_API_KEY is set. Set to false to disable. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description must disclose behavioral traits. It only enumerates themes and ratios, but fails to mention return format, side effects (e.g., file creation via outputDir), authentication needs (e.g., Gemini API key for generateAiCover), or output structure. The description adds no behavioral context beyond the schema's parameter descriptions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured: a one-sentence purpose immediately followed by clean bullet lists for themes and ratios. Every item earns its place by explaining the options. However, it omits important behavioral details, but that is a completeness issue, not a conciseness one. It is front-loaded and easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 9 parameters, no annotations, and no output schema, the description bears significant responsibility. It covers only two parameters (theme and ratio) and ignores the rest, including outputDir behavior, AI cover generation, font size, and the relationship between text length and pagination. Missing usage guidance and return format makes it incomplete for a tool of this complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description enriches the enum parameters 'theme' and 'ratio' with human-readable explanations and usage recommendations (e.g., 'minimal: Clean white background, good for knowledge/tips content'), which adds semantic value beyond the bare schema. Other parameters like outputDir and generateAiCover are not mentioned, but their schema descriptions are sufficient.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Convert text content to a series of images with Xiaohongshu style themes.' It uses a specific verb+resource construction that distinguishes it from typical image tools. However, it does not explicitly differentiate from sibling tools like file_to_images or estimate_pages, so it stops short of a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus the sibling tools (e.g., file_to_images, estimate_pages). The description provides context for theme/ratio selection but lacks any 'when to use' or 'when not to use' direction, leaving the agent to infer usage from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Turn any idea, URL, doc, or PDF into on-brand visuals: 100+ formats, native in 150+ languages
Xiaohongshu, Douyin, YouTube, TikTok and X links as LLM-ready text
Clean, repair, and convert AI-generated Markdown to HTML/PDF/DOCX/PNG; save and share documents.
The document publishing layer for AI tools. Convert markdown to 6 destinations, 62 templates.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables users to take screenshots, extract text using OCR, and automatically generate trending Xiaohongshu-style social media posts. Combines image processing with AI-powered content generation to create engaging posts with hashtags and titles.1
- 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.3183MIT
- AlicenseAqualityFmaintenanceEnables generation of Xiaohongshu (Little Red Book) social media content including intelligent outlines, AI-generated images, and multi-page posts through natural language commands.51915MIT
- AlicenseBqualityDmaintenanceConverts Markdown content into beautifully designed knowledge cards with customizable styles and sizes. Also supports fetching and converting WeChat public account articles to Markdown.22080MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dthinkr/xhs-image-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server