Skip to main content
Glama
cnki-deepsearch

cnki-deepsearch

by weileyao2005

CNKI DeepSearch

知网深搜 — 一次搜索,七维数据。不只是摘要。

Version License Python

CNKI DeepSearch 是一个知网学术搜索的 MCP (Model Context Protocol) 工具。在原有 cnki-search-mcp 的基础上,通过拦截 CNKI 内部 REST API,一次页面访问即可获取论文的七个维度数据:摘要、关键词、参考文献、引证文献、相似论文、关键词权重、引用统计。


与原版的区别

维度

原版 cnki-search-mcp

CNKI DeepSearch

搜索 + 摘要

✅

✅

下载 PDF

✅

✅

参考文献列表

❌

✅ 含标题/作者/来源/年份/URL

引证文献列表

❌

✅ 谁引用了这篇论文

共引 / 二级引用

❌

✅ 间接引用关系

相似论文推荐

❌

✅ CNKI 算法推荐

关键词权重

❌

✅ PUC 权重排序

知识图谱推演

❌

✅ 论文→引用→论文 多层链条

浏览器保活

❌

✅ 同 session 不重启

dual-mode

❌

✅ basic(快) / full(全)


Related MCP server: Scholar MCP

安装

pip install cnki-deepsearch

详细配置见 MCP 设置说明. 首次使用需完成 CNKI 验证码,cookie 自动保存后续无需重复验证。


工具列表

cnki_search_with_abstracts(主力)

搜索 + 自动打开每篇论文获取详细信息

mode="full" (默认): 摘要 + 关键词 + 参考文献 + 引证文献 + 相似论文 + 关键词权重
mode="basic":        仅摘要 + 关键词(快,10篇约15秒)

cnki_get_citations

获取单篇论文的引用网络:参考文献、引证文献、共引文献、二级引用
标准搜索 / 专业检索语法搜索

cnki_get_article / cnki_download

获取单篇详情 / 下载 PDF

使用示例

Full 模式搜索

用户: 搜索"流动穆斯林 教派"相关论文,max_results=3

Claude: [调用 cnki_search_with_abstracts(query="流动穆斯林 教派", max_results=3)]

返回结果示例(单篇论文):

{
  "title": "伊斯兰宗教传统的现代调适——以义乌穆斯林宗教实践为例",
  "authors": ["马艳"],
  "source": "北方民族大学学报(哲学社会科学版), 2012",
  "abstract": "伊斯兰教的宗教革新是一个在内部...",
  "keywords": ["流动穆斯林", "伊斯兰教本土化", "文化适应", "宗教革新"],
  "_counts": {
    "references": "6",
    "citations": "1",
    "co-references": "1725",
    "second-references": "216"
  },
  "references": [
    {
      "title": "伊斯兰文化",
      "authors": ["马明良"],
      "source": "甘肃人民出版社",
      "year": "2011",
      "url": "https://kns.cnki.net/kcms2/article/abstract?v=..."
    }
  ],
  "citations": [
    {
      "title": "城市穆斯林流动女工群体研究",
      "authors": ["马晓梅"],
      "source": "宁夏大学",
      "year": "2017",
      "type": "[D]"
    }
  ],
  "similar_articles": [
    {
      "title": "从塞姆石堆到资源博弈——中国东南穆斯林...",
      "source": "世界宗教研究",
      "year": "2026"
    }
  ],
  "keyword_domains": [
    {"keyword": "伊斯兰教", "weight": "19"},
    {"keyword": "流动穆斯林人口", "weight": "15"},
    {"keyword": "穆斯林", "weight": "13"}
  ]
}

知识图谱链条推演

用户: 从马艳的论文出发,沿着引证文献链条往下挖三层

Claude:
  马艳(2012) → 被引 ← 《城市穆斯林流动女工群体研究》(2017)
    → 参考文献 → 《伊斯兰教社会学》(2001, 被引661次)
      → 引证文献 → ...

通过论文的 references 和 citations 字段,可以无限层地沿着引用关系遍历知识图谱。


技术架构

