rednote_mcp_plus 0.7.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rednote_mcp_plus/read/search.py +5 -12
- rednote_mcp_plus/server.py +4 -27
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/METADATA +33 -13
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/RECORD +8 -8
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/WHEEL +0 -0
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/entry_points.txt +0 -0
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/licenses/LICENSE +0 -0
- {rednote_mcp_plus-0.7.0.dist-info → rednote_mcp_plus-0.8.0.dist-info}/top_level.txt +0 -0
rednote_mcp_plus/read/search.py
CHANGED
|
@@ -4,12 +4,9 @@ import asyncio
|
|
|
4
4
|
from rednote_mcp_plus.read.dump import dumpNote
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
async def search(keyWord: str, topN: int
|
|
7
|
+
async def search(keyWord: str, topN: int) -> list[str]:
|
|
8
8
|
"""
|
|
9
9
|
搜索小红书笔记
|
|
10
|
-
:param keyWord: 搜索关键词
|
|
11
|
-
:param topN: 返回前N个结果,不大于10
|
|
12
|
-
:param dump: 是否导出为Markdown文件
|
|
13
10
|
"""
|
|
14
11
|
async with async_playwright() as playwright:
|
|
15
12
|
browser = await playwright.chromium.launch(headless=False)
|
|
@@ -20,8 +17,9 @@ async def search(keyWord: str, topN: int, dump: bool) -> str:
|
|
|
20
17
|
await page.wait_for_timeout(3000)
|
|
21
18
|
login_button = page.locator("form").get_by_role("button", name="登录")
|
|
22
19
|
if(await login_button.is_visible()):
|
|
23
|
-
return "❌ 未登录小红书,请先登录"
|
|
20
|
+
return ["❌ 未登录小红书,请先登录"]
|
|
24
21
|
|
|
22
|
+
herfs = []
|
|
25
23
|
prefix = 'https://www.xiaohongshu.com'
|
|
26
24
|
links = await page.query_selector_all('a.cover.mask.ld')
|
|
27
25
|
# 获取所有 href 属性
|
|
@@ -35,18 +33,13 @@ async def search(keyWord: str, topN: int, dump: bool) -> str:
|
|
|
35
33
|
break
|
|
36
34
|
markdown_content = []
|
|
37
35
|
for href in hrefs:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
markdown_content = "\n---\n".join(markdown_content)
|
|
36
|
+
hrefs.append
|
|
41
37
|
|
|
42
|
-
if dump:
|
|
43
|
-
with open('red_note_search.md', 'w', encoding='utf-8') as f:
|
|
44
|
-
f.write(markdown_content)
|
|
45
38
|
|
|
46
39
|
await browser.close()
|
|
47
40
|
await context.close()
|
|
48
41
|
|
|
49
|
-
return
|
|
42
|
+
return hrefs
|
|
50
43
|
|
|
51
44
|
|
|
52
45
|
|
rednote_mcp_plus/server.py
CHANGED
|
@@ -23,8 +23,6 @@ async def likeNote(
|
|
|
23
23
|
) -> str:
|
|
24
24
|
"""
|
|
25
25
|
点赞小红书笔记
|
|
26
|
-
:param noteUrl: 笔记URL
|
|
27
|
-
:return: 点赞结果
|
|
28
26
|
"""
|
|
29
27
|
result = await interaction.likeNote(noteUrl)
|
|
30
28
|
return result
|
|
@@ -35,8 +33,6 @@ async def collectNote(
|
|
|
35
33
|
) -> str:
|
|
36
34
|
"""
|
|
37
35
|
收藏小红书笔记
|
|
38
|
-
:param noteUrl: 笔记URL
|
|
39
|
-
:return: 收藏结果
|
|
40
36
|
"""
|
|
41
37
|
result = await interaction.collectNote(noteUrl)
|
|
42
38
|
return result
|
|
@@ -48,9 +44,6 @@ async def commentNote(
|
|
|
48
44
|
) -> str:
|
|
49
45
|
"""
|
|
50
46
|
评论小红书笔记
|
|
51
|
-
:param noteUrl: 笔记URL
|
|
52
|
-
:param commentText: 评论内容
|
|
53
|
-
:return: 评论结果
|
|
54
47
|
"""
|
|
55
48
|
result = await interaction.commentNote(noteUrl, commentText)
|
|
56
49
|
return result
|
|
@@ -61,8 +54,6 @@ async def followUser(
|
|
|
61
54
|
) -> str:
|
|
62
55
|
"""
|
|
63
56
|
关注小红书用户
|
|
64
|
-
:param noteUrl: 笔记URL
|
|
65
|
-
:return: 关注结果
|
|
66
57
|
"""
|
|
67
58
|
result = await interaction.followUser(noteUrl)
|
|
68
59
|
return result
|
|
@@ -70,17 +61,12 @@ async def followUser(
|
|
|
70
61
|
@mcp.tool()
|
|
71
62
|
async def searchNotes(
|
|
72
63
|
keyWord: Annotated[str, "搜索关键词"],
|
|
73
|
-
topN: Annotated[int, "返回前N个结果,不大于10"]
|
|
74
|
-
|
|
75
|
-
) -> str:
|
|
64
|
+
topN: Annotated[int, "返回前N个结果,不大于10"]
|
|
65
|
+
) -> List[str]:
|
|
76
66
|
"""
|
|
77
|
-
|
|
78
|
-
:param keyWord: 搜索关键词
|
|
79
|
-
:param topN: 返回前N个结果,不大于10
|
|
80
|
-
:param dump: 是否导出为Markdown文件
|
|
81
|
-
:return: 搜索结果的Markdown内容
|
|
67
|
+
搜索小红书笔记,返回笔记URL列表
|
|
82
68
|
"""
|
|
83
|
-
result = await search.search(keyWord, topN
|
|
69
|
+
result = await search.search(keyWord, topN)
|
|
84
70
|
return result
|
|
85
71
|
|
|
86
72
|
@mcp.tool()
|
|
@@ -89,8 +75,6 @@ async def dumpNote(
|
|
|
89
75
|
) -> str:
|
|
90
76
|
"""
|
|
91
77
|
导出小红书笔记内容
|
|
92
|
-
:param noteUrl: 笔记URL
|
|
93
|
-
:return: 笔记的Markdown内容
|
|
94
78
|
"""
|
|
95
79
|
result = await dump.dumpNote(noteUrl)
|
|
96
80
|
return result
|
|
@@ -101,8 +85,6 @@ async def dumpUser(
|
|
|
101
85
|
) -> str:
|
|
102
86
|
"""
|
|
103
87
|
导出小红书用户信息
|
|
104
|
-
:param userUrl: 用户主页URL
|
|
105
|
-
:return: 用户信息文本
|
|
106
88
|
"""
|
|
107
89
|
result = await dump_user.dumpUser(userUrl)
|
|
108
90
|
return result
|
|
@@ -116,11 +98,6 @@ async def publishText(
|
|
|
116
98
|
) -> str:
|
|
117
99
|
"""
|
|
118
100
|
发布小红书图文笔记
|
|
119
|
-
:param image_urls: 图片URL列表
|
|
120
|
-
:param title: 笔记标题
|
|
121
|
-
:param content: 笔记内容
|
|
122
|
-
:param tags: 标签列表
|
|
123
|
-
:return: 发布结果
|
|
124
101
|
"""
|
|
125
102
|
result = await publish.publishText(image_urls, title, content, tags)
|
|
126
103
|
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rednote_mcp_plus
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Plus version of MCP server for accessing RedNote
|
|
5
5
|
Author-email: MrMao007 <mty1209@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/MrMao007/RedNote-MCP-Plus
|
|
@@ -12,7 +12,7 @@ Dynamic: license-file
|
|
|
12
12
|
|
|
13
13
|
# RedNote-MCP-Plus
|
|
14
14
|
|
|
15
|
-
<p align="center"><img src= "logo.png" width="600"/></p>
|
|
15
|
+
<p align="center"><img src= "docs/img/logo.png" width="600"/></p>
|
|
16
16
|
|
|
17
17
|
[](docs/README.en.md)
|
|
18
18
|
[](README.md)
|
|
@@ -22,19 +22,20 @@ Dynamic: license-file
|
|
|
22
22
|
⚙️ 配备更全面工具集的小红书 MCP 服务器。
|
|
23
23
|
|
|
24
24
|
## 主要特性
|
|
25
|
-
-
|
|
26
|
-
-
|
|
25
|
+
- 简单易上手:只需要几行简单的命令即可体验工具能力,无需额外配置
|
|
26
|
+
- 自动化互动工具:包含发布、点赞、收藏、评论、关注等工具,助力自动化账号运营
|
|
27
27
|
- 自动化爬虫工具:包含搜索、笔记内容爬取、用户数据爬取等工具,助力内容搜索
|
|
28
28
|
|
|
29
29
|
## 工具清单
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
30
|
+
- ✅登录:使用其他工具前必须使用该工具登录小红书,保存登录态
|
|
31
|
+
- ❤️点赞:点赞任意笔记
|
|
32
|
+
- 📥收藏:收藏任意笔记
|
|
33
|
+
- 💬评论:评论任意笔记
|
|
34
|
+
- 👤关注:关注任意用户
|
|
35
|
+
- 🖼️发布笔记:发布任意图文笔记
|
|
36
|
+
- 🔍搜索笔记:关键词搜索笔记
|
|
37
|
+
- 📖笔记内容爬取:以MarkDown形式保存任意笔记
|
|
38
|
+
- 📊用户数据爬取:获取用户昵称、简介、标签、互动信息
|
|
38
39
|
|
|
39
40
|
## 快速开始
|
|
40
41
|
|
|
@@ -57,15 +58,34 @@ playwright install
|
|
|
57
58
|
brew install node
|
|
58
59
|
```
|
|
59
60
|
|
|
61
|
+
4. 安装小红书MCP
|
|
62
|
+
```
|
|
63
|
+
uv tool install rednote_mcp_plus
|
|
64
|
+
```
|
|
65
|
+
|
|
60
66
|
### 快速试用
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
**一行命令启动MCP服务调试!**
|
|
63
69
|
```
|
|
64
70
|
npx @modelcontextprotocol/inspector uvx rednote_mcp_plus
|
|
65
71
|
```
|
|
66
72
|
|
|
73
|
+
如果一切顺利的话,现在你就可以看到如图所示列出的所有工具了,接下来你可以随意试用感兴趣的MCP工具了!
|
|
74
|
+
|
|
75
|
+

|
|
76
|
+
|
|
77
|
+
> ⚠️ **注意:** 请务必先使用manualLogin工具登录小红书后再体验其他工具!
|
|
78
|
+
|
|
79
|
+
### 效果展示
|
|
80
|
+
|
|
81
|
+
图中展示了获取笔记内容的结果,包含了标题、作者、图文/视频、正文、标签、互动数据、发布时间、发布地点等数据。
|
|
82
|
+
|
|
83
|
+

|
|
84
|
+
|
|
67
85
|
## MCP服务器配置
|
|
68
86
|
|
|
87
|
+
以Cline配置为例:
|
|
88
|
+
|
|
69
89
|
```
|
|
70
90
|
{
|
|
71
91
|
"mcpServers": {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
rednote_mcp_plus/__init__.py,sha256=iEHRRb2Eu2WLfcRPcxuC1SGQHZddpRpucEtwHfbvSk0,244
|
|
2
2
|
rednote_mcp_plus/__main__.py,sha256=dX9L5QduXiar7rVpjg59RuNhtMUu8E7naE0NLDRoGXM,40
|
|
3
|
-
rednote_mcp_plus/server.py,sha256=
|
|
3
|
+
rednote_mcp_plus/server.py,sha256=KkLem69kcjATc9dXxhnEuaEIzSANW-yNwJVkE3fnV-M,2519
|
|
4
4
|
rednote_mcp_plus/auth/login.py,sha256=UGQM1WWRM2cGVa8YWflOsscS7zcVQRj9yQnwZVt27lo,1873
|
|
5
5
|
rednote_mcp_plus/read/dump.py,sha256=Nvr8zksMZXyN_9AhJjfsr7YHEz8SVi-M3juTUFVRsTk,4263
|
|
6
6
|
rednote_mcp_plus/read/dump_user.py,sha256=2nlG97Qoi5k0oFCJUwVJQD2hAou1IaaZnvVYf65QDq0,2340
|
|
7
|
-
rednote_mcp_plus/read/search.py,sha256=
|
|
7
|
+
rednote_mcp_plus/read/search.py,sha256=tSv8_M0VFBF8ZydQYD9h5_l6KSkTuu8Ia0sYwL7BQS8,1567
|
|
8
8
|
rednote_mcp_plus/write/interaction.py,sha256=m_KJqslL6x_BKTlVd9VIqiZFK_Dht0W4cVZgBObpFF4,4316
|
|
9
9
|
rednote_mcp_plus/write/publish.py,sha256=qb79phSyYFdnMKA-pQSBxCy0hDW_dj7uLEfRe8zLRfU,3322
|
|
10
|
-
rednote_mcp_plus-0.
|
|
11
|
-
rednote_mcp_plus-0.
|
|
12
|
-
rednote_mcp_plus-0.
|
|
13
|
-
rednote_mcp_plus-0.
|
|
14
|
-
rednote_mcp_plus-0.
|
|
15
|
-
rednote_mcp_plus-0.
|
|
10
|
+
rednote_mcp_plus-0.8.0.dist-info/licenses/LICENSE,sha256=9tK-YRom1vbLVHstEu8kyX_PBx2niXMVL3cwA3IAmxk,1065
|
|
11
|
+
rednote_mcp_plus-0.8.0.dist-info/METADATA,sha256=hmcWhC3gLXBryGxgemuuBqGhNzKdzJ5Yazr2zwCVxf4,2867
|
|
12
|
+
rednote_mcp_plus-0.8.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
rednote_mcp_plus-0.8.0.dist-info/entry_points.txt,sha256=OBNoUIMggl953wkVHSjljLTcnU4HOlr9XhZamcGnWS8,59
|
|
14
|
+
rednote_mcp_plus-0.8.0.dist-info/top_level.txt,sha256=mk1SLfb9HVLpSRSbgn9eej-n3NmE9aeSaXZpHwjE0ZE,17
|
|
15
|
+
rednote_mcp_plus-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|