mcpField
A
arxiv-mcp

arxiv-mcp

github.com/oimiragieo生产力44110 次安装17 周前更新
代码仓库

关于 arxiv-mcp

这是一个利用 WebFetch 和 Exa 查询 arXiv 论文的研究技能,面向学术调研与技术文献检索。它结合语义发现与 API 精确查询,可按关键词、作者、类别或论文 ID 查找并提取元数据。

主要功能

  1. 01按关键词、作者和类别搜索
  2. 02通过论文 ID 获取详情
  3. 03提取摘要与论文元数据
  4. 04结合 Exa 语义搜索和 WebFetch
  5. 05将结果限制为最多 20 篇

适用场景

  1. 01为文献综述查找论文
  2. 02检索特定研究者的论文
  3. 03查找某领域的近期研究
  4. 04获取论文引用所需的元数据

MCP 相关

该技能不提供 MCP 服务,也无需安装 MCP 服务。它通过现有的 WebFetch 和 Exa 工具访问 arXiv。

安装

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

$npx skills add https://github.com/oimiragieo/agent-studio --skill arxiv-mcp

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

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

commands/
arxiv-mcp.md
hooks/
post-execute.cjs
pre-execute.cjs
references/
original-README.md
research-requirements.md
rules/
arxiv-mcp.md
schemas/
input.schema.json
output.schema.json
scripts/
main.cjs
templates/
implementation-template.md

详细介绍

模式:认知/提示词驱动——没有独立的实用脚本;在 Agent 上下文中使用。

arXiv 搜索技能

arXiv 搜索技能——使用现有工具(WebFetch、Exa)搜索并检索 arXiv.org 上的学术论文。无需安装 MCP 服务。

✅ 无需安装

此技能使用现有工具访问 arXiv:

  • WebFetch - 直接访问 arXiv API
  • Exa - 通过 arXiv 筛选进行语义搜索

立即可用——无需 MCP 服务,也无需重启。

- 按关键词、作者、类别或日期范围搜索学术论文 - 获取详细的论文元数据(标题、作者、摘要、类别、PDF 链接) - 按 arXiv ID 获取指定论文 - 根据类别和关键词查找相关论文 - 按 arXiv 类别筛选(cs.AI、cs.LG、cs.CV、math.*、physics.* 等) - 无需 API 密钥——使用公开的 arXiv API

结果数量限制(内存保护)

arxiv-mcp 会返回学术论文。为防止内存耗尽:

  • max_results:20(硬性上限)
  • 每篇论文的元数据约为 300 字节
  • 20 篇论文 × 300 字节 = 约 6 KB 元数据
  • 获取全文时,每篇论文可能超过 100 KB——不要获取论文全文

为什么要设置此限制?

  • 之前的上限:100 条结果 → 30 KB 以上的元数据 → 上下文膨胀
  • 新上限:20 条结果 → 6 KB 元数据 → 内存安全
  • 通常 20 篇论文就足以找到目标

方法 1:通过 arXiv API 使用 WebFetch(适用于特定查询,推荐)

arXiv API 可通过 http://export.arxiv.org/api/query 公开访问。

推荐模式
// ✓ GOOD: Limit results to 20
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=all:transformer+attention&max_results=20&sortBy=relevance',
  prompt: 'Extract paper titles, authors, abstracts, arXiv IDs, and PDF links from these results',
});

// ✓ GOOD: Use specific filters to reduce result set
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=all:transformer+attention+2025&max_results=20&sortBy=submittedDate',
  prompt: 'Extract recent papers on transformer attention',
});

// ✗ BAD: Old behavior - unlimited or >20 results
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=all:neural+networks',
  // Too broad - will get 100s of results
});

