mcpField
A
arxiv

arxiv

github.com/nousresearch生产力258.1k687 次安装今天更新
代码仓库

关于 arxiv

arxiv 是面向学术研究者的命令行研究技能,可搜索 arXiv 论文、读取内容,并借助 Semantic Scholar 查询引用与相关论文。它以 REST API 和轻量脚本支持从发现到查阅的研究流程。

主要功能

  1. 01搜索并筛选 arXiv 论文
  2. 02按 ID 获取论文元数据
  3. 03读取摘要与 PDF 全文
  4. 04查询引用、参考文献和推荐
  5. 05查找作者资料
  6. 06生成 BibTeX 条目

适用场景

  1. 01按主题、作者或类别查找论文
  2. 02检查论文引用与参考文献
  3. 03获取论文摘要或 PDF 内容
  4. 04为论文生成 BibTeX 引用

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/nousresearch/hermes-agent --skill arxiv

安装后在 Claude Code 中输入/arxiv确认已加载。

附带文件scripts/search_arxiv.py

详细介绍

arXiv 研究

通过 arXiv 免费的 REST API 搜索并获取学术论文。无需 API 密钥或依赖项——只需 curl。

快速参考

操作命令
搜索论文curl "https://export.arxiv.org/api/query?search_query=all:QUERY&max_results=5"
获取指定论文curl "https://export.arxiv.org/api/query?id_list=2402.03300"
阅读摘要(网页)web_extract(urls=["https://arxiv.org/abs/2402.03300"])
阅读全文(PDF)web_extract(urls=["https://arxiv.org/pdf/2402.03300"])

搜索论文

API 返回 Atom XML。使用 grep/sed 解析,或通过管道传递给 python,以获得简洁输出。

基本搜索
curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5"
简洁输出(将 XML 解析为可读格式)
curl -s "https://export.arxiv.org/api/query?search_query=all:GRPO+reinforcement+learning&max_results=5&sortBy=submittedDate&sortOrder=descending" | python -c "
import sys, xml.etree.ElementTree as ET
ns = {'a': 'http://www.w3.org/2005/Atom'}
root = ET.parse(sys.stdin).getroot()
for i, entry in enumerate(root.findall('a:entry', ns)):
    title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
    arxiv_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
    published = entry.find('a:published', ns).text[:10]
    authors = ', '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
    summary = entry.find('a:summary', ns).text.strip()[:200]
    cats = ', '.join(c.get('term') for c in entry.findall('a:category', ns))
    print(f'{i+1}. [{arxiv_id}] {title}')
    print(f'   Authors: {authors}')
    print(f'   Published: {published} | Categories: {cats}')
    print(f'   Abstract: {summary}...')
    print(f'   PDF: https://arxiv.org/pdf/{arxiv_id}')
    print()
"

搜索查询语法

前缀搜索范围示例
all:所有字段all:transformer+attention
ti:标题ti:large+language+models
au:作者au:vaswani
abs:摘要abs:reinforcement+learning
cat:分类cat:cs.AI
co:备注co:accepted+NeurIPS
布尔运算符
# AND (default when using +)
search_query=all:transformer+attention

# OR
search_query=all:GPT+OR+all:BERT

# AND NOT
search_query=all:language+model+ANDNOT+all:vision

# Exact phrase
search_query=ti:"chain+of+thought"

# Combined
search_query=au:hinton+AND+cat:cs.LG

排序和分页

参数选项
sortByrelevance, lastUpdatedDate, submittedDate
sortOrderascending, descending
start结果偏移量(从 0 开始)
max_results结果数量(默认 10,最大 30000)
# Latest 10 papers in cs.AI
curl -s "https://export.arxiv.org/api/query?search_query=cat:cs.AI&sortBy=submittedDate&sortOrder=descending&max_results=10"

获取指定论文

# By arXiv ID
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300"

# Multiple papers
curl -s "https://export.arxiv.org/api/query?id_list=2402.03300,2401.12345,2403.00001"

BibTeX 生成

获取论文元数据后,生成 BibTeX 条目:

{% raw %}

curl -s "https://export.arxiv.org/api/query?id_list=1706.03762" | python -c "
import sys, xml.etree.ElementTree as ET
ns = {'a': 'http://www.w3.org/2005/Atom', 'arxiv': 'http://arxiv.org/schemas/atom'}
root = ET.parse(sys.stdin).getroot()
entry = root.find('a:entry', ns)
if entry is None: sys.exit('Paper not found')
title = entry.find('a:title', ns).text.strip().replace('\n', ' ')
authors = ' and '.join(a.find('a:name', ns).text for a in entry.findall('a:author', ns))
year = entry.find('a:published', ns).text[:4]
raw_id = entry.find('a:id', ns).text.strip().split('/abs/')[-1]
cat = entry.find('arxiv:primary_category', ns)
primary = cat.get('term') if cat is not None else 'cs.LG'
last_name = entry.find('a:author', ns).find('a:name', ns).text.split()[-1]
print(f'@article{{{last_name}{year}_{raw_id.replace(\".\", \"\")},')
print(f'  title     = {{{title}}},')
print(f'  author    = {{{authors}}},')
print(f'  year      = {{{year}}},')
print(f'  eprint    = {{{raw_id}}},')
print(f'  archivePrefix = {{arXiv}},')
print(f'  primaryClass  = {{{primary}}},')
print(f'  url       = {{https://arxiv.org/abs/{raw_id}}}')
print('}')
"

