Skip to main content
Glama
xwchris

@emit/xhs-cover-mcp-server

by xwchris

@emit/xhs-cover-mcp-server


简介

这是一个 Model Context Protocol (MCP) 服务器,让 Claude、Cursor、Windsurf 等 AI 工具能够直接生成小红书风格的封面图片。

一句话概括: 告诉 AI 你想要什么文案,它帮你生成一张精美的封面图。

Related MCP server: rednote-analyzer-mcp

安装

方式一:npm 全局安装

npm install -g @emit/xhs-cover-mcp-server

方式二:npx 直接运行

无需安装,直接使用:

npx @emit/xhs-cover-mcp-server

方式三:使用 OpenClaw Skill

如果你是 OpenClaw 用户,可以直接安装我们的 Skill:

# 在 OpenClaw 中安装
clawhub install xhs-cover

详见 xhs-cover-skill

快速开始

1. 获取 API Key

使用前需要获取 API Key:

  1. 访问 xhscover.cn 注册账号

  2. 在控制台获取你的 API Key

  3. 新用户赠送 10 credits(可免费生成 10 张封面)

2. 配置 MCP 客户端

Claude Desktop

编辑 Claude Desktop 配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

添加配置:

{
  "mcpServers": {
    "xiaohongshu-cover": {
      "command": "npx",
      "args": ["-y", "@emit/xhs-cover-mcp-server"],
      "env": {
        "XHS_COVER_API_URL": "https://xhs-cover-api.xwchris.workers.dev",
        "XHS_COVER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Cursor

在项目根目录创建 .cursor/mcp.json

{
  "mcpServers": {
    "xiaohongshu-cover": {
      "command": "npx",
      "args": ["-y", "@emit/xhs-cover-mcp-server"],
      "env": {
        "XHS_COVER_API_URL": "https://xhs-cover-api.xwchris.workers.dev",
        "XHS_COVER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Windsurf

编辑 Windsurf 配置文件:

  • macOS: ~/Library/Application Support/Windsurf/windsurf_config.json

  • Windows: %APPDATA%\Windsurf\windsurf_config.json

配置同 Claude Desktop。

3. 开始使用

重启你的 AI 工具后,直接对话即可:

你:帮我生成一张小红书封面,文案是"5个习惯让你越来越自律"

Claude:我来帮你生成这张封面...
✅ 封面生成成功!

图片 URL: https://...
消耗 credit: 1

工具说明

这个 MCP Server 提供三个工具:

xhs_generate_cover - 生成封面

生成小红书风格的封面图片。

参数:

参数

类型

必填

说明

text

string

封面文案内容

aspectRatio

string

宽高比,默认 3:4

支持的宽高比:

  • 3:4 — 小红书标准竖版(推荐)

  • 9:16 — 竖版故事/Reels

  • 1:1 — 正方形

  • 4:3 — 横版

  • 16:9 — 宽屏

  • 2:3 — 竖版

  • 4:5 / 5:4 — 其他比例

示例:

生成一张封面:文案"今日份好心情",比例 1:1

xhs_get_credits - 查询余额

查看当前账户的 credit 余额和使用情况。

参数:

示例:

帮我查一下封面生成的 credit 余额

xhs_get_history - 查看历史

获取最近的封面生成记录。

参数:

参数

类型

必填

说明

limit

number

返回记录数,默认 10

示例:

帮我看看最近生成了哪些封面

配置

环境变量

变量名

必填

说明

XHS_COVER_API_URL

API 服务地址

XHS_COVER_API_KEY

你的 API Key

提示: 也支持 XHS_API_URLXHS_API_KEY 作为别名。

本地开发

如果你想在本地运行 API 服务,可以参考 xhs-cover-skill 中的说明。

常见问题

Q: 生成的图片文字不清晰怎么办?

AI 图片生成的文字渲染有时不稳定,建议:

  1. 尝试重新生成

  2. 缩短文案长度

  3. 使用更常见的字体风格

Q: 支持自定义风格吗?

当前版本统一使用小红书清新风格。后续版本会支持:

  • 风格模板选择

  • 参考图片上传

  • 批量生成

Q: Credits 会过期吗?

不会!购买的 Credits 永久有效,用完为止。

Q: 如何获取更多 Credits?

访问 xhscover.cn 控制台进行充值,支持多种套餐:

套餐

Credits

价格

单价

体验包

100

¥6

¥0.06/张

基础包

500

¥28

¥0.056/张

标准包

1000

¥48

¥0.048/张

大礼包

2000

¥88

¥0.044/张

Q: 支持哪些 AI 工具?

理论上支持所有 MCP 协议的工具,已测试:

  • ✅ Claude Desktop

  • ✅ Cursor

  • ✅ Windsurf

  • ✅ Continue

  • ✅ OpenClaw

Q: 可以在代码中直接调用吗?

可以!使用我们的 REST API 或客户端 SDK:

# REST API
curl -X POST https://xhs-cover-api.xwchris.workers.dev/api/v1/generate \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"text": "你的文案"}'

详见 xhs-cover-skill 文档。

技术细节

系统要求

  • Node.js >= 18.0.0

  • npm 或 npx

依赖

  • @modelcontextprotocol/sdk — MCP 协议实现

  • @supabase/supabase-js — 数据库客户端

架构

MCP Client (Claude/Cursor)
        ↓
    MCP Server (本包)
        ↓
    REST API (Cloudflare Workers)
        ↓
    Gemini AI Model
        ↓
    图片存储 (Cloudflare R2)

相关链接

License

MIT © 2026


Available Tools

3 tools
xhs_generate_coverA

生成小红书风格封面图片。输入文案,返回生成的图片 URL。

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes封面文案内容
aspectRatioNo宽高比,默认 3:43:4

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It discloses the core behavior (generates an image and returns a URL), which is more than a bare 'generate' tautology. However, it does not mention whether credit is consumed, whether generation is asynchronous, or whether the URL expires, which are relevant behavioral traits for a generation tool.

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?

One short sentence with no wasted words, front-loaded with the primary action and including the key input and output information. It is concise and well-structured.

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 description explains the return value (image URL), which is important because there is no output schema. However, it omits usage context such as credit costs, possible async behavior, and when to prefer this tool over siblings. Basic information is present, but important context is missing.

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%, so both 'text' and 'aspectRatio' are already documented with descriptions and an enum. The description only repeats the text-to-image idea and adds no parameter details beyond the schema, so the baseline 3 applies.

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 states a specific action ('generate') and resource ('Xiaohongshu-style cover image'), and explicitly mentions the input (text) and output (image URL). It is clearly distinct from the sibling tools, which deal with credits and history.

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?

The description does not provide any guidance on when to use this tool versus alternatives. It does not mention the sibling tools, prerequisites, or whether credits are required, 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.

xhs_get_creditsA

查询当前账户的 credit 余额

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden. It clearly indicates a read-only query ('查询') of the current account's credit balance, which communicates the core behavioral trait of a safe, non-mutating operation. It does not mention rate limits or auth, but for a simple balance query this is adequate.

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 a single, concise sentence with no redundant wording. It front-loads the key verb and resource, making it immediately scannable for an agent.

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?

For a zero-parameter, simple balance query, the description is largely complete: it gives the subject, scope, and action. The only minor gap is the lack of a stated return format or unit, but the tool name and description together are sufficient for an agent to invoke it correctly.

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?

The tool has zero parameters, so the baseline is 4. The description appropriately references '当前账户' (current account) as the implicit scope, and there are no parameter details left unexplained.

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 specific operation (查询/query) and resource (当前账户的 credit 余额), making the tool's purpose unambiguous. It is also distinct from its siblings, xhs_generate_cover and xhs_get_history, which clearly have different functions.

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 purpose implies that this tool is used to check credit availability before consuming operations, but the description does not explicitly state when to use it or when to prefer an alternative. While the siblings are self-evidently different, no explicit routing or contextual guidance is provided.

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

xhs_get_historyA

获取最近的封面生成历史记录

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo返回记录数量,默认 10

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. The verb '获取' and the phrase '历史记录' imply a read-only retrieval with no side effects, and '最近' adds a recency constraint. However, it does not describe the result format, pagination, or ordering behavior.

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 a single sentence with no filler words. It is concise, front-loaded, and appropriate for a simple retrieval tool.

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?

For a tool with only one optional parameter and no output schema, the description is mostly adequate. Still, it does not explain what fields a history record contains or how records are ordered, which an agent might need when processing the return value.

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?

The schema fully documents the 'limit' parameter with its description and default, so the description adds little parameter-level value. Baseline 3 is appropriate because schema coverage is 100%.

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

Purpose4/5

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

The description states a specific verb ('获取') and a specific resource ('封面生成历史记录'), making the tool's purpose clear. It also implicitly distinguishes itself from siblings xhs_generate_cover (generation) and xhs_get_credits (credits), but it does not explicitly name these alternatives.

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 the tool should be used when someone needs recent cover generation history, but it does not state when to prefer this over the sibling tools or any exclusions. Usage context is present, though implicit.

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. 3 tool updatesv1.0.4
    • First observedxhs_generate_cover
    • First observedxhs_get_credits
    • First observedxhs_get_history

TDQS

A4/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a distinct purpose: generate a cover, check credits, and view history. There is no overlap or boundary confusion between them.

Naming Consistency5/5

All tools follow the same xhs_ prefix with a clear verb_noun structure: generate_cover, get_credits, get_history. This is a highly consistent and predictable naming scheme.

Tool Count5/5

With 3 tools, the server is tightly scoped to its purpose of cover generation with necessary supporting utilities. Each tool earns its place and the count is within the well-scoped range.

Completeness4/5

The core workflow of generating covers is covered, and credits/history provide necessary supporting functionality. A minor gap is the lack of actions like deleting history or fetching a specific past cover by ID, but these are not critical.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers