From 716cf104ce6195de992ac875e2de4dd86bd3b49b Mon Sep 17 00:00:00 2001 From: zy Date: Sat, 20 Sep 2025 23:44:59 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=B9=E5=BC=8F=E7=9A=84=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=20(#124)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在README中详细说明两种图片支持方式(HTTP链接和本地路径) - 明确推荐使用本地绝对路径的原因和优势 - 添加具体的使用示例和代码示例 - 优化MCP协议中images字段的描述,提供更清晰的格式说明 - 帮助用户更好地理解和使用图片发布功能 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude --- README.md | 32 ++++++++++++++++++++++++++++++++ streamable_http.go | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 976305e..07cef52 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,26 @@ https://github.com/user-attachments/assets/bd9a9a4a-58cb-4421-b8f3-015f703ce1f9 支持发布图文内容到小红书,包括标题、内容描述和图片。后续支持更多的发布功能。 +**图片支持方式:** + +支持两种图片输入方式: + +1. **HTTP/HTTPS 图片链接** + ``` + ["https://example.com/image1.jpg", "https://example.com/image2.png"] + ``` + +2. **本地图片绝对路径**(推荐) + ``` + ["/Users/username/Pictures/image1.jpg", "/home/user/images/image2.png"] + ``` + +**为什么推荐使用本地路径:** +- ✅ 稳定性更好,不依赖网络 +- ✅ 上传速度更快 +- ✅ 避免图片链接失效问题 +- ✅ 支持更多图片格式 + **发布图文帖子演示:** https://github.com/user-attachments/assets/8aee0814-eb96-40af-b871-e66e6bbb6b06 @@ -475,6 +495,7 @@ npx @modelcontextprotocol/inspector - `check_login_status` - 检查小红书登录状态(无参数) - `publish_content` - 发布图文内容到小红书(必需:title, content, images) + - `images`: 支持HTTP链接或本地绝对路径,推荐使用本地路径 - `list_feeds` - 获取小红书首页推荐列表(无参数) - `search_feeds` - 搜索小红书内容(需要:keyword) - `get_feed_detail` - 获取帖子详情(需要:feed_id, xsec_token) @@ -484,6 +505,7 @@ npx @modelcontextprotocol/inspector 使用 Claude Code 发布内容到小红书: +**示例1:使用HTTP图片链接** ``` 帮我写一篇帖子发布到小红书上, 配图为:https://cn.bing.com/th?id=OHR.MaoriRock_EN-US6499689741_UHD.jpg&w=3840 @@ -492,6 +514,16 @@ npx @modelcontextprotocol/inspector 使用 xiaohongshu-mcp 进行发布。 ``` +**示例2:使用本地图片路径(推荐)** +``` +帮我写一篇关于春天的帖子发布到小红书上, +使用这些本地图片: +- /Users/username/Pictures/spring_flowers.jpg +- /Users/username/Pictures/cherry_blossom.jpg + +使用 xiaohongshu-mcp 进行发布。 +``` + ![claude-cli 进行发布](./assets/claude_push.gif) **发布结果:** diff --git a/streamable_http.go b/streamable_http.go index 5a8e212..81ef6b9 100644 --- a/streamable_http.go +++ b/streamable_http.go @@ -180,7 +180,7 @@ func (s *AppServer) processToolsList(request *JSONRPCRequest) *JSONRPCResponse { }, "images": map[string]interface{}{ "type": "array", - "description": "图片路径列表,支持本地路径或URL(至少需要1张图片)", + "description": "图片路径列表(至少需要1张图片)。支持两种方式:1. HTTP/HTTPS图片链接(自动下载);2. 本地图片绝对路径(推荐,如:/Users/user/image.jpg)", "items": map[string]interface{}{ "type": "string", },