{% endraw %}

阅读论文内容

找到论文后,阅读:

# Abstract page (fast, metadata + abstract)
web_extract(urls=["https://arxiv.org/abs/2402.03300"])

# Full paper (PDF → markdown via Firecrawl)
web_extract(urls=["https://arxiv.org/pdf/2402.03300"])

如需在本地处理 PDF,请参阅 ocr-and-documents 技能。

常见分类

分类领域
cs.AI人工智能
cs.CL计算与语言(NLP)
cs.CV计算机视觉
cs.LG机器学习
cs.CR密码学与安全
stat.ML机器学习(统计学)
math.OC优化与控制
physics.comp-ph计算物理学

完整列表:https://arxiv.org/category_taxonomy

辅助脚本

scripts/search_arxiv.py 脚本负责解析 XML 并提供简洁输出:

python scripts/search_arxiv.py "GRPO reinforcement learning"
python scripts/search_arxiv.py "transformer attention" --max 10 --sort date
python scripts/search_arxiv.py --author "Yann LeCun" --max 5
python scripts/search_arxiv.py --category cs.AI --sort date
python scripts/search_arxiv.py --id 2402.03300
python scripts/search_arxiv.py --id 2402.03300,2401.12345

无需任何依赖——仅使用 Python 标准库。


Semantic Scholar(引用、相关论文、作者简介)

arXiv 不提供引用数据或推荐功能。如需这些功能,请使用 Semantic Scholar API——基础使用免费,无需密钥(每秒 1 个请求),并返回 JSON。

获取论文详情和引用
# By arXiv ID
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300?fields=title,authors,citationCount,referenceCount,influentialCitationCount,year,abstract" | python -m json.tool

# By Semantic Scholar paper ID or DOI
curl -s "https://api.semanticscholar.org/graph/v1/paper/DOI:10.1234/example?fields=title,citationCount"
获取某篇论文的引用(谁引用了它)
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/citations?fields=title,authors,year,citationCount&limit=10" | python -m json.tool
获取某篇论文的参考文献(它引用了什么)
curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:2402.03300/references?fields=title,authors,year,citationCount&limit=10" | python -m json.tool
搜索论文(arXiv 搜索的替代方案,返回 JSON)
curl -s "https://api.semanticscholar.org/graph/v1/paper/search?query=GRPO+reinforcement+learning&limit=5&fields=title,authors,year,citationCount,externalIds" | python -m json.tool
获取论文推荐
curl -s -X POST "https://api.semanticscholar.org/recommendations/v1/papers/" \
  -H "Content-Type: application/json" \
  -d '{"positivePaperIds": ["arXiv:2402.03300"], "negativePaperIds": []}' | python -m json.tool
作者简介
curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=Yann+LeCun&fields=name,hIndex,citationCount,paperCount" | python -m json.tool
常用的 Semantic Scholar 字段

title, authors, year, abstract, citationCount, referenceCount, influentialCitationCount, isOpenAccess, openAccessPdf, fieldsOfStudy, publicationVenue, externalIds(包含 arXiv ID、DOI 等)


完整研究工作流

  1. 发现:python scripts/search_arxiv.py "your topic" --sort date --max 10
  2. 评估影响力:curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID?fields=citationCount,influentialCitationCount"
  3. 阅读摘要:web_extract(urls=["https://arxiv.org/abs/ID"])
  4. 阅读全文:web_extract(urls=["https://arxiv.org/pdf/ID"])
  5. 查找相关研究:curl -s "https://api.semanticscholar.org/graph/v1/paper/arXiv:ID/references?fields=title,citationCount&limit=20"
  6. 获取推荐:向 Semantic Scholar 推荐端点发送 POST 请求
  7. 跟踪作者:curl -s "https://api.semanticscholar.org/graph/v1/author/search?query=NAME"

速率限制

API速率身份验证
arXiv约 1 个请求 / 3 秒无需
Semantic Scholar1 个请求 / 秒无(使用 API 密钥时为 100 个/秒)

注意事项

  • arXiv 返回 Atom XML——使用辅助脚本或解析代码片段可获得整洁的输出
  • Semantic Scholar 返回 JSON——通过 python -m json.tool 管道处理以便阅读
  • arXiv ID:旧格式(hep-th/0601001)与新格式(2402.03300)
  • PDF:https://arxiv.org/pdf/{id}——摘要:https://arxiv.org/abs/{id}
  • HTML(如有):https://arxiv.org/html/{id}
  • 如需在本地处理 PDF,请参阅 ocr-and-documents 技能

ID 版本管理

  • arxiv.org/abs/1706.03762 始终解析为最新版本
  • arxiv.org/abs/1706.03762v1 指向特定的不可变版本
  • 生成引用时,请保留实际阅读的版本后缀,以防止引用内容发生变化(后续版本可能会大幅修改内容)
  • API 的 <id> 字段返回带版本号的 URL(例如,http://arxiv.org/abs/1706.03762v7)

已撤回的论文

论文提交后可能会被撤回。此时:

  • <summary> 字段包含撤回通知(查找“withdrawn”或“retracted”)
  • 元数据字段可能不完整
  • 将结果视为有效论文之前,务必检查摘要

评论

支持 Markdown