Compare commits
11 Commits
cbd592c357
...
4afe4aab1e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4afe4aab1e | ||
|
|
b3e0efcc11 | ||
|
|
7364a9f52f | ||
|
|
40a484ebc8 | ||
|
|
5539b9fce7 | ||
|
|
0e16f4b825 | ||
|
|
38be3bad11 | ||
|
|
5c8a6cc6dd | ||
|
|
8ce415f0eb | ||
|
|
c294829e1b | ||
|
|
f140de74a7 |
@@ -250,6 +250,16 @@
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "blablabiu",
|
||||
"name": "Xinhao Chen",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/123888078?v=4",
|
||||
"profile": "https://github.com/blablabiu",
|
||||
"contributions": [
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
29
.drone.yml
Normal file
29
.drone.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: build-and-push
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
- develop
|
||||
event:
|
||||
- push
|
||||
- custom
|
||||
|
||||
steps:
|
||||
- name: build-and-push
|
||||
image: gcr.io/kaniko-project/executor:debug
|
||||
commands:
|
||||
- >
|
||||
/kaniko/executor
|
||||
--context=/drone/src
|
||||
--dockerfile=Dockerfile
|
||||
--destination=192.168.68.11:30500/xiaohongshu-mcp:${DRONE_COMMIT_SHA:0:8}
|
||||
--destination=192.168.68.11:30500/xiaohongshu-mcp:latest
|
||||
--insecure
|
||||
--skip-tls-verify
|
||||
|
||||
- name: restart-deployment
|
||||
image: bitnami/kubectl:latest
|
||||
commands:
|
||||
- kubectl rollout restart deploy/xiaohongshu-mcp -n xiaohongshu-mcp
|
||||
23
DONATIONS.md
23
DONATIONS.md
@@ -7,9 +7,9 @@
|
||||
|
||||
## 摘要
|
||||
|
||||
- 累计收到赞赏:¥ 1285.92
|
||||
- 累计捐赠:¥ 1300
|
||||
- 最近更新时间:2026-03-01
|
||||
- 累计收到赞赏:¥ 1365.88
|
||||
- 累计捐赠:¥ 1610
|
||||
- 最近更新时间:2026-03-08
|
||||
|
||||
---
|
||||
|
||||
@@ -26,13 +26,17 @@
|
||||
|
||||
**本月小结**
|
||||
|
||||
- 收到赞赏合计:¥ 9.99
|
||||
- 收到赞赏合计:¥ 89.95
|
||||
- 捐出合计:待更新
|
||||
|
||||
**收到的赞赏**
|
||||
| 日期 | 昵称 | 金额 | 备注 |
|
||||
|------------|-----:|-----:|------|
|
||||
| 2026-03-01 | 黄蕾 SQUASH | 9.99 | 赞赏码 |
|
||||
| 2026-03-04 | 之乎者也 | 9.99 | 赞赏码 |
|
||||
| 2026-03-05 | 质数的孤独 | 29.99 | 赞赏码 |
|
||||
| 2026-03-06 | 无名大侠 | 19.99 | 赞赏码 |
|
||||
| 2026-03-08 | 勇敢的心 | 19.99 | 赞赏码 |
|
||||
|
||||
|
||||
### 2026-02
|
||||
@@ -40,7 +44,7 @@
|
||||
**本月小结**
|
||||
|
||||
- 收到赞赏合计:¥ 305.98
|
||||
- 捐出合计:待更新
|
||||
- 捐出合计:¥ 310.00,捐赠给腾讯慈善「重疾儿童协助」
|
||||
|
||||
**收到的赞赏**
|
||||
| 日期 | 昵称 | 金额 | 备注 |
|
||||
@@ -54,9 +58,12 @@
|
||||
| 2026-02-22 | 小小酷 | 1.00 | 赞赏码 |
|
||||
| 2026-02-27 | 陈志 | 200.00 | 赞赏码 |
|
||||
|
||||
捐款截图记录:
|
||||
|
||||

|
||||
<table>
|
||||
<tr>
|
||||
<td><img height="400" alt="donation-2026-02-intro" src="https://github.com/user-attachments/assets/00d75786-d6b3-41b5-9ced-d2fec8b6514e" /></td>
|
||||
<td><img height="400" alt="donation-2026-02" src="https://github.com/user-attachments/assets/5c1d1cae-3a04-4730-8022-4608f0c6f3e7" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
### 2026-01
|
||||
|
||||
11
README.md
11
README.md
@@ -1,11 +1,11 @@
|
||||
# xiaohongshu-mcp
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](https://hub.docker.com/r/xpzouying/xiaohongshu-mcp)
|
||||
|
||||
MCP for 小红书 / xiaohongshu.com。让你的 AI 助手直接访问小红书数据。
|
||||
@@ -997,9 +997,9 @@ npx mcporter list xiaohongshu-mcp
|
||||
**重要:在群里问问题之前,请一定要先仔细看完 README 文档以及查看 Issues。**
|
||||
|
||||
### 微信群
|
||||
| 微信群 17 群 | 微信群 18 群 |
|
||||
| 微信群 20 群 | 微信群 21 群 |
|
||||
| :------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------: |
|
||||
| <img src="https://github.com/user-attachments/assets/2317229c-311e-4339-b659-2a2467aa8c17" alt="WechatIMG119" width="300"> | <img src="https://github.com/user-attachments/assets/78f8c7a2-98ab-477b-bbb2-7b08551ffc99" alt="WechatIMG119" width="300"> |
|
||||
| <img src="https://github.com/user-attachments/assets/16d8fe15-bcc2-40d3-81ae-47360d0d2c10" alt="WechatIMG119" width="300"> | <img src="https://github.com/user-attachments/assets/ac67ecba-f76d-4680-b961-adac1f7598ed" alt="WechatIMG119" width="300"> |
|
||||
|
||||
### 飞书群
|
||||
|
||||
@@ -1054,6 +1054,7 @@ npx mcporter list xiaohongshu-mcp
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://runyang.vercel.app/"><img src="https://avatars.githubusercontent.com/u/54588936?v=4?s=100" width="100px;" alt="Runyang YOU"/><br /><sub><b>Runyang YOU</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=YRYangang" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=YRYangang" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.hnfnu.edu.cn/"><img src="https://avatars.githubusercontent.com/u/134906805?v=4?s=100" width="100px;" alt="e0_7"/><br /><sub><b>e0_7</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=Daily-AC" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=Daily-AC" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prehisle"><img src="https://avatars.githubusercontent.com/u/2081344?v=4?s=100" width="100px;" alt="prehisle"/><br /><sub><b>prehisle</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=prehisle" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=prehisle" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/blablabiu"><img src="https://avatars.githubusercontent.com/u/123888078?v=4?s=100" width="100px;" alt="Xinhao Chen"/><br /><sub><b>Xinhao Chen</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=blablabiu" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=blablabiu" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](./DONATIONS.md)
|
||||
[](https://hub.docker.com/r/xpzouying/xiaohongshu-mcp)
|
||||
|
||||
MCP for RedNote (Xiaohongshu) platform.
|
||||
|
||||
20
k8s/argocd-app.yaml
Normal file
20
k8s/argocd-app.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: xiaohongshu-mcp
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://git.colacoder.com/kai/xiaohongshu-mcp.git
|
||||
targetRevision: main
|
||||
path: k8s/base
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: xiaohongshu-mcp
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
70
k8s/base/deployment.yaml
Normal file
70
k8s/base/deployment.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: xiaohongshu-mcp
|
||||
namespace: xiaohongshu-mcp
|
||||
labels:
|
||||
app: xiaohongshu-mcp
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: xiaohongshu-mcp
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: xiaohongshu-mcp
|
||||
spec:
|
||||
containers:
|
||||
- name: xiaohongshu-mcp
|
||||
image: 192.168.68.11:30500/xiaohongshu-mcp:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 18060
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: ROD_BROWSER_BIN
|
||||
value: "/usr/bin/google-chrome"
|
||||
- name: COOKIES_PATH
|
||||
value: "/app/data/cookies.json"
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 2Gi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
- name: images
|
||||
mountPath: /app/images
|
||||
- name: dshm
|
||||
mountPath: /dev/shm
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 18060
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 18060
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: xiaohongshu-mcp-data
|
||||
- name: images
|
||||
persistentVolumeClaim:
|
||||
claimName: xiaohongshu-mcp-images
|
||||
- name: dshm
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 256Mi
|
||||
29
k8s/base/drone-rbac.yaml
Normal file
29
k8s/base/drone-rbac.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: drone-deploy
|
||||
namespace: xiaohongshu-mcp
|
||||
rules:
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["get", "list", "patch", "update"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: drone-deploy
|
||||
namespace: xiaohongshu-mcp
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: default
|
||||
namespace: drone
|
||||
- kind: ServiceAccount
|
||||
name: drone
|
||||
namespace: drone
|
||||
- kind: ServiceAccount
|
||||
name: drone-runner-drone-runner-kube
|
||||
namespace: drone
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: drone-deploy
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
26
k8s/base/ingress.yaml
Normal file
26
k8s/base/ingress.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: xiaohongshu-mcp
|
||||
namespace: xiaohongshu-mcp
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
tls:
|
||||
- hosts:
|
||||
- xiaohongshu-mcp.k8s.home
|
||||
secretName: xiaohongshu-mcp-tls
|
||||
rules:
|
||||
- host: xiaohongshu-mcp.k8s.home
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: xiaohongshu-mcp
|
||||
port:
|
||||
number: 18060
|
||||
12
k8s/base/kustomization.yaml
Normal file
12
k8s/base/kustomization.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: xiaohongshu-mcp
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- pvc.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- ingress.yaml
|
||||
- drone-rbac.yaml
|
||||
4
k8s/base/namespace.yaml
Normal file
4
k8s/base/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: xiaohongshu-mcp
|
||||
27
k8s/base/pvc.yaml
Normal file
27
k8s/base/pvc.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: xiaohongshu-mcp-data
|
||||
namespace: xiaohongshu-mcp
|
||||
labels:
|
||||
app: xiaohongshu-mcp
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: xiaohongshu-mcp-images
|
||||
namespace: xiaohongshu-mcp
|
||||
labels:
|
||||
app: xiaohongshu-mcp
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
15
k8s/base/service.yaml
Normal file
15
k8s/base/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: xiaohongshu-mcp
|
||||
namespace: xiaohongshu-mcp
|
||||
labels:
|
||||
app: xiaohongshu-mcp
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: xiaohongshu-mcp
|
||||
ports:
|
||||
- port: 18060
|
||||
targetPort: 18060
|
||||
protocol: TCP
|
||||
@@ -1,6 +1,10 @@
|
||||
package downloader
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -102,9 +106,57 @@ func TestImageDownloader_generateFileName(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestDownloadImage_AntiHotlink 测试下载防盗链图片
|
||||
// 验证 PR #412 的修改:添加 User-Agent 和 Referer 解决 403 问题
|
||||
// 验证添加 User-Agent 和 Referer 解决 403 问题
|
||||
func TestDownloadImage_AntiHotlink(t *testing.T) {
|
||||
// 快科技的图片,需要 User-Agent 才能下载
|
||||
// 1x1 透明 PNG,避免依赖外部网络资源导致测试不稳定
|
||||
const pngBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO7+2X8AAAAASUVORK5CYII="
|
||||
pngData, err := base64.StdEncoding.DecodeString(pngBase64)
|
||||
if err != nil {
|
||||
t.Fatalf("解析测试图片失败: %v", err)
|
||||
}
|
||||
|
||||
var server *httptest.Server
|
||||
server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if got := r.Header.Get("User-Agent"); got == "" {
|
||||
http.Error(w, "missing user-agent", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
expectedReferer := fmt.Sprintf("%s/", server.URL)
|
||||
if got := r.Header.Get("Referer"); got != expectedReferer {
|
||||
http.Error(w, "invalid referer", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "image/png")
|
||||
_, _ = w.Write(pngData)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
tempDir := t.TempDir()
|
||||
downloader := NewImageDownloader(tempDir)
|
||||
|
||||
filePath, err := downloader.DownloadImage(server.URL + "/image.png")
|
||||
if err != nil {
|
||||
t.Fatalf("下载失败: %v", err)
|
||||
}
|
||||
|
||||
info, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
t.Fatalf("文件不存在: %v", err)
|
||||
}
|
||||
if info.Size() == 0 {
|
||||
t.Fatalf("下载文件为空")
|
||||
}
|
||||
}
|
||||
|
||||
// TestDownloadImage_AntiHotlink_External 集成测试:真实外网防盗链场景
|
||||
// 默认跳过,设置 XHS_RUN_NETWORK_TESTS=1 后执行。
|
||||
func TestDownloadImage_AntiHotlink_External(t *testing.T) {
|
||||
if os.Getenv("XHS_RUN_NETWORK_TESTS") != "1" {
|
||||
t.Skip("skip external network test; set XHS_RUN_NETWORK_TESTS=1 to enable")
|
||||
}
|
||||
|
||||
testURL := "https://img1.mydrivers.com/img/20260213/s_fdac2d21214147019e629fa7f2c8802e.png"
|
||||
|
||||
tempDir := t.TempDir()
|
||||
@@ -115,16 +167,11 @@ func TestDownloadImage_AntiHotlink(t *testing.T) {
|
||||
t.Fatalf("下载失败: %v", err)
|
||||
}
|
||||
|
||||
// 验证文件存在
|
||||
info, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
t.Fatalf("文件不存在: %v", err)
|
||||
}
|
||||
|
||||
// 验证文件大小合理(大于 1KB)
|
||||
if info.Size() < 1024 {
|
||||
t.Errorf("文件太小,可能下载失败: %d bytes", info.Size())
|
||||
if info.Size() == 0 {
|
||||
t.Fatalf("下载文件为空")
|
||||
}
|
||||
|
||||
t.Logf("下载成功: %s (%d bytes)", filePath, info.Size())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user