diff --git a/README.md b/README.md
index 1b0d7b5..9c28e19 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,7 @@
✅ 从浏览器读取 Cookie
✅ 自定义文件名称格式
✅ 支持 API 调用功能
+✅ 支持 MCP 调用功能
✅ 支持文件断点续传下载
✅ 智能识别作品文件类型
✅ 支持设置作者备注
@@ -120,10 +121,12 @@
🖥 服务器模式
+⭐ 服务器模式同时支持 API 调用和 MCP 调用!
启动:运行命令:python .\main.py server
关闭:按下 Ctrl + C 关闭服务器
+API 调用
访问 http://127.0.0.1:5556/docs 或者 http://127.0.0.1:5556/redoc;你会看到自动生成的交互式 API 文档!
-请求接口:/xhs/
+请求接口:/xhs/detail
请求方法:POST
请求格式:JSON
请求参数:
@@ -193,6 +196,20 @@ async def example_api():
response = post(server, json=data, timeout=10)
print(response.json())
+MCP 调用
+MCP URL:http://127.0.0.1:5556/xhs/mcp
+MCP 传输机制:可流式传输的 HTTP (streamableHttp)
+MCP 配置示例
+
+MCP 调用示例
+获取小红书作品信息
+
+
+下载小红书作品文件
+下载图文作品时可以指定需要下载的图片序号;默认不返回作品信息,如需返回作品信息,请在对话时明确表述。
+
+
+
📜 其他说明
- 由于作品链接携带日期信息,使用先前日期获取的作品链接可能会被风控,建议下载作品文件时使用最新获取的作品链接
diff --git a/README_EN.md b/README_EN.md
index 271586f..970200b 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -38,6 +38,7 @@
- ✅ Read cookies from browser
- ✅ Customizable file name format
- ✅ Support API call functionality
+- ✅ Support MCP call functionality
- ✅ Support file breakpoint resume download
- ✅ Intelligent recognition of works file types
- ✅ Supports author alias configuration
@@ -121,11 +122,13 @@
🖥 Server Mode
+⭐ Server mode supports both API calls and MCP calls!
Start: Run the command: python .\main.py server
Stop: Press Ctrl + C to stop the server
+API Calls
Open http://127.0.0.1:5556/docs or http://127.0.0.1:5556/redoc; you will see automatically generated interactive API documentation!
Request endpoint:
-/xhs/
+/xhs/detail
Request method:
POST
Request format:
@@ -197,6 +200,20 @@ async def example_api():
response = post(server, json=data, timeout=10)
print(response.json())
+
MCP Calls
+MCP URL:http://127.0.0.1:5556/xhs/mcp
+MCP Transmission Mechanism:streamableHttp
+MCP Configuration Example
+
+MCP Invocation Example
+Retrieve RedNote Works Information
+
+
+Download RedNote Works Files
+When downloading images, you can specify the sequence numbers of the images to download. By default, post information is not returned. If you need the post information, please explicitly state so during the conversation.
+
+
+
📜 Others
- Due to the date information carried in the links of RedNote works, using links obtained from previous dates may be subject to risk control. It is recommended to use the latest RedNote works links when downloading RedNote work files
diff --git a/requirements.txt b/requirements.txt
index 8366d63..a819c49 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,6 +10,8 @@ emoji==2.14.1
# via xhs-downloader (pyproject.toml)
fastapi==0.115.12
# via xhs-downloader (pyproject.toml)
+fastmcp==2.10.5
+ # via xhs-downloader (pyproject.toml)
httpx[socks]==0.28.1
# via xhs-downloader (pyproject.toml)
lxml==5.3.2
diff --git a/source/application/app.py b/source/application/app.py
index 7f8a4c3..a4d4099 100644
--- a/source/application/app.py
+++ b/source/application/app.py
@@ -607,7 +607,7 @@ class XHS:
- https://xhslink.com/...
get_data
- 功能:输入小红书作品链接,返回该作品的信息。
+ 功能:输入小红书作品链接,返回该作品的信息,不会下载文件。
参数:
- url(必填):小红书作品链接
返回:
@@ -615,11 +615,11 @@ class XHS:
- data:作品信息
download
- 功能:输入小红书作品链接,下载作品文件。
+ 功能:输入小红书作品链接,下载作品文件,默认不返回作品信息。
参数:
- url(必填):小红书作品链接
- index(选填):根据用户指定的图片序号(如用户说“下载第1和第3张”时,index应为 [1, 3]),生成由所需图片序号组成的列表;如果用户未指定序号,则该字段为 None
- - return_data(可选):是否返回作品信息;如需获取作品信息,可设置此参数为 true,默认值为 false
+ - return_data(可选):是否返回作品信息;如需返回作品信息,可设置此参数为 true,默认值为 false
返回:
- true 或者 dict:表示下载成功
- false 或者 null:表示下载失败或出错
@@ -629,9 +629,8 @@ class XHS:
@mcp.tool(
name="get_data",
- description=_(
- dedent("""
- 功能:输入小红书作品链接,返回该作品的信息。
+ description=dedent("""
+ 功能:输入小红书作品链接,返回该作品的信息,不会下载文件。
参数:
url(必填):小红书作品链接,格式如:
@@ -642,8 +641,7 @@ class XHS:
返回:
message:提示
data:作品信息
- """)
- ),
+ """),
tags={
"小红书",
"XiaoHongShu",
@@ -676,9 +674,8 @@ class XHS:
@mcp.tool(
name="download",
- description=_(
- dedent("""
- 功能:输入小红书作品链接,下载作品文件。
+ description=dedent("""
+ 功能:输入小红书作品链接,下载作品文件,默认不返回作品信息。
参数:
url(必填):小红书作品链接,格式如:
@@ -687,13 +684,12 @@ class XHS:
- https://xhslink.com/...
index(选填):根据用户指定的图片序号(如用户说“下载第1和第3张”时,index应为 [1, 3]),生成由所需图片序号组成的列表;如果用户未指定序号,则该字段为 None
- return_data(可选):是否返回作品信息;如需获取作品信息,可设置此参数为 true,默认值为 false
+ return_data(可选):是否返回作品信息;如需返回作品信息,可设置此参数为 true,默认值为 false
返回:
true 或者 dict:表示下载成功
false 或者 null:表示下载失败或出错
- """)
- ),
+ """),
tags={
"小红书",
"XiaoHongShu",
diff --git a/static/screenshot/MCP下载文件1.png b/static/screenshot/MCP下载文件1.png
new file mode 100644
index 0000000..df637da
Binary files /dev/null and b/static/screenshot/MCP下载文件1.png differ
diff --git a/static/screenshot/MCP下载文件2.png b/static/screenshot/MCP下载文件2.png
new file mode 100644
index 0000000..cf5930a
Binary files /dev/null and b/static/screenshot/MCP下载文件2.png differ
diff --git a/static/screenshot/MCP获取数据.png b/static/screenshot/MCP获取数据.png
new file mode 100644
index 0000000..747c9f6
Binary files /dev/null and b/static/screenshot/MCP获取数据.png differ
diff --git a/static/screenshot/MCP配置示例.png b/static/screenshot/MCP配置示例.png
new file mode 100644
index 0000000..ba0aa7d
Binary files /dev/null and b/static/screenshot/MCP配置示例.png differ