┌─────────────────────────────────────────┐
│              MCP Server                  │
│  server.py  — 工具定义 + handler         │
├─────────────────────────────────────────┤
│           Browser Automation             │
│  browser.py — Playwright (Edge/Chromium) │
│  · 搜索导航 + 验证码处理                  │
│  · 页面滚动触发懒加载                     │
│  · 拦截 citation-api 响应                │
│  · 拦截 recommend/similar 响应            │
│  · 拦截 starter/domains 响应             │
│  · 浏览器单例 + 健康检查 + 自动重连       │
├─────────────────────────────────────────┤
│              Data Parsing                │
│  parser.py — BeautifulSoup + JSON        │
│  · parse_search_results()                │
│  · parse_article_detail()                │
│  · parse_citation_api_response()   ← NEW │
│  · parse_similar_articles()        ← NEW │
│  · parse_domains()                 ← NEW │
├─────────────────────────────────────────┤
│           Query Builder                  │
│  query_builder.py — CNKI 专业检索语法     │
└─────────────────────────────────────────┘

核心原理:API 拦截

CNKI 论文详情页在滚动到底部后,会自动调用内部 REST API:

restapi/citation-api/v1/literature/references    ← 参考文献
restapi/citation-api/v1/literature/citations     ← 引证文献
restapi/citation-api/v1/literature/quotations/metrics ← 引用统计
openapi/usercenter-api/v1/recommend/similar/articles ← 相似论文
restapi/citation-api/v1/literature/starter/domains    ← 关键词权重

我们通过 Playwright 的 page.on("response") 拦截这些响应,直接解析 JSON,完全避开 CNKI 的 DOM 懒加载、JS 重置、CSS 隐藏等反爬机制。

浏览器保活

async def get_browser():
    if _browser is not None:
        if _browser._browser.is_connected():  # 健康检查
            return _browser                   # 复用
        _browser = None                       # 死了,重建
    _browser = await create_browser()         # 首次启动
    return _browser

同一 MCP session 内浏览器只启动一次,验证码只做一次。


探索历程

  1. DOM 方案(失败):尝试点击引用 Tab、MutationObserver 监听 DOM 变化、150ms 轮询 div.list_item。CNKI 的懒加载 + 数据闪现 1 秒后 JS 重置,DOM 方案全军覆没。

  2. 全量抓包对比(转折):写脚本 dump 页面加载时的全部 130 条 HTTP 响应,对比"滚动到底部"和"不滚动"的差异。发现不滚动时 citation-api 调用量为 0,滚动后暴增到 17 条。确认引用数据走的是内部 REST API 而非 DOM 渲染。

  3. API 拦截方案(成功):不再碰 DOM,直接用 page.on("response") 拦截 citation-api、recommend/similar、starter/domains 三组端点的 JSON 响应。一次页面访问 6.5 秒拿完全部七个维度的数据。同时发现页面默认只加载参考文献,引证文献需要点一下 Tab 触发,其他间接引用同理。

  4. 链条推演验证:用搜到的论文 URL 直接跳转,获取其引用网络,再跳转,验证了"论文 A → 引证文献 → 论文 B → 参考文献 → 论文 C"的多层知识图谱遍历完全可行。


License

MIT

致谢

  • 原版 cnki-search-mcp 提供了搜索和浏览器自动化的基础框架

  • CNKI(中国知网)提供了丰富的中文学术资源

Available Tools

16 tools
cnki_co_clickA

在协作浏览器中点击目标。target 支持三种写法:

  • 可见文本(默认):如"南传佛教"(点中文本所在元素/链接)

  • row:N:搜索结果列表第 N 条(N 从 1 起,自动点标题链接)

  • css:选择器:任意 CSS 选择器

注意:点击会真实发生在用户可见的窗口里,操作前应先告知用户。

Inputs: target (required), index.

cnki_co_closeA

关闭协作窗口(只关用户页,浏览器进程与登录态保持)。

Inputs: no named parameters.

cnki_co_navigateA

让协作浏览器中指定标签页(默认用户页)跳转到指定 URL。遇到验证码时会等待用户在窗口中手动完成。

Inputs: url (required), index.

cnki_co_openA

打开协作浏览器窗口(可见、自动机构登录、常驻不关)。这是协作模式的起点:调用后浏览器窗口会在用户屏幕上出现,用户可以自由搜索/点击;AI 通过 cnki_co_read/cnki_co_click 等工具读取和操作同一个窗口。

【协作模式协议,必读】

  1. 回合制:AI 只在被调用时看/操作浏览器,回合之间窗口完全归用户。

  2. AI 动手操作前,先口头告知用户(例如"我准备点开第3篇")。

  3. 标签页序号从左到右,从 0 开始(cnki_co_tabs 会返回标题确认)。

  4. 如果窗口已打开,重复调用只是返回当前状态,不会打断用户。

Inputs: no named parameters.

cnki_co_readA

