ArXiv-MCP

MIT License
  • Linux
  • Apple

Integrations

  • Enables searching for academic papers using keywords, retrieving detailed information about specific papers by ID, extracting full text content from paper PDFs, and generating comprehensive summaries and analyses of papers from the arXiv repository.

  • Provides integration support for n8n workflows, with specific configuration guidance for connecting the MCP server from within n8n's containerized environment.

模型上下文协议 (MCP)服务器实现,使 AI 代理能够从流行的开放存取电子预印本存储库arXiv搜索、检索和分析学术论文。

概述

该项目提供了一个 MCP 服务器,允许 AI 代理与 arXiv 存储库交互,根据关键词搜索论文,检索特定论文的详细信息,甚至提取和分析论文内容。它既是一个实用的研究辅助工具,也是构建 MCP 服务器的参考实现。

该实施遵循构建 MCP 服务器的最佳实践,允许与任何兼容 MCP 的客户端无缝集成。

特征

该服务器为学术研究提供了几种强大的工具:

  1. search_papers :使用关键词在 arXiv 上搜索论文并获取综合摘要
  2. get_paper_details :通过 arXiv ID 检索特定论文的详细信息
  3. extract_paper_content :从论文的 PDF 中下载并提取全文内容
  4. analyze_paper :分析论文内容并生成综合摘要

先决条件

  • Python 3.11+
  • 如果将 MCP 服务器作为容器运行,则使用 Docker(推荐)

安装

使用 uv

  1. 如果没有 uv,请安装:
    pip install uv
  2. 克隆此存储库:
    git clone https://github.com/kelvingao/arxiv-mcp.git cd arxiv-mcp
  3. 安装依赖项:
    uv pip install -e .
  4. 根据.env.example创建.env文件:
    cp .env.example .env
  5. .env文件中配置环境变量(参见配置部分)

使用 Docker(推荐)

  1. 构建 Docker 镜像:
    docker build -t mcp/arxiv --build-arg PORT=8050 .
  2. 根据.env.example创建.env文件并配置环境变量

配置

您可以在.env文件中配置以下环境变量:

多变的描述例子
TRANSPORT传输协议(sse 或 stdio)sse
HOST使用 SSE 传输时绑定到的主机0.0.0.0
PORT使用 SSE 传输时监听的端口8050

运行服务器

使用 uv

上交所运输

# Set TRANSPORT=sse in .env then: python src/server.py

MCP 服务器将作为 API 端点运行,您可以使用下面显示的配置连接到该端点。

标准传输

使用 stdio,MCP 客户端本身可以启动 MCP 服务器,因此此时无需运行任何操作。

使用 Docker

上交所运输

docker run --env-file .env -p 8050:8050 mcp/arxiv

MCP 服务器将作为容器内的 API 端点运行,您可以使用下面显示的配置连接到该容器。

标准传输

使用 stdio,MCP 客户端本身可以启动 MCP 服务器容器,因此此时无需运行任何内容。

与 MCP 客户端集成

SSE配置

一旦服务器使用 SSE 传输运行,您就可以使用以下配置连接到它:

{ "mcpServers": { "arxiv": { "transport": "sse", "url": "http://localhost:8050/sse" } } }

Windsurf 用户请注意:在配置中使用serverUrl而不是url

{ "mcpServers": { "arxiv": { "transport": "sse", "serverUrl": "http://localhost:8050/sse" } } }

n8n 用户请注意:使用 host.docker.internal 而不是 localhost,因为 n8n 必须到达其自身容器之外的主机:

因此 MCP 节点中的完整 URL 为: http://host.docker.internal:8050/sse

如果您使用的不是默认值 8050,请确保更新端口。

Python 与 Stdio 配置

将此服务器添加到 Claude Desktop、Windsurf 或任何其他 MCP 客户端的 MCP 配置中:

{ "mcpServers": { "arxiv": { "command": "your/path/to/arxiv-mcp/.venv/bin/python", "args": ["your/path/to/arxiv-mcp/src/main.py"], "env": { "TRANSPORT": "stdio" } } } }

Docker 与 Stdio 配置

{ "mcpServers": { "arxiv": { "command": "docker", "args": ["run", "--rm", "-i", "-e", "TRANSPORT", "mcp/arxiv"], "env": { "TRANSPORT": "stdio" } } } }

使用示例

以下是一些如何将 arXiv MCP 服务器与 AI 代理一起使用的示例:

寻找论文

Find recent papers about quantum computing published in the last year.

获取论文详细信息

Get details for the paper with arXiv ID 2303.08774

提取纸质内容

Extract the full text from the paper with arXiv ID 2303.08774

分析论文

Analyze the methodology section of the paper with arXiv ID 2303.08774

构建您自己的 MCP 服务器

此实现为构建更复杂的 MCP 服务器奠定了基础。要构建您自己的服务器,请执行以下操作:

  1. 通过使用@mcp.tool()装饰器创建方法添加您自己的工具
  2. 创建自己的生命周期函数来添加自己的依赖项(客户端、数据库连接等)
  3. 修改现有工具或添加新工具以增强功能
  4. 使用@mcp.resource()@mcp.prompt()添加提示和资源

执照

MIT 许可证

致谢

-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器,使 AI 代理能够从 arXiv 搜索、检索和分析学术论文,支持关键字搜索、论文详细信息检索、内容提取和论文分析等功能。

  1. Features
    1. Prerequisites
      1. Installation
        1. Using uv
        2. Using Docker (Recommended)
      2. Configuration
        1. Running the Server
          1. Using uv
          2. Using Docker
        2. Integration with MCP Clients
          1. SSE Configuration
          2. Python with Stdio Configuration
          3. Docker with Stdio Configuration
        3. Usage Examples
          1. Searching for Papers
          2. Getting Paper Details
          3. Extracting Paper Content
          4. Analyzing a Paper
        4. Building Your Own MCP Server
          1. License
            1. Acknowledgements
              ID: 8qnsbe8xkh