// ✗ BAD: Exceeds memory limit
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=all:deep+learning&max_results=100',
  // Over limit - memory risk
});
按关键词搜索
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=all:transformer+attention&max_results=20&sortBy=relevance',
  prompt: 'Extract paper titles, authors, abstracts, arXiv IDs, and PDF links from these results',
});
按作者搜索
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=au:LeCun&max_results=10&sortBy=submittedDate',
  prompt: 'Extract paper titles, authors, abstracts, and arXiv IDs',
});
按类别搜索
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=cat:cs.LG&max_results=15&sortBy=submittedDate',
  prompt: 'Extract paper titles, authors, abstracts, categories, and arXiv IDs',
});
按 ID 获取指定论文
WebFetch({
  url: 'http://export.arxiv.org/api/query?id_list=2301.07041',
  prompt:
    'Extract full details: title, all authors, abstract, categories, published date, PDF link',
});
API 查询参数
参数描述示例
search_query带字段前缀的搜索词all:transformer、au:LeCun、ti:attention
id_list以逗号分隔的 arXiv ID2301.07041,2302.13971
max_results结果数量(默认值为 10,最大值为 100)max_results=20
start分页偏移量start=10
sortBy排序方式:relevance、lastUpdatedDate、submittedDatesortBy=submittedDate
sortOrderascending 或 descendingsortOrder=descending
search_query 的字段前缀
前缀字段示例
all:所有字段all:machine+learning
ti:标题ti:transformer
au:作者au:Vaswani
abs:摘要abs:attention+mechanism
cat:类别cat:cs.LG
co:评论co:accepted
布尔运算符

使用 AND、OR、ANDNOT 组合搜索词:

search_query=ti:transformer+AND+abs:attention
search_query=au:LeCun+OR+au:Bengio
search_query=cat:cs.LG+ANDNOT+ti:survey
不应使用 arxiv-mcp 的情况
  • 常规网络研究 → 改用 WebSearch/WebFetch
  • 实现示例 → 使用 pnpm search:code 或在代码库上使用 ripgrep 技能(也可使用 Grep/Glob 作为备选)
  • 产品研究 → 使用带新闻筛选的 WebSearch
  • 社区讨论 → 使用 WebSearch 搜索论坛/Stack Overflow

arxiv-mcp 最适合:

  • 查找特定主题的学术论文
  • 理解理论基础
  • 在文档中引用研究
  • 快速文献综述(最多 20 篇论文)

方法 2:Exa 搜索(更适合语义/自然语言查询)

使用 Exa 进行更自然的语言查询,并筛选 arXiv:

语义搜索
mcp__Exa__web_search_exa({
  query: 'site:arxiv.org transformer architecture attention mechanism deep learning',
  numResults: 10,
});
某个领域的最新论文
mcp__Exa__web_search_exa({
  query: 'site:arxiv.org large language model scaling laws 2024',
  numResults: 15,
});
面向作者的搜索
mcp__Exa__web_search_exa({
  query: 'site:arxiv.org author:"Yann LeCun" deep learning',
  numResults: 10,
});

常见 arXiv 分类

分类领域
cs.AI人工智能
cs.LG机器学习
cs.CL计算与语言(NLP)
cs.CV计算机视觉
cs.SE软件工程
cs.CR密码学与安全
stat.ML机器学习(统计学)
math.*数学(所有子分类)
physics.*物理学(所有子分类)
q-bio.*定量生物学
econ.*经济学

工作流:完整研究流程

步骤 1:初步搜索
// Start with broad Exa search for semantic matching
mcp__Exa__web_search_exa({
  query: 'site:arxiv.org transformer attention mechanism neural networks',
  numResults: 10,
});
步骤 2:获取特定论文
// Get details for interesting papers by ID
WebFetch({
  url: 'http://export.arxiv.org/api/query?id_list=2301.07041,2302.13971',
  prompt: 'Extract full metadata for each paper: title, authors, abstract, categories, PDF URL',
});
步骤 3:查找相关研究
// Search by category of interesting paper
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=cat:cs.LG+AND+ti:attention&max_results=10&sortBy=submittedDate',
  prompt: 'Find related papers, extract titles and abstracts',
});
步骤 4:获取最新论文
// Latest papers in the field
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=cat:cs.LG&max_results=20&sortBy=submittedDate&sortOrder=descending',
  prompt: 'Extract the 20 most recent machine learning papers',
});

