cnki-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cnki-mcp Find recent CNKI papers on AI in education and export GB/T 7714 citations."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cnki-mcp
English | 简体中文
A Model Context Protocol (MCP) server for CNKI (China National Knowledge Infrastructure) built on Playwright browser automation and native CNKI endpoints.
Beyond full literature search, professional search expressions, article details, citation networks, batch GB/T 7714 / EndNote citation export, and full-text PDF downloads, cnki-mcp provides exact journal navigation (navi.cnki.net), non-expiring permanent journal URLs (permanent_url), login-free official RSS 2.0 feeds (rss_url), batch OPML 2.0 export, indexing/impact-factor inspection, and single/multi-issue/full-year TOC traversal. This eliminates the fuzzy-matching cross-journal pollution common in CNKI's LY source filter (e.g., distinguishing 教育研究 from 高等教育研究 or 比较教育研究).
It also features an adaptive three-stage authentication workflow (silent campus IP auto-reauthentication -> on-demand off-campus CARSI institutional SSO popup with optional institution auto-selection -> dismissal cooldown), automatic CAPTCHA popup recovery, 0600 storage_state persistence, dynamic real Chrome User-Agent alignment, and a cnki_status network/auth diagnostic tool.
Features (13 MCP Tools)
Journal Navigation, Issue TOC & RSS / OPML Feeds
Tool | Description |
| Search journals on |
| Fetch journal metadata, non-expiring |
| Extract table of contents (TOC) by journal detail URL or exact title (latest/online-first, single issue, multi-issue batch, or full-year traversal) with optional original cover/TOC PDF download. |
| Resolve permanent homepages and official RSS 2.0 feeds for a list of journals and export a standard OPML 2.0 file ready for Folo, NetNewsWire, Reeder, or Inoreader. |
Literature Search, Citations & Full-Text Retrieval
Tool | Description |
| Search academic papers with natural-language modifiers ( |
| Run raw CNKI expert/professional query expressions (using unquoted integer years, e.g., |
| Return the complete CNKI professional search syntax guide (field codes, operators, proximity operators, and examples) with zero browser overhead. |
| Fetch detailed paper metadata (non-expiring KCMS |
| Batch-search and enrich papers: |
| Batch-export |
| Extract reference, citation, co-reference, and secondary reference/citation networks plus counts. |
| Download full-text PDFs (silent headless download on campus/campus-VPN; automatic CARSI SSO popup and resume off-campus). |
Network & Authentication Diagnostics
Tool | Description |
| Inspect CNKI's view of the current egress IP ( |
Related MCP server: HUST CNKI Research MCP
Permanent Journal URLs, Official RSS 2.0 & OPML 2.0
Non-expiring
permanent_url: Constructed from CNKI's canonical journal identifier (baseid, e.g.JYYJ,YWZG) ashttps://navi.cnki.net/knavi/journals/<BASEID>/detail?uniplatform=NZKPT, avoiding expiring?p=...search links.Login-free official RSS 2.0 (
rss_url):https://rss.cnki.net/knavi/rss/<BASEID>?pcode=CJFD,CCJDreturns standard RSS 2.0 XML directly without cookies or campus IP access.One-shot OPML 2.0 export (
cnki_journal_opml): Pass a list of journal titles or URLs to verify metadata and generate an OPML 2.0 bundle for Folo, NetNewsWire, Reeder, Inoreader, and any standard RSS reader.
Installation
Requirements: Python >= 3.11 and local Google Chrome (or Playwright's bundled Chromium).
# Clone and install development/runtime dependencies
git clone https://github.com/yhong91/cnki-mcp.git
cd cnki-mcp
uv sync
# If Google Chrome is not installed locally, install Playwright Chromium
uv run playwright install chromiumInstall the global cnki-mcp CLI tool via uv:
# Install directly from GitHub
uv tool install git+https://github.com/yhong91/cnki-mcp
# Or install in editable mode from a local clone
uv tool install --editable .Adaptive Authentication & CLI Usage
1. Three-Stage Adaptive Auth (Campus Silent vs. Off-Campus CARSI)
Cached / Campus Direct Pass-Through: With a valid session or fresh campus IP authorization, searches, TOC downloads, and full-text PDF downloads run silently in headless mode with zero popups.
Silent Headless IP Re-Authentication: If a download hits a login gate (for example, when persisted
~/.cnki_state.jsonstill contains an expiredLIDorEcp_notFirstLogincookie),cnki-mcpfirst clears stale login cookies and silently triggers CNKI IP login in the background. On campus networks or split-tunneled campus VPNs, fresh institutional cookies are acquired within ~2 seconds with zero popups.Off-Campus CARSI Popup with Optional Institution Auto-Select: Only when silent IP login confirms no campus IP authorization (and a desktop GUI is available with
CNKI_AUTO_AUTH=1), a visible browser window openshttps://fsso.cnki.net/. IfCNKI_CARSI_ORGis configured (e.g.北京大学), it automatically jumps straight to your university's identity provider login page. After login, cookies andlocalStorageare hot-reloaded into the headless browser and the download resumes automatically. Closing the window activates a cooldown (CNKI_AUTH_COOLDOWN, default120s) so batch downloads do not spam repeated popups.
Automatic CAPTCHA Recovery: Slider/puzzle/click-word CAPTCHAs or HTTP
403risk-control redirects automatically open a visible browser window on desktops so you can complete verification once and resume seamlessly.Session Persistence (
0600): Full Playwrightstorage_state(cookies +localStorage) is saved with0600permissions to~/.cnki_state.json(with legacy sync to~/.cnki_cookies.json).Headless Remote Servers: On Linux servers without
DISPLAY/WAYLAND_DISPLAY(or withCNKI_AUTO_AUTH=0), no GUI window is attempted; structuredlogin_required/captcha_requiredresponses are returned instead.
2. CLI Commands
# Print version
cnki-mcp --version
# Manually open CNKI CARSI institutional external login (https://fsso.cnki.net/)
cnki-mcp --auth --carsi
# Open default CNKI navigation page to complete CAPTCHA or manual login
cnki-mcp --auth
# Open a custom CNKI URL for verification/login
cnki-mcp --auth --url "https://kns.cnki.net/kns8s/search"
# Start MCP stdio server
cnki-mcpEnvironment Variables
Variable | Default | Description |
|
| Set to |
|
| Preferred browser channel; falls back to Playwright Chromium if unavailable |
|
| Full |
|
| Legacy cookie list file path ( |
|
| Enable automatic desktop popup on off-campus login or CAPTCHA ( |
|
| Single popup wait timeout in milliseconds |
|
| Cooldown in seconds after closing/cancelling a login popup ( |
| (empty) | Optional university name on |
|
| Directory for downloaded PDFs and TOC files (recommended to set an explicit path such as |
MCP Client Configuration
Compatible with Claude Desktop, Cursor, Claude Code, Windsurf, and any stdio MCP client.
Option 1: Globally Installed via uv tool install (Recommended)
{
"mcpServers": {
"cnki-mcp": {
"command": "cnki-mcp",
"env": {
"CNKI_BROWSER_CHANNEL": "chrome",
"CNKI_HEADED": "false",
"CNKI_CARSI_ORG": "Your University Name",
"CNKI_DOWNLOAD_DIR": "~/Downloads/cnki"
}
}
}
}Option 2: Run Directly from a Local Source Clone
{
"mcpServers": {
"cnki-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/cnki-mcp",
"run",
"cnki-mcp"
],
"env": {
"CNKI_DOWNLOAD_DIR": "~/Downloads/cnki"
}
}
}
}Tip: If your MCP client or gateway supports a per-server tool call timeout, setting it to
180seconds ensures off-campus CARSI QR sign-in and large thesis PDF downloads complete without premature timeouts.
Project Architecture
src/cnki_mcp/
├── __init__.py # Package version
├── _utils.py # Shared whitespace & Playwright page safety helpers
├── config.py # BrowserConfig dataclass & environment variable parsing
├── session.py # Storage state, 0600 cookie persistence, UA alignment & status parsing
├── browser.py # CNKIBrowser lifecycle, stealth, CAPTCHA & adaptive IP/CARSI auth
├── query_builder.py # Natural query parser & CNKI professional search expression builder
├── journal_parser.py # Pure offline navi.cnki.net HTML, RSS/permanent URL & OPML parsers
├── journal.py # Playwright journal search, detail, TOC traversal & OPML export
├── papers_parser.py # Pure offline kns.cnki.net HTML, citation API & GetExport parsers
├── papers.py # Playwright paper search, details, citations, export & PDF download
└── server.py # MCP Server tool schemas, dispatcher & CLI entrypointDevelopment & Testing
uv sync --frozen --dev
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run pytest -v -W errorAcknowledgements
This project draws inspiration and CNKI endpoint/DOM parsing experience from the following open-source repositories:
weileyao2005/cnki-deepsearch — Inspiration for CNKI academic search, professional search expression building, and MCP tool architecture.
cookjohn/cnki-skills — Reference for
navi.cnki.netjournal navigation, indexing/TOC extraction, original TOC reader handling, and CNKI'sGetExportcitation export endpoint.l0o0/jasminum — Community insights on CNKI thesis metadata extraction, permanent KCMS links, and CNKI page structure quirks.
Also built with thanks to Model Context Protocol Python SDK, Playwright, and BeautifulSoup4.
Compliance & Disclaimer
This project is intended strictly as a personal academic search, journal TOC tracking, and bibliography management helper relying on your own legitimate campus network, CARSI, or personal CNKI subscription.
It does not contain any paywall bypass, access-control circumvention, or automated CAPTCHA-solving mechanism; whenever authentication or security verification is required, it is handed to the user in a visible browser window.
Please comply with CNKI's Terms of Service and applicable laws, maintain reasonable request rates, and do not use this tool for large-scale commercial scraping or unauthorized redistribution.
License
Released under the MIT License.
Available Tools
13 toolscnki_downloadA
下载知网论文全文 PDF 并保存到下载目录。校园网内自动静默下载;非校园网未登录时桌面端自动弹出高校 CARSI 登录窗口待命续传(无界面环境可用 cnki-mcp --auth --carsi 完成认证)。
Inputs: url (required).
cnki_export_citationsA
批量导出知网文献的标准引文格式(GB/T 7714 国标参考文献文本、EndNote 题录及结构化元数据)。支持传入 cnki_search 返回的 export_ids 列表(极速无需打开详情页)或文章详情页 urls 列表。
Inputs: urls, export_ids.
cnki_get_articleA
获取单篇知网论文详情(标题、作者、机构、来源期刊、发表时间、卷期页码、摘要、关键词、基金、DOI、永久链接、GB/T 7714 引文及博硕士学位论文导师/学科专业字段),可选设置 include_citations=True 在同一次访问中提取引文统计、参考文献与引证文献。
Inputs: url (required), include_citations.
cnki_get_citationsB
获取知网论文的参考文献与引证文献网络。支持按 tabs 指定提取类型(references、citations、coreferences、secondreferences、secondcitations)。
Inputs: url (required), tabs.
cnki_journal_detailA
获取知网期刊详情页基本信息、不过期的永久期刊主页(permanent_url)、免登录官方 RSS 2.0 订阅地址(rss_url)、核心收录数据库(北大核心/CSSCI/CSCD/AMI/WJCI/SCI/EI 等)、复合/综合影响因子及全部可用年份与期次列表(available_years)。
Inputs: journal (required).
cnki_journal_opmlA
批量获取多本知网期刊的永久主页(permanent_url)与官方免登录 RSS 2.0 订阅源(rss_url),并生成标准 OPML 2.0 订阅文件(可直接导入 Folo / NetNewsWire / Reeder 等阅读器)。
Inputs: journals (required), title, output_path.
cnki_journal_searchA
在知网出版物导航(navi.cnki.net)按刊名、ISSN、CN 号或主办单位检索期刊。刊名精确匹配项会自动排在最前;设置 exact=True 可仅返回精确匹配结果,防止近似刊名串刊。
Inputs: query (required), exact, max_results, search_type.
cnki_journal_tocA
按知网期刊详情页 URL 或精确刊名获取期次论文目录(TOC),同时返回不过期的永久期刊主页(permanent_url)与免登录官方 RSS 2.0 订阅地址(rss_url)。支持获取最新期/网络首发、指定单期、同一年多期批量提取或全年各期遍历,返回每篇论文标题、作者、页码、栏目、详情链接及原版目录链接,可选下载原版封面目录 PDF(校园网内自动静默下载;非校园网未登录时桌面端自动弹出高校 CARSI 登录窗口待命续传,无界面环境可用 cnki-mcp --auth --carsi)。
Inputs: journal (required), year, issue, issues, +2 more.
cnki_professional_searchA
使用 CNKI 专业检索语法表达式直接检索学术论文。格式:<字段代码> <匹配运算符> '<检索值>'(数值型年份字段 YE 使用无引号整数),以 AND / OR / NOT 组合,例如:SU %= '人工智能' AND LY = '教育研究' AND YE BETWEEN (2020, 2025)。
Inputs: expression (required), max_results.
cnki_searchB
检索知网(CNKI)学术论文。支持自然语言修饰词(作者:、关键词:、单位:、基金:、来源:、篇名:、摘要: 及年份区间)与结构化筛选参数,支持 source + exact_source 精确文献来源过滤以防近似刊名串刊,返回每条结果的元数据与导出标识(export_id)。
Inputs: query (required), fund, field, author, +7 more.
cnki_search_with_abstractsA
检索知网论文并自动批量补全详情:basic 模式(默认)通过知网批量导出接口秒级获取摘要、关键词与 GB/T 7714 引文;full 模式提取完整引文网络信息(含参考文献与引证文献)。支持与 cnki_search 相同的全部筛选参数。
Inputs: query (required), fund, mode, field, +8 more.
cnki_statusA
查看知网(CNKI)视角下的当前网络出口与机构认证状态(避免通过第三方测 IP 网站或本机网卡误判代理分流)。默认 probe=False 仅读取本地/内存会话状态(0 网络请求、不消耗风控配额);设置 probe=True 时通过独立无痕会话向知网认证服务实测当前出口是否具备校园网 IP 机构权限,且不会清除已有的校外 CARSI 登录态。
Inputs: probe.
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
Scored across 13 tools
Three overlapping search entry points exist (cnki_search, cnki_professional_search, cnki_search_with_abstracts), and the latter explicitly mirrors cnki_search's parameters, so an agent must reason carefully about which to call. Citation retrieval is also split between cnki_get_citations and cnki_get_article(include_citations=True), and cnki_journal_detail vs cnki_journal_opml both return permanent_url/rss_url. Descriptions do disambiguate each case, but the boundaries are not self-evident from names alone.
All names are snake_case with a consistent cnki_ namespace prefix, and most follow a verb_noun pattern (get_article, download, export_citations, journal_search). A few deviate into noun_phrase style (syntax_guide, journal_toc, journal_opml, status) and the prefix ordering shifts between cnki_<verb>_<noun> and cnki_journal_<noun>. Minor deviations only; overall predictable.
13 tools is well within the sweet spot and each maps to a concrete capability: search, article detail, citations, download, journal navigation/TOC/RSS, export, and auth status. No obviously redundant or filler tool given the breadth of the CNKI domain (articles, journals, subscription feeds, campus auth).
The surface covers the full research workflow: discovery (plain + professional search), enrichment (abstracts/citations), full-text download, journal-level TOC and RSS/OPML subscription, citation export, and auth diagnostics. Minor gaps remain around author/institution-centric lookup, saved-library operations, and batch full-text download, but these are workaroundable via the syntax search and export tools.
Maintenance
Related MCP Connectors
Academic literature search, retrieval, and private library management on top of OpenAlex.
Federated search of books and papers, BibTeX/RIS citations, open-access retrieval and reading.
Catch AI-fabricated citations (real DOI + fake title). Retraction, open-access, 10,000+ CSL styles.
Search and download academic papers from arXiv, PubMed, bioRxiv, medRxiv, Google Scholar, Semantic…
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search CNKI (China National Knowledge Infrastructure), download PDFs, and import them into Zotero with automatic PDF attachment.38MIT
- FlicenseAqualityDmaintenanceEnables AI agents to search, read, and cite Chinese academic papers from CNKI using HUST single sign-on, with support for full-text retrieval, BibTeX export, and PDF download.74-
- AlicenseAqualityBmaintenanceEnables AI to search, filter, and process CNKI academic literature through natural language, including structured search, metadata retrieval, full-text reading, citation export, and PDF/CAJ download.917GPL 3.0
- AlicenseAqualityBmaintenanceEnables AI agents to search, read, batch-download, and cite CNKI papers using institutional IP recognition or Shibboleth/CARSI single sign-on, with local PDF parsing, caching, and Zotero library lookup.17MIT