Skip to content

12458/arxiv-mcp-server

Β 
Β 

Repository files navigation

Python Version Tests License: MIT PyPI Downloads PyPI Version

ArXiv MCP Server

πŸ” Enable AI assistants to search and access arXiv papers through a simple MCP interface.

The ArXiv MCP Server provides a bridge between AI assistants and arXiv's research repository through the Model Context Protocol (MCP). Built with FastMCP v2 for optimal performance and developer experience, it allows AI models to search for papers and access their content in a programmatic way.

🀝 Contribute β€’ πŸ“ Report Bug

Pulse MCP Badge

✨ Core Features

  • πŸ”Ž Paper Search: Query arXiv papers with filters for date ranges and categories
  • πŸ“„ Paper Access: Download and read paper content
  • πŸ“‹ Paper Listing: View all downloaded papers
  • πŸ—ƒοΈ Local Storage: Papers are saved locally for faster access
  • πŸ“ Prompts: A Set of Research Prompts
  • ⚑ FastMCP v2: Built with the latest FastMCP framework for optimal performance
  • πŸ”§ Multiple Transports: Support for STDIO, HTTP, and SSE transports
  • πŸ›‘οΈ Type Safety: Automatic schema generation from Python type hints

πŸš€ Quick Start

Installing Manually

Install using uv:

uv tool install arxiv-mcp-server

For development:

# Clone and set up development environment
git clone https://github.com/12458/arxiv-mcp-server.git
cd arxiv-mcp-server

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install with test dependencies
uv pip install -e ".[test]"

Running the Server

The server supports multiple transport protocols:

# STDIO (default) - for local tools and command-line scripts
uv run python -m arxiv_mcp_server.server

# HTTP - for web deployments
uv run python -m arxiv_mcp_server.server --transport http --host 0.0.0.0 --port 8000

# SSE - for compatibility with existing SSE clients
uv run python -m arxiv_mcp_server.server --transport sse --host 0.0.0.0 --port 8000

πŸ”Œ MCP Integration

Add this configuration to your MCP client config file:

{
    "mcpServers": {
        "arxiv-mcp-server": {
            "command": "uv",
            "args": [
                "tool",
                "run",
                "arxiv-mcp-server",
                "--storage-path", "/path/to/paper/storage"
            ]
        }
    }
}

For Development:

{
    "mcpServers": {
        "arxiv-mcp-server": {
            "command": "uv",
            "args": [
                "--directory",
                "path/to/cloned/arxiv-mcp-server",
                "run",
                "arxiv-mcp-server",
                "--storage-path", "/path/to/paper/storage"
            ]
        }
    }
}

πŸ’‘ Available Tools

The server provides four main tools built with FastMCP's decorator-based approach:

1. Paper Search

Search for papers with optional filters:

result = await call_tool("search_papers", {
    "query": "transformer architecture",
    "max_results": 10,
    "date_from": "2023-01-01",  # Optional: YYYY-MM-DD format
    "date_to": "2024-01-01",    # Optional: YYYY-MM-DD format
    "categories": ["cs.AI", "cs.LG"]  # Optional: arXiv categories
})

2. Paper Download

Download a paper by its arXiv ID:

result = await call_tool("download_paper", {
    "paper_id": "2401.12345",
    "check_status": False  # Optional: check conversion status only
})

3. List Papers

View all downloaded papers:

result = await call_tool("list_papers", {})

4. Read Paper

Access the content of a downloaded paper:

result = await call_tool("read_paper", {
    "paper_id": "2401.12345"
})

πŸ“ Research Prompts

The server offers specialized prompts to help analyze academic papers:

Paper Analysis Prompt

A comprehensive workflow for analyzing academic papers that only requires a paper ID:

result = await call_prompt("deep_paper_analysis", {
    "paper_id": "2401.12345",
    "expertise_level": "intermediate",  # Optional: beginner, intermediate, expert
    "analysis_focus": "general"         # Optional: general, methodology, results, etc.
})

This prompt includes:

  • Detailed instructions for using available tools (list_papers, download_paper, read_paper, search_papers)
  • A systematic workflow for paper analysis
  • Comprehensive analysis structure covering:
    • Executive summary
    • Research context
    • Methodology analysis
    • Results evaluation
    • Practical and theoretical implications
    • Future research directions
    • Broader impacts

βš™οΈ Configuration

Configure through environment variables:

Variable Purpose Default
ARXIV_STORAGE_PATH Paper storage location ~/.arxiv-mcp-server/papers

πŸ§ͺ Testing

Run the test suite:

python -m pytest

Testing with FastMCP Client

You can also test the server using FastMCP's in-memory client:

from fastmcp import Client
from src.arxiv_mcp_server.server import mcp

async with Client(mcp) as client:
    # Test search functionality
    result = await client.call_tool("search_papers", {
        "query": "machine learning",
        "max_results": 3
    })
    print(result.text)
    
    # Test prompt functionality
    prompt_result = await client.get_prompt("deep_paper_analysis", {
        "paper_id": "2301.12345"
    })
    print(prompt_result.text)

πŸ“„ License

Released under the MIT License. See the LICENSE file for details.


Made with ❀️ by the Pearl Labs Team & Shang En

ArXiv Server MCP server

πŸš€ FastMCP Migration

This server has been migrated to FastMCP v2, providing:

  • Simplified Development: Decorator-based tool and prompt definitions
  • Type Safety: Automatic schema generation from Python type hints
  • Better Performance: Optimized MCP implementation
  • Multiple Transports: Support for STDIO, HTTP, and SSE
  • Enhanced Testing: In-memory testing capabilities

Attributions

Thank you to arXiv for use of its open access interoperability.

About

A Model Context Protocol server for searching and analyzing arXiv papers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.6%
  • Dockerfile 1.4%