</execution_process>

<best_practices>

  1. 使用 Exa 进行发现:自然语言查询可以找到语义相关的论文
  2. 使用 WebFetch 精确检索:指定 ID、分类或 API 查询
  3. 结合使用不同方法:用 Exa 发现论文,再用 WebFetch 深入检索
  4. 使用具体查询:transformer attention mechanism > machine learning
  5. 检查多个分类:论文通常涉及 cs.AI、cs.LG 和 cs.CL
  6. 按日期排序以查找最新研究:sortBy=submittedDate&sortOrder=descending

</best_practices>

**示例 1:搜索 transformer 论文**:
WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=ti:transformer+AND+abs:attention&max_results=10&sortBy=relevance',
  prompt: 'Extract paper titles, authors, abstracts, and arXiv IDs',
});

示例 2:查找某位研究人员的论文:

WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=au:Vaswani&max_results=15',
  prompt: 'List all papers by this author with titles and dates',
});

示例 3:获取最新的 ML 论文:

WebFetch({
  url: 'http://export.arxiv.org/api/query?search_query=cat:cs.LG&max_results=20&sortBy=submittedDate&sortOrder=descending',
  prompt: 'Extract the 20 most recent machine learning papers with titles and abstracts',
});

示例 4:使用 Exa 进行语义搜索:

mcp__Exa__web_search_exa({
  query: 'site:arxiv.org multimodal large language models vision 2024',
  numResults: 10,
});

示例 5:获取特定论文的详细信息:

WebFetch({
  url: 'http://export.arxiv.org/api/query?id_list=1706.03762',
  prompt: "Extract complete details for the 'Attention Is All You Need' paper",
});

</usage_example>

Agent 集成

此技能会自动分配给:

  • researcher - 学术研究、文献综述
  • scientific-research-expert - 深入的科学分析
  • developer - 查找用于实现的技术论文

铁律

  1. 始终将 max_results 限制为 20 — 绝不允许不限数量或超过 20 条结果的查询;100 多篇论文会导致上下文爆炸,这是已知的故障模式,会使 Agent 流水线停滞。
  2. 文献综述期间绝不获取完整论文 PDF — 仅提取元数据和摘要;每篇完整论文都有 100KB 以上,会在几分钟内耗尽上下文预算。
  3. 始终使用 Exa 进行语义发现,使用 WebFetch 进行精确检索 — Exa 用于查找语义相关的论文;WebFetch 用于获取特定 ID 或分类订阅源;应依次结合使用,而非相互替代。
  4. 绝不在没有领域前缀的情况下使用宽泛查询 — search_query=neural+networks 会返回数千条结果;始终使用 ti:、au:、cat: 或 abs: 前缀限定范围。
  5. 引用论文时始终注明 arXiv ID(例如 2301.07041) — 仅凭标题容易产生歧义,且标题可能变化;ID 稳定、可由机器读取,并支持即时检索。

反模式

反模式失败原因正确做法
使用 max_results=100 或不设限制上下文爆炸;100 篇论文 × 300 字节 = 30KB+ 元数据始终设置 max_results=20(硬性上限)
获取完整论文 PDF单篇论文可能超过 100KB;耗尽上下文预算仅通过 API 提取摘要和元数据
不带字段前缀的宽泛查询返回所有字段中不相关的结果使用 ti:、au:、cat: 或 abs: 前缀
仅使用 WebFetch 进行发现会遗漏语义相关但不匹配精确术语的论文先使用 Exa 进行语义发现
引用论文标题而非 arXiv ID标题可能含义模糊或重复始终包含 arXiv ID(例如,1706.03762)

记忆协议(必须遵守)

开始之前:

cat .claude/context/memory/learnings.md

完成之后:

  • 新模式 -> .claude/context/memory/learnings.md
  • 发现问题 -> .claude/context/memory/issues.md
  • 做出决策 -> .claude/context/memory/decisions.md

假设工作会中断:你的上下文可能会重置。如果内容没有记录在记忆中,就等于没有发生。

评论

支持 Markdown