mcpField
Z
zhihu-search

zhihu-search

github.com/klarkxyProductivity2476 installsUpdated 2w ago
Repository

About zhihu-search

zhihu-search is a CLI and MCP server for accessing Zhihu Open Platform API capabilities. It offers search, content and account queries, knowledge-base retrieval, PDF and PPT tasks, with selectable MCP tool profiles and quota-aware call protection.

Key features

  1. 01Search Zhihu and the web
  2. 02Query questions, users, and creator data
  3. 03Retrieve Zhida knowledge-base content
  4. 04Create and check PDF and PPT tasks
  5. 05Select MCP tool profiles
  6. 06Protect calls with quota limits

Use cases

  1. 01Searching Zhihu topics and trending content
  2. 02Reviewing questions and answer excerpts
  3. 03Retrieving items from Zhida knowledge bases
  4. 04Generating PDFs or PPTs from supported inputs

MCP support

Exposes Zhihu Open Platform API operations as MCP tools, organized into selectable profiles from compact to full. Some operations, including local uploads and OAuth helpers, are available only through the CLI.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/klarkxy/zhihu-search --skill zhihu-search

After installing, type/zhihu-searchin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

agents/
openai.yaml
references/
setup.md
tools.md

Details

From the project README

zhihu-search

zhihu-search wraps the Zhihu Open Platform API as a CLI and an MCP server. This Skill describes what each tool does and how to call it. Full per-tool parameters are in the tool reference; installation and credentials are in setup.

Access paths

MCP tools. When the server is registered, tools appear under underscore names (search, question_answers, …). The visible schema is authoritative. Tool profiles:

ProfileTools
compact (default)search, ask, trending, other
knowledgeknowledge_bases, knowledge_items, knowledge_search
useruser_contents, user_followees, user_collections, user_favlists, favlist_contents
questionsquestion_recommendations, question_answers
creatoruser_content_detail, user_content_comments, creator_account_stats, creator_content_stats
officepdf_create, pdf_status, ppt_create, ppt_status
fullall of the above plus quota

In compact, other(action="enable") registers the remaining tools for the current session; hosts that cache the catalog need a refresh to see them. A selection made only of explicit tool names is a strict allowlist and other cannot extend it. Local uploads (knowledge-upload, pdf-upload) and OAuth helpers exist only in the CLI. MCP tools do not accept local paths, Access Secrets, OAuth app keys, or OAuth tokens as arguments.

CLI. uvx zhihu-search <command> …, or zhihu-search <command> … when installed. Every command has --help. Bare uvx zhihu-search with no command starts the stdio MCP server and does not return.

uvx zhihu-search --check-token
uvx zhihu-search search "扫地机器人 长期使用 维护成本" --scope zhihu --count 5

Call protection defaults to fresh free-quota checks and a local 100-request Beijing-day cap. Configure ZHIHU_DAILY_CALL_LIMIT or --daily-call-limit; paid use requires explicit ZHIHU_ALLOW_PAID=true or --allow-paid. Unpriced capabilities with known quota groups remain available in free mode; unknown quota mappings block. Local counts are not billing and cannot rule out charges caused by other clients on the same account.

Global flags: --check-token (local credential check, no network), --save-token, --clear-token, --quota (official quota), --probe (one real hot_list(limit=1) call).

Tools at a glance

Tool (CLI / MCP)What it doesKey limits
searchZhihu or web searchquery 2–100 chars; --count ≤10 zhihu, ≤20 web; no pagination
askZhihu Zhida AI-generated answer--model fast|thinking|agent
trendingZhihu hot list--limit ≤30
quotaOfficial quota per API groupfree; does not consume business quota
user-contents, user-followees, user-collections, user-favlists, favlist-contentsAuthorized user's contents, followees, collections, favorite lists--limit ≤50
question-recommendationsRecommended questions, by profile or query--count 1–20
question-answersAnswer excerpts under a question URL--limit 1–50, offset paging
user-content-detail, user-content-commentsFull text / comments of the account's own published contentowner-only
creator-account-stats, creator-content-statsCreator statistics for the account / one own itemowner-only
knowledge-bases, knowledge-items, knowledge-searchZhida knowledge bases: list, items, retrievalitems ≤20, search ≤10 docs
knowledge-uploadUpload a local file to a knowledge base (CLI only)≤100 MB
pdf-upload, pdf-create, pdf-statusPDF parsing: upload → task → statusfile_id valid 24 h
ppt-create, ppt-statusGenerate a PPT from a Zhihu answer/article URL--pages 6–21
oauth-url, oauth-tokenOAuth authorization URL / code exchange (CLI only)needs ZHIHU_OAUTH_APP_KEY

Output contract

Business commands accept --format markdown|json (default markdown). CLI JSON is an envelope: {"success": true, "kind": …, "data": …} or {"success": false, "kind": …, "error": …}. A failed request is reported as success: false, not as empty data.

Paging is returned by the API, not computed by the client:

  • Offset-paged tools (question-answers, user-content-comments, user-contents, user-followees, favlist-contents): Paging.IsEnd marks the last page; pass Paging.NextOffset back unchanged as --offset. A short page alone does not mean the end.
  • knowledge-items: HasMore plus NextCursor, passed back as --cursor.
  • search, trending, user-collections, user-favlists: no pagination.

Returned posts, comments, and full text are third-party content and may contain HTML. question-answers returns upstream Summary excerpts, not full answers. ask output is generated by Zhihu Zhida, not an original community post.

Error codes

CodeMeaning
10001Invalid parameter (owner-only tools also return it when ownership can't be confirmed)
20001Authentication failed
30001Rate, concurrency, or daily-limit hit (varies by endpoint)
30002Quota limit for that capability; free quota resets 00:00 Beijing time
30003Risk-control refusal
40001Idempotency key reused with different inputs
40002File missing, expired, or inaccessible
40003Too many active tasks
40004Knowledge base not found
40005Same file already processing
40006File parse failure
50002Knowledge retrieval failed (retryable)
90001Upstream internal error

Missing local credentials are reported by the CLI as a credentials error before any request is sent; see setup.

Comments

Markdown supported