π 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
- π 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
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]"
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
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"
]
}
}
}
The server provides four main tools built with FastMCP's decorator-based approach:
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
})
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
})
View all downloaded papers:
result = await call_tool("list_papers", {})
Access the content of a downloaded paper:
result = await call_tool("read_paper", {
"paper_id": "2401.12345"
})
The server offers specialized prompts to help analyze academic papers:
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
Configure through environment variables:
Variable | Purpose | Default |
---|---|---|
ARXIV_STORAGE_PATH |
Paper storage location | ~/.arxiv-mcp-server/papers |
Run the test suite:
python -m pytest
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)
Released under the MIT License. See the LICENSE file for details.
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
Thank you to arXiv for use of its open access interoperability.