Skip to main content
Glama

ArXiv-MCP

by kelvingao
MIT License
  • Linux
  • Apple

模型上下文协议 (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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

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

  1. 特征
    1. 先决条件
      1. 安装
        1. 使用 uv
        2. 使用 Docker(推荐)
      2. 配置
        1. 运行服务器
          1. 使用 uv
          2. 使用 Docker
        2. 与 MCP 客户端集成
          1. SSE配置
          2. Python 与 Stdio 配置
          3. Docker 与 Stdio 配置
        3. 使用示例
          1. 寻找论文
          2. 获取论文详细信息
          3. 提取纸质内容
          4. 分析论文
        4. 构建您自己的 MCP 服务器
          1. 执照
            1. 致谢

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                The ArXiv MCP Server bridges the gap between AI models and academic research by providing a sophisticated interface to arXiv's extensive research repository. This server enables AI assistants to perform precise paper searches and access full paper content, enhancing their ability to engage with scientific literature.
                Last updated -
                4
                1,218
                Python
                Apache 2.0
                • Linux
                • Apple
              • A
                security
                A
                license
                A
                quality
                Enables real-time search and retrieval of academic paper information from multiple sources, providing access to paper metadata, abstracts, and full-text content when available, with structured data responses for integration with AI models that support tool/function calling.
                Last updated -
                3
                11
                Python
                AGPL 3.0
              • A
                security
                A
                license
                A
                quality
                Enables AI assistants to search and access arXiv research papers through a simple Message Control Protocol interface, allowing for paper search, download, listing, and reading capabilities.
                Last updated -
                4
                1
                Python
                Apache 2.0
              • -
                security
                A
                license
                -
                quality
                Enables AI assistants to search, download, and read arXiv research papers through a Message Control Protocol interface, with support for paper filtering and local storage.
                Last updated -
                Apache 2.0

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/kelvingao/arxiv-mcp'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server