Skip to main content

小红书 + 知乎搜索 MCP Server(纯浏览器方案)

Project description

Stride28

Search MCP

中文社区经验聚合搜索 MCP Server — 让 AI 助手直接搜索小红书和知乎的真实内容

PyPI License Python

使用场景 · 安装 · 配置 · Tool 参考 · 错误码


这是 Stride28 智能学习平台的搜索模块,独立抽出来作为 MCP 工具。

演示

Kiro + MCP 搜索

Kiro 搜索演示

Kiro 搜索演示

WorkBuddy + MCP 自动化(即将推出)

一键爬取小红书/知乎内容 → 接入腾讯文档/飞书文档自动整理 → 配合 Claw 实现每日自动化拉取、分类归档、摘要生成。

使用场景

跟 AI 助手说:

  • "帮我搜小红书上关于 RAG 的面试题"
  • "看看那篇笔记的详细内容和评论"
  • "去知乎搜搜 Agent 开发相关的讨论"
  • "只搜小红书的视频笔记"
  • "获取知乎这个问题的完整回答,不要截断"

AI 会自动调用对应的 MCP tool。首次使用时会弹出浏览器让你完成登录。

安装

Python 3.10+

# uv(推荐)
uv tool install stride28-search-mcp

# 或 pipx
pipx install stride28-search-mcp

安装浏览器:

stride28-search-mcp install-browser

配置

在 MCP 客户端配置中添加:

{
  "mcpServers": {
    "stride28-search": {
      "command": "stride28-search-mcp",
      "disabled": false
    }
  }
}

建议为不同客户端显式设置不同的 STRIDE28_SEARCH_MCP_PROFILE,不要共用默认 profile。否则 Kiro、Work Buddy、本地手测会复用同一份 Chromium 持久化目录,导致“没扫码却像是已经登录”的假象。

Kiro 示例:

{
  "mcpServers": {
    "stride28-search": {
      "command": "uvx",
      "args": ["stride28-search-mcp"],
      "env": {
        "STRIDE28_SEARCH_MCP_PROFILE": "kiro"
      },
      "disabled": false
    }
  }
}

Work Buddy 示例:

{
  "mcpServers": {
    "stride28-search": {
      "command": "uvx",
      "args": ["stride28-search-mcp"],
      "env": {
        "STRIDE28_SEARCH_MCP_PROFILE": "workbuddy"
      },
      "disabled": false
    }
  }
}
用 uvx 免安装运行
{
  "mcpServers": {
    "stride28-search": {
      "command": "uvx",
      "args": ["stride28-search-mcp"],
      "disabled": false
    }
  }
}

兼容:Kiro · Cursor · Claude Code · VS Code + Copilot · 任何支持 MCP stdio transport 的客户端

可用 Tool
Tool 平台 说明
login_xiaohongshu 小红书 扫码登录,Cookie 持久化
search_xiaohongshu 小红书 关键词搜索,支持图文/视频过滤
get_note_detail 小红书 笔记详情 + 评论翻页 + 发布时间
login_zhihu 知乎 手动登录
reset_xiaohongshu_login 小红书 清空当前 profile 的登录态
search_zhihu 知乎 关键词搜索(问答/专栏/视频)
get_zhihu_question 知乎 Top N 回答,内容长度可配置
reset_zhihu_login 知乎 清空当前 profile 的登录态

search_xiaohongshu

参数 类型 默认值 说明
query string 必填 搜索关键词
limit int 10 返回条数
note_type string "all" "all" / "normal" / "video"

get_note_detail

参数 类型 默认值 说明
note_id string 必填 笔记 ID
xsec_token string "" 安全 token
max_comments int 50 最大评论数

get_zhihu_question

参数 类型 默认值 说明
question_id string 必填 问题 ID
limit int 5 回答数
max_content_length int 10000 最大字符数,0 = 不截断
错误码

所有错误返回统一 JSON,包含 retryable 字段供 agent 判断是否重试。

错误码 含义 可重试 怎么办
login_required 未登录 调用 login tool
login_timeout 登录超时 重新登录
search_timeout 搜索超时 稍后重试
search_blocked 搜索结果异常为空 检查无头模式、风控或重新登录
browser_init_failed 浏览器启动失败 stride28-search-mcp install-browser
browser_crashed 浏览器崩溃 重启 MCP Server
captcha_detected 验证码拦截 等待后重试
unknown_error 未知错误 查看日志
环境变量
变量 默认值 说明
STRIDE28_SEARCH_MCP_HOME ~/.stride28-search-mcp 数据目录
STRIDE28_SEARCH_MCP_PROFILE "" 浏览器 profile 名;为空时走兼容模式,共享默认目录,不推荐
STRIDE28_SEARCH_MCP_HEADLESS true 非登录场景是否无头运行;疑难环境可设为 false 排查
STRIDE28_RATE_LIMIT_SECONDS 2.0 请求最小间隔(秒)

首次测试建议

先确认环境:

stride28-search-mcp doctor

如果你要回到“新用户第一次安装”的状态:

stride28-search-mcp clear-state xhs
stride28-search-mcp clear-state zhihu

或一次清空全部:

stride28-search-mcp clear-state all

推荐测试顺序:

  1. 为当前客户端设置独立 STRIDE28_SEARCH_MCP_PROFILE
  2. 运行 stride28-search-mcp doctor,确认 profile、浏览器目录、cookie 库路径正确
  3. 先调用 login_xiaohongshu,不扫码时不应返回成功
  4. 再调用 search_xiaohongshu,未登录时必须返回 login_required
  5. 完成登录后再次搜索,若仍空结果会明确返回 search_blockedcaptcha_detected
  6. 知乎同理,先 login_zhihusearch_zhihu

开发

详见 ARCHITECTURE.md

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stride28_search_mcp-0.1.7.tar.gz (616.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stride28_search_mcp-0.1.7-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file stride28_search_mcp-0.1.7.tar.gz.

File metadata

  • Download URL: stride28_search_mcp-0.1.7.tar.gz
  • Upload date:
  • Size: 616.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for stride28_search_mcp-0.1.7.tar.gz
Algorithm Hash digest
SHA256 a54b0b494fb744a189068a11bf2b2f454e94c42308fe45a214fe1237cf544b65
MD5 1b76d4c9b9d6df7185f040ef55dd6008
BLAKE2b-256 82d9cd7ee5410a8f2c031c2f9df66381cdf4a3ca9d086e6403c2a16a6bd3d189

See more details on using hashes here.

File details

Details for the file stride28_search_mcp-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for stride28_search_mcp-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f1d0d16c3d910414f433b6bb82111e0b7060623291d60db9bafecac3c1c7740d
MD5 90dc04bb8d460b34b4adff8e8a1b3ec3
BLAKE2b-256 d671a16720683cc7946732f443e16e766cfe7fe92c0fc9c20611dca00c1c6462

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page