AR

ArXiv API MCP Server Natural Language Access

Query arXiv via natural language using an MCP server that connects to the arXiv API for fast, precise paper discovery and retrieval.

Quick Install
npx -y @prashalruchiranga/arxiv-mcp-server

Overview

This MCP (Model Context Protocol) server provides natural-language access to the arXiv API. It exposes a small HTTP/MCP-compatible service that translates plain-English queries into arXiv API requests, returning structured metadata and direct PDF links. The result is a faster, developer-friendly way to discover relevant papers and retrieve content for downstream apps, chat assistants, or research tools.

The server is designed for integration with LLM-based agents and other tooling that speak MCP: instead of manually formatting arXiv queries or parsing ATOM feeds, an LLM can call a compact set of MCP actions (search, fetch, download) and receive machine-friendly JSON responses. This simplifies building assistants that need accurate paper retrieval without embedding complex arXiv logic into the model prompt.

Features

  • Natural-language search: send plain English queries and get ranked arXiv results.
  • Structured metadata output: authors, title, abstract, categories, published date, arXiv ID, PDF URL.
  • PDF retrieval support: direct links for download or proxying.
  • MCP-friendly actions: explicit actions like search_arxiv, fetch_paper, and fetch_pdf for LLMs/agents.
  • Configurable cache and pagination for performance and rate-limit friendliness.
  • Simple HTTP interface for easy integration into apps and pipelines.

Installation / Configuration

Prerequisites: Git and Docker (or Node.js/npm) are sufficient to run locally.

Clone the repository:

git clone https://github.com/prashalruchiranga/arxiv-mcp-server.git
cd arxiv-mcp-server

Run with Docker (recommended):

# Build
docker build -t arxiv-mcp-server .

# Run
docker run -p 8080:8080 \
  -e PORT=8080 \
  -e ARXIV_API_URL="https://export.arxiv.org/api/query" \
  -e CACHE_TTL=3600 \
  arxiv-mcp-server

Run locally with Node (if included):

npm install
# or
yarn install

# Start server
PORT=8080 ARXIV_API_URL="https://export.arxiv.org/api/query" npm start

Configuration (example .env):

PORT=8080
ARXIV_API_URL=https://export.arxiv.org/api/query
CACHE_TTL=3600        # seconds to cache search results
MAX_RESULTS=20        # default number of papers per search
LOG_LEVEL=info

Notes:

  • arXiv does not require an API key, but you should respect their rate limits and usage policies.
  • CACHE_TTL helps reduce repeated API calls for identical queries.

Available Tools / Resources

The server exposes a small set of MCP actions that are suitable for LLMs and programmatic clients.

ActionEndpointDescriptionOutput
search_arxivPOST /mcpNatural-language search; accepts query, limit, and filtersJSON list of paper metadata
fetch_paperPOST /mcpFetch detailed metadata for a single arXiv IDFull metadata + canonical PDF URL
fetch_pdfGET /pdf/{arxiv_id}Proxy or redirect to the paper PDFapplication/pdf or redirect

Example MCP action request (HTTP JSON):

{
  "action": "search_arxiv",
  "params": {
    "query": "recent advances in contrastive learning for vision",
    "limit": 5,
    "start": 0
  }
}

Example response snippet:

{
  "results": [
    {
      "id": "2106.12345",
      "title": "Contrastive Methods for Visual Representation Learning",
      "authors": ["A. Researcher", "B. Scientist"],
      "abstract": "We study ...",
      "categories": ["cs.CV", "stat.ML"],
      "published": "2021-06-22",
      "pdf_url": "https://arxiv.org/pdf/2106.12345.pdf"
    }
  ]
}

Use Cases

  1. Assistant-powered literature search

    • An LLM acting as a research assistant can call search_arxiv with a user query like: “Find recent survey papers on graph neural networks and their benchmarks.” The server returns a concise list with PDF links the assistant can present or summarize.
  2. Automated ingestion pipeline

    • Periodic processes can call search_arxiv with topic filters (e.g., “zero-shot learning 2023”) and store metadata and PDFs in a document store for embeddings and retrieval-augmented generation.
  3. Citation and reading list generator

    • A web app that builds reading lists can call fetch_paper for specific IDs to retrieve canonical metadata and direct PDF URLs to present to users.
  4. Hybrid search UI

    • Combine semantic filtering in an LLM with precise arXiv queries from the server to provide fast, relevant search results without complex query generation in the model prompt.

Concrete example using curl:

curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{"action":"search_arxiv","params":{"query":"transformer architecture survey 2022","limit":3}}'

Tips & Troubleshooting

  • Rate limiting: if you see errors or truncated results, reduce request frequency or increase CACHE_TTL.
  • Query tuning: natural-language queries map to arXiv query syntax; adding keywords like “author:” or “cat:” in the query can improve precision.
  • Logs: enable verbose logging (LOG_LEVEL=debug) to see generated arXiv queries and API responses.
  • Security: if exposing the server publicly, place it behind an authenticated proxy or restrict IPs to avoid abuse.

This MCP server aims to remove the friction of translating natural language into precise arXiv requests, making it straightforward to add paper discovery and retrieval to LLM agents and developer tools.