arXiv Research MCP Server
by Eganchiyu
README.md
# arXiv Research MCP Server
一个**零第三方 Python 依赖、跨平台(Windows / macOS / Linux)、纯标准库实现**的 arXiv 科研文献 MCP 服务,开箱即用,支持 **Claude Desktop、Cursor、Windsurf、Antigravity、Claude Code、Cherry Studio、Cline** 等所有兼容 MCP stdio 协议的客户端。
## 核心亮点
1. **零外部付费 API / 零 Semantic Scholar 依赖 / 零 Python 第三方包**:只需 `Python >= 3.10`,无需 `pip install` 即可直接运行。
2. **TeX 源码优先的渐进式精读(`/e-print/<id>`)**:
- 先用 `paper_inspect_structure` 读取目录、图表标题、Limitations 与 GitHub 链接(极低 token 消耗);
- 再用 `paper_read_section` 按章节 ID(如 `S3.2`)、`tables`、`equations` 无损提取原始 LaTeX 公式与实验数据表格,彻底告别 PDF OCR 乱码。
3. **无 S2 双向引文追踪**:
- `paper_extract_citations`:解析 TeX `.bbl`/`.bib` 与正文 `\cite{}` 上下文,自动挖出论文对前人方法的批评与引用脉络;
- `arxiv_find_followups`:按方法/基准简称检索最新 arXiv 论文,实现前向跟进追踪。
4. **合规限流 + 本地 SQLite 持久化缓存**:
- 跨进程文件锁自动遵守 arXiv 官方 3.1 秒/次限流(兼容 Linux/macOS `fcntl` 与 Windows `msvcrt`);
- 搜索结果缓存 24 小时,论文元数据与 TeX/PDF 永久缓存到 `~/.cache/arxiv-research-mcp`(可通过 `ARXIV_RESEARCH_CACHE_DIR` 自定义)。
5. **开源代码仓探测 + 工作区证据库**:
- `github_probe_repo`:无需 GitHub Token 即可探测论文开源仓的活跃度、目录结构、README 与硬件/显存/框架需求;
- `research_kb`:内置 SQLite WAL + FTS5 科研笔记与 Research Gap 证据库,支持自动导出 Markdown 拆解卡片与对比矩阵。
---
## 内置 9 个 MCP 工具一览
| 工具名 | 功能说明 |
| :--- | :--- |
| `arxiv_search` | 限流 + 缓存的 arXiv 精准检索,支持学科分类/日期/排序,自动提取会议 Venue 与 GitHub 链接 |
| `arxiv_get_papers` | 按 arXiv ID 批量拉取完整元数据与摘要(单次最多 30 篇) |
| `arxiv_find_followups` | 前向引文代理:按方法或基准简称(如 `FlashAttention`、`LoRA`)追踪最新跟进工作 |
| `paper_inspect_structure` | 渐进精读第 1 步:下载 TeX 源码(或 PDF),输出目录、图表标题、Limitations 与链接 |
| `paper_read_section` | 渐进精读第 2 步:按章节 ID(`S3`)、标题关键词、`tables`、`equations` 或 `page:3-5` 精准点读 |
| `paper_extract_citations` | 后向引文与批判挖掘:从 `.bbl`/`.bib` 与正文 `\cite{}` 提取引用上下文及 arXiv ID |
| `paper_render_visuals` | 将指定 PDF 页渲染为高清 PNG(每次最多 5 页,供多模态大模型看架构图与实验曲线) |
| `github_probe_repo` | 零 Key 探测论文 GitHub 仓库的 Star、活跃度、顶层目录、README 与算力/框架信号 |
| `research_kb` | 工作区 SQLite+FTS5 证据库(读写论文精读卡片、记录 Research Gap、导出 `gap_matrix.md`) |
---
## 快速上手(3 种启动方式任选其一)
### 方式 1:免安装直接运行(最推荐,解压即用)
只需本机有 **Python 3.10+**,不需要安装任何依赖!
将本文件夹解压到任意目录(例如 `/path/to/arxiv-research-mcp` 或 `C:\Tools\arxiv-research-mcp`),在你的 MCP 客户端配置文件中加入:
```json
{
"mcpServers": {
"arxiv-research": {
"command": "python3",
"args": [
"/绝对路径/arxiv-research-mcp/run_server.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}
```
> **Windows 用户注意**:把 `"command"` 改为 `"python"`(或完整路径如 `"C:\\Python312\\python.exe"`),路径中的反斜杠写成双反斜杠 `\\` 或正斜杠 `/` 均可。
### 方式 2:通过 `pip` 安装成全局命令
```bash
cd /path/to/arxiv-research-mcp
pip install -e .
```
安装后即可在 MCP 配置中直接使用命令名:
```json
{
"mcpServers": {
"arxiv-research": {
"command": "arxiv-research-mcp"
}
}
}
```
### 方式 3:通过 `uv` 运行
```json
{
"mcpServers": {
"arxiv-research": {
"command": "uv",
"args": [
"run",
"--directory",
"/绝对路径/arxiv-research-mcp",
"arxiv-research-mcp"
]
}
}
}
```
---
## 常见客户端配置文件位置
- **Claude Desktop**:
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- **Cursor**:设置 -> `MCP` -> `Add new global MCP server`(或编辑 `~/.cursor/mcp.json`)
- **Windsurf**:`~/.codeium/windsurf/mcp_config.json`
- **Antigravity**:`~/.gemini/antigravity/mcp_config.json`(或工作区 `.agents/` 插件配置)
- **Claude Code**:
```bash
claude mcp add arxiv-research -- python3 /绝对路径/arxiv-research-mcp/run_server.py
```
---
## 可选依赖说明(仅 PDF 兜底与看图需要)
绝大多数 arXiv 论文都提供 TeX 源码,**无需安装任何额外软件即可完整使用 8/9 的功能**。
如果你希望:
1. 使用 `paper_render_visuals` 把 PDF 页面渲染成 PNG 喂给多模态模型看架构图;
2. 对极少数没有 TeX 源码的纯 PDF 论文做文本兜底提取;
只需安装 **Poppler**(提供 `pdftoppm` 和 `pdftotext`):
- **Ubuntu / Debian**: `sudo apt install poppler-utils`
- **macOS**: `brew install poppler`
- **Windows**: `winget install oschwartz10612.Poppler` 或从 Poppler Windows Releases 下载并把 `Library\bin` 加入系统 `PATH`。
---
## 环境变量
| 变量名 | 默认值 | 说明 |
| :--- | :--- | :--- |
| `ARXIV_RESEARCH_CACHE_DIR` | `~/.cache/arxiv-research-mcp` | 本地缓存目录(SQLite 搜索/元数据缓存 + 下载的 TeX 源码、PDF 和渲染图) |
| `PYTHONUNBUFFERED` | `1`(推荐) | 禁用 stdout 缓冲,保证 MCP stdio 通信实时响应 |
---
## 命令行快速自检
你可以运行下面这条单行命令验证 MCP 服务是否正常握手并列出全部 9 个工具:
```bash
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26"}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' | python3 run_server.py
```
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues