baidu-scholar-mcp
百度学术论文查询 MCP server:输入论文标题(支持部分标题/关键词)→ 搜索候选列表 → 调用方大模型挑选 → 返回该论文完整详情。
- 纯标准库实现 stdio JSON-RPC,不依赖任何 MCP SDK,运行时仅需
curl-cffi - 内置反爬自愈:Chrome TLS 指纹模拟(curl_cffi)+ cookie 自举 + 多级重试,无需浏览器
- 自带两套自测(爬虫 13 项 + MCP 协议 8 项),拿到代码一键验证环境可用性
⚠️ 免责声明:本项目为非官方工具,基于对百度学术公开网页接口的逆向分析实现, 仅供个人学习与研究使用。使用时请遵守目标网站的服务条款,禁止用于商业用途或高频抓取。 百度接口随时可能变更,不保证本工具持续可用;因使用本工具产生的任何问题由使用者自行承担。
MCP 工具
| 工具 | 说明 |
|---|---|
search_papers(query, max_results=10) |
按标题搜索,返回候选列表:paperid、标题、作者+机构、年份、期刊卷期页、被引、关键词、截断摘要、知网/万方/维普等来源链接。恰好只命中 1 篇时自动附带 paper_detail |
get_paper_detail(paperid) |
完整摘要、关键词、作者、期刊(卷/期/页码/ISSN/CN)、被引、DOI、基金、阅读量、研究领域、全部外部全文链接 |
get_paper_citations(paperid, cite_type) |
参考文献(reference)/ 引证文献(citation)列表 |
典型调用流程(由调用方大模型完成"挑选"):search_papers("新技术革命下人工智能与高质量增长")
→ 从候选里选最匹配的 paperid → get_paper_detail(paperid)。
安装与配置
方式一:uvx(推荐,零安装)
发布到 PyPI 后,MCP 客户端配置一行即可(uv 会自动拉取并隔离运行):
{
"mcpServers": {
"baidu-scholar": { "command": "uvx", "args": ["baidu-scholar-mcp"] }
}
}
方式二:pip 安装后直接作命令
pip install baidu-scholar-mcp
{ "command": "baidu-scholar-mcp" }
方式三:源码运行
git clone https://github.com/<you>/baidu-scholar-mcp.git
pip install curl-cffi
{
"command": "<你的python解释器>",
"args": ["<仓库路径>/baidu_scholar/mcp_server.py"]
}
Windows 注意:Python 3.12+ 无 distutils,若同时安装可选的浏览器兜底依赖
undetected-chromedriver,需先 pip install setuptools。
自测
python tests/test_client.py # 爬虫 13 项检查,应"全部通过"(需联网)
python tests/test_mcp_server.py # MCP 协议 8 项检查,应"全部通过"
调试时可设环境变量 BAIDU_SCHOLAR_VERBOSE=1 查看过程日志(stderr)。
反爬实现要点
百度学术已全面 SPA 化,数据全走 JSON 接口,本客户端直接调接口(2026-09 逆向实测):
- 搜索
GET /usercenter/paper/search?type=related&wd=<标题>&rn=20&page_no=N详情GET /scholarai/paper/detail/info?paperId=<id>引文 同搜索接口,wd=citepaperuri:(<id>) / refpaperuri:(<id>) - 新版搜索接口
/search/api/search必须携带混淆 JS 生成的acs-token,已弃用,上述老接口数据等价。 - TLS 指纹是核心风控点:python-requests 的 OpenSSL 指纹无论带什么 cookie 都会被
/usercenter系列接口拒(206 + "请输入验证码"),必须用curl_cffi impersonate='chrome'。 - cookie 自举无需浏览器:先 GET
https://www.baidu.com/拿 5 条 Set-Cookie (BAIDUID/BIDUPSID/PSTM 等)即可通过风控;详情接口更宽松,单条 BAIDUID 就够。 - 风控自愈阶梯:请求被拦 → 重新 cookie 自举重试 → (可选)无头浏览器收割 cookie → 报错。
- 数据坑已处理:机构字段内嵌
\u0001分隔符、<em>高亮标签、"查看全部>>"截断尾巴; 搜索接口摘要服务端截断,完整摘要由详情接口补全。
已知限制
- 任意乱词百度都会模糊匹配出结果,调用方需自行比对标题相关性。
- 论文本身没有参考文献/引文数据时,
get_paper_citations返回业务错误 code=1001,属正常现象。 - 接口为非官方逆向所得,若百度调整风控或字段结构,优先重新抓包核对
baidu_scholar/scholar_client.py顶部的接口说明。
License
Metadata
Release files for baidu-scholar-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| baidu_scholar_mcp-0.1.0.tar.gz | 19.7 kB | Without provenance | Details for baidu_scholar_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baidu_scholar_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for baidu_scholar_mcp-0.1.0-py3-none-any.whl |
Total release size: 35.7 kB
Release files / baidu_scholar_mcp-0.1.0.tar.gz
| Download URL | baidu_scholar_mcp-0.1.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ad7e2d972b97d8e9e65af08469a2fb8acc87281c9abd2b0ad78a35afa034d7d
|
|
BLAKE2b-256 checksum How to use checksums |
c80a6415a326dd279b1a7efac9bd48f234f1693ce45950ca814d56699f51e77d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / baidu_scholar_mcp-0.1.0-py3-none-any.whl
| Download URL | baidu_scholar_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
989b29c162f8ca12e32882a753e1b0bf1fd490d9e90d80d8efedd0093e5653b2
|
|
BLAKE2b-256 checksum How to use checksums |
744b90c17deb286b9ad3618e5b0a89bc31c48f58482cd44603aed678daa83b7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for baidu-scholar-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.