Borrowing it
Nothing to install: this file belongs to alizeeblack-code/zhihu-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/alizeeblack-code/zhihu-mcp/main/CLAUDE.mdgit clone --depth 1 https://github.com/alizeeblack-code/zhihu-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/alizeeblack-code/zhihu-mcp/claude-md)<a href="https://agentmods.dev/instructions/alizeeblack-code/zhihu-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/alizeeblack-code/zhihu-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/alizeeblack-code/zhihu-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/alizeeblack-code/zhihu-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00827 | $0.00827 |
| Opus 5.5 | $0.00331 | $0.00331 |
| Sonnet 5.5 | $0.00165 | $0.00165 |
| Haiku 4.5 | $0.00083 | $0.00083 |
Grade A, and why
zhihu-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
CLAUDE.md
本项目使用中文作为主要沟通语言。提交说明、文档、注释优先使用中文。
项目概述
zhihu-mcp 是一个知乎 MCP 服务器,让 AI Agent 能与知乎交互。基于 Playwright + stealth 反检测驱动 headless Chromium 抓取知乎页面。
关键架构
- mcp_server.py — FastMCP 入口,注册所有 MCP 工具
- scraper.py — 核心 DOM 提取,所有 JS 在
page.evaluate()中执行 - browser/manager.py — Playwright 浏览器生命周期(persistent/non-persistent context)
- browser/stealth.py — 反检测 JS 注入(navigator.webdriver 覆盖、Canvas 噪声等)
- pinchtab_client.py — Pinchtab HTTP 后端(备用,当前未使用)
- cookies/manager.py — Cookie 加载/保存/提取
- storage.py — SQLite 活动数据存储
- config.py — 配置管理(BrowserConfig dataclass)
重要约束
page.evaluate() 只支持标准 CSS/JS
Playwright 伪选择器(:has-text()、:visible 等)在 page.evaluate() 内无效。必须用标准 DOM API:
// 错误:document.querySelector('button:has-text("评论")')
// 正确:
for (const b of document.querySelectorAll('button')) {
if (b.textContent.includes('评论')) { b.click(); break; }
}
知乎 DOM 选择器(已验证)
| 元素 | 选择器 | 注意 |
|---|---|---|
| 回答作者 | .AuthorInfo-content .UserLink-link |
跳过空头像链接(遍历取首个有文本的) |
| 点赞数 | button[aria-label*="赞同"] |
解析 aria-label 属性,不是 textContent |
| 评论数 | .ContentItem-actions button 含 "条评论" |
不要用全局 button,会匹配到问题级评论按钮 |
| 评论内容 | .CommentContent |
文本直接在元素内,作者在父元素的兄弟节点 a[href*="/people/"] |
| 回答数 | .List-headerText |
数字含逗号(1,003),需 replace(/,/g, '') |
| 回答页多按钮 | 回答页同时显示多个回答 | 用 .ContentItem-actions 限定作用域,避免取到其他回答的数据 |
评论 URL 匹配
get_comments 判断是否需要导航时,必须比较完整路径(url.split('?')[0]),不能截断比较——同一问题下不同回答 URL 前缀相同。
代理绕过
浏览器启动参数包含 --proxy-bypass-list=*.zhihu.com,zhihu.com,*.zhimg.com,访问知乎时不走系统代理。
开发与测试
- 测试脚本在
tests/目录(已 gitignored) tests/test_core.py是主要的集成测试脚本- 默认使用 headless 模式(
config.browser.headless = True),调试时可改为False - 需要有效的
cookies.json(含z_c0认证 token)才能正常抓取
已知限制
- 搜索功能(SPA 渲染)不稳定,
wait_for_selector时机问题 - 问题页仅加载首屏约 5 条回答,更多需要实现滚动加载
- CSS Modules 类名(如
css-14nvvry)不稳定,不要依赖
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 60 lines · 827 tokens per session scan A 80962bf073b6
zhihu-mcp CLAUDE.md is an instructions file published in the GitHub repository alizeeblack-code/zhihu-mcp (5 stars, last pushed 8mo ago), licensed MIT. It adds 827 tokens to every session, about $0.0033 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
zhihu-mcp CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| zhihu-mcp CLAUDE.mdalizeeblack-code/zhihu-mcp | Instructions file | 5 | 8mo ago | MIT | A | 827 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,516 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| vscode model-prompts.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 2,022 | GitHub Copilot |