读取协作浏览器中指定标签页(默认用户当前页)的内容,按页面类型结构化返回:

  • 搜索结果页 → results[](题名/作者/来源/时间/类型/被引)

  • 文章详情页 → detail(标题/作者/摘要/关键词/DOI)

  • 其他页面 → text(正文文本)

读取是后台操作,不会切换用户的窗口焦点。

Inputs: index, max_chars.

cnki_co_statusA

查看协作模式当前状态:窗口是否打开、是否可见(有头)、当前所有标签页。适合在不确定窗口状态时先查一下。

Inputs: no named parameters.

cnki_co_switchA

把指定标签页切到前台(窗口焦点跟随)。

Inputs: index (required).

cnki_co_tabsA

列出协作浏览器当前所有标签页:序号(0 起,从左到右)、标题、网址、是否聚焦。用户说"看第N个标签页"时,先调用此工具确认序号对应哪一页。

Inputs: no named parameters.

cnki_co_typeA

在协作浏览器的输入框中输入文字。into 默认知网一框式搜索框,可传任意 CSS 选择器指定其他输入框。

Inputs: text (required), into, index.

cnki_downloadA

下载知网论文PDF。输入文章详情页URL,自动点击下载按钮并保存到downloads/目录。需要机构登录权限。

Inputs: url (required).

cnki_get_articleA

获取知网文章详细信息。输入文章URL,返回标题、作者、摘要、关键词等。

Inputs: url (required).

cnki_get_citationsA

获取知网论文的引用网络信息(参考文献和引证文献列表)。输入文章详情页URL,返回该论文的参考文献、引证文献等引用数据。可选参数 tabs 指定要获取的引用类型。

Inputs: url (required), tabs.

cnki_search_with_abstractsA

搜索知网CNKI学术文献并自动获取每篇论文的详细信息。与cnki_search使用相同的搜索参数,支持两种模式: full(默认): 摘要+关键词+参考文献+引证文献+相似论文+关键词权重,一次页面访问全部获取,10篇约40-60秒 basic: 仅摘要+关键词,速度快,10篇约15-20秒

Inputs: query (required), mode, field, author, +5 more.

cnki_syntax_guideA

获取CNKI专业检索表达式的完整语法参考。在构造复杂检索表达式之前,先调用此工具获取字段代码、匹配运算符、逻辑运算符、比较运算符、位置描述符等完整说明。

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 16 tools

    Disambiguation4/5

    Most tools have clear boundaries: search variants (cnki_search, cnki_professional_search, cnki_search_with_abstracts) are differentiated by usage mode and output detail, while cnki_get_article and cnki_co_read both retrieve article info but from explicit URL vs. current browser tab. Minor overlap persists between search and professional search, but the descriptions and parameter differences prevent serious misselection.

    Naming Consistency4/5

    All tools share the cnki_ prefix, and the verb_noun pattern is mostly followed (read, click, type, navigate, close, search, download, get_citations). A couple of noun-based names (cnki_co_tabs, cnki_syntax_guide) and the co_ subprefix for collaborative tools introduce slight inconsistency, but the grouping actually aids understanding.

    Tool Count5/5

    At 16 tools, the server is substantial but well-scoped for a domain that spans both direct CNKI API-style operations and an interactive collaborative browser mode. No obvious redundancy, and each tool maps to a needed capability for searching, retrieving, downloading, or managing shared browser sessions.

    Completeness4/5

    The toolset covers the full research workflow: natural-language and professional search, detailed article retrieval, abstract enrichment, citation tab access, PDF download, and collaborative browsing. Minor gaps exist (e.g., no explicit bookmark/favorite or batch export tool), but these are not core to the apparent purpose of 'CNKI deep search' and can be worked around via the browser tools.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Unified academic search MCP server that searches open literature (arXiv, bioRxiv, medRxiv, PMC), CNKI, and Web of Science, with browser-backed authentication, local paper library, and export to multiple formats.
      21
      2
      MIT
    • F
      license
      A
      quality
      A
      maintenance
      Scholar MCP connects your agent to academic search, citations, primary text and figures, and an optional local research library. Source keys are optional.
      6
      1,230 PyPI
      9
      -
    • A
      license
      A
      quality
      D
      maintenance
      Academic paper search and retrieval MCP server integrating multiple scholarly platforms into a unified interface. Supports search, fetch, trend analysis, and literature review workflows.
      8
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      SERP-free scholarly search MCP server that queries academic sources like arXiv, Semantic Scholar, and conference proceedings using official APIs and reverse-engineered endpoints, with no API keys required. It supports unified conference search and returns normalized paper metadata.
      2
      MIT