mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
docs(MCP): 更新 MCP 调用的相关说明
This commit is contained in:
parent
1e163acc06
commit
c5b1f01b02
19
README.md
19
README.md
@ -37,6 +37,7 @@
|
||||
<li>✅ 从浏览器读取 Cookie</li>
|
||||
<li>✅ 自定义文件名称格式</li>
|
||||
<li>✅ 支持 API 调用功能</li>
|
||||
<li>✅ 支持 MCP 调用功能</li>
|
||||
<li>✅ 支持文件断点续传下载</li>
|
||||
<li>✅ 智能识别作品文件类型</li>
|
||||
<li>✅ 支持设置作者备注</li>
|
||||
@ -120,10 +121,12 @@
|
||||
<hr>
|
||||
<img src="static/screenshot/命令行模式截图CN2.png" alt="">
|
||||
<h1>🖥 服务器模式</h1>
|
||||
<p>⭐ 服务器模式同时支持 API 调用和 MCP 调用!</p>
|
||||
<p><b>启动:</b>运行命令:<code>python .\main.py server</code></p>
|
||||
<p><b>关闭:</b>按下 <code>Ctrl</code> + <code>C</code> 关闭服务器</p>
|
||||
<h2>API 调用</h2>
|
||||
<p>访问 <code>http://127.0.0.1:5556/docs</code> 或者 <code>http://127.0.0.1:5556/redoc</code>;你会看到自动生成的交互式 API 文档!</p>
|
||||
<p><b>请求接口:</b><code>/xhs/</code></p>
|
||||
<p><b>请求接口:</b><code>/xhs/detail</code></p>
|
||||
<p><b>请求方法:</b><code>POST</code></p>
|
||||
<p><b>请求格式:</b><code>JSON</code></p>
|
||||
<p><b>请求参数:</b></p>
|
||||
@ -193,6 +196,20 @@ async def example_api():
|
||||
response = post(server, json=data, timeout=10)
|
||||
print(response.json())
|
||||
</pre>
|
||||
<h2>MCP 调用</h2>
|
||||
<p><b>MCP URL:</b><code>http://127.0.0.1:5556/xhs/mcp</code></p>
|
||||
<p><b>MCP 传输机制:</b><code>可流式传输的 HTTP (streamableHttp)</code></p>
|
||||
<h3>MCP 配置示例</h3>
|
||||
<img src="static/screenshot/MCP配置示例.png" alt="MCP配置示例">
|
||||
<h3>MCP 调用示例</h3>
|
||||
<h4><strong>获取小红书作品信息</strong></h4>
|
||||
<img src="static/screenshot/MCP获取数据.png" alt="MCP获取数据">
|
||||
<hr>
|
||||
<h4><strong>下载小红书作品文件</strong></h4>
|
||||
<p>下载图文作品时可以指定需要下载的图片序号;默认不返回作品信息,如需返回作品信息,请在对话时明确表述。</p>
|
||||
<img src="static/screenshot/MCP下载文件1.png" alt="MCP下载文件">
|
||||
<hr>
|
||||
<img src="static/screenshot/MCP下载文件2.png" alt="MCP下载文件">
|
||||
<h1>📜 其他说明</h1>
|
||||
<ul>
|
||||
<li>由于作品链接携带日期信息,使用先前日期获取的作品链接可能会被风控,建议下载作品文件时使用最新获取的作品链接</li>
|
||||
|
||||
19
README_EN.md
19
README_EN.md
@ -38,6 +38,7 @@
|
||||
<li>✅ Read cookies from browser</li>
|
||||
<li>✅ Customizable file name format</li>
|
||||
<li>✅ Support API call functionality</li>
|
||||
<li>✅ Support MCP call functionality</li>
|
||||
<li>✅ Support file breakpoint resume download</li>
|
||||
<li>✅ Intelligent recognition of works file types</li>
|
||||
<li>✅ Supports author alias configuration</li>
|
||||
@ -121,11 +122,13 @@
|
||||
<hr>
|
||||
<img src="static/screenshot/命令行模式截图EN2.png" alt="">
|
||||
<h1>🖥 Server Mode</h1>
|
||||
<p>⭐ Server mode supports both API calls and MCP calls!</p>
|
||||
<p><b>Start:</b> Run the command: <code>python .\main.py server</code></p>
|
||||
<p><b>Stop:</b> Press <code>Ctrl</code> + <code>C</code> to stop the server</p>
|
||||
<h2>API Calls</h2>
|
||||
<p>Open <code>http://127.0.0.1:5556/docs</code> or <code>http://127.0.0.1:5556/redoc</code>; you will see automatically generated interactive API documentation!</p>
|
||||
<p><b>Request endpoint:</b>
|
||||
<code>/xhs/</code></p>
|
||||
<code>/xhs/detail</code></p>
|
||||
<p><b>Request method:</b>
|
||||
<code>POST</code></p>
|
||||
<p><b>Request format:</b>
|
||||
@ -197,6 +200,20 @@ async def example_api():
|
||||
response = post(server, json=data, timeout=10)
|
||||
print(response.json())
|
||||
</pre>
|
||||
<h2>MCP Calls</h2>
|
||||
<p><b>MCP URL:</b><code>http://127.0.0.1:5556/xhs/mcp</code></p>
|
||||
<p><b>MCP Transmission Mechanism:</b><code>streamableHttp</code></p>
|
||||
<h3>MCP Configuration Example</h3>
|
||||
<img src="static/screenshot/MCP配置示例.png" alt="MCP Configuration Example">
|
||||
<h3>MCP Invocation Example</h3>
|
||||
<h4><strong>Retrieve RedNote Works Information</strong></h4>
|
||||
<img src="static/screenshot/MCP获取数据.png" alt="MCP Data Retrieval">
|
||||
<hr>
|
||||
<h4><strong>Download RedNote Works Files</strong></h4>
|
||||
<p>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.</p>
|
||||
<img src="static/screenshot/MCP下载文件1.png" alt="MCP File Download">
|
||||
<hr>
|
||||
<img src="static/screenshot/MCP下载文件2.png" alt="MCP File Download">
|
||||
<h1>📜 Others</h1>
|
||||
<ul>
|
||||
<li>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</li>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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",
|
||||
|
||||
BIN
static/screenshot/MCP下载文件1.png
Normal file
BIN
static/screenshot/MCP下载文件1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
static/screenshot/MCP下载文件2.png
Normal file
BIN
static/screenshot/MCP下载文件2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
BIN
static/screenshot/MCP获取数据.png
Normal file
BIN
static/screenshot/MCP获取数据.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
static/screenshot/MCP配置示例.png
Normal file
BIN
static/screenshot/MCP配置示例.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Loading…
x
Reference in New Issue
Block a user