A custom MCP (Model Context Protocol) server that searches arXiv, stores research papers by topic, and exposes tools and resources for structured academic discovery and analysis.
- π Search arXiv Papers: Search for academic papers on arXiv based on topics
- π Store Paper Information: Automatically organize and store paper metadata by topic
- π§ MCP Tools: Expose search and extraction tools via MCP protocol
- π MCP Resources: Access stored papers through structured resources
- π‘ Prompt Templates: Pre-built prompts for research assistance
- search_papers: Search for papers on arXiv and store their information
- extract_info: Retrieve information about a specific paper by ID
- papers://folders: List all available topic folders
- papers://{topic}: Get detailed information about papers on a specific topic
- Python 3.12 or higher
- pip or uv package manager
# Clone the repository
git clone https://github.com/Muhammadyousafrana/mcp-arxiv-research-server.git
cd mcp-arxiv-research-server
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Clone the repository
git clone https://github.com/Muhammadyousafrana/mcp-arxiv-research-server.git
cd mcp-arxiv-research-server
# Install uv if you haven't already
pip install uv
# Create virtual environment and install dependencies
uv venv
uv pip install -e .If you're using uv and want to convert your project to use pip instead, follow these steps:
The project uses pyproject.toml to define dependencies. To convert to a requirements.txt file:
# Install uv if not already installed
pip install uv
# Compile pyproject.toml to requirements.txt
uv pip compile pyproject.toml -o requirements.txtThis command will:
- Read the dependencies from
pyproject.toml - Resolve all dependencies and their versions
- Create a pinned
requirements.txtfile with all dependencies
The runtime.txt file specifies the Python version for deployment platforms (like Heroku, Render, etc.):
python-3.12.3
Important Notes about runtime.txt:
- Purpose: Tells deployment platforms which Python version to use
- Format: Must be in the format
python-X.Y.Z(e.g.,python-3.12.3) - Location: Place in the root directory of your project
- Compatibility: Ensure the version matches your
pyproject.tomlrequirement (>=3.12)
Once you have requirements.txt, you can install dependencies using standard pip:
# Create a virtual environment
python -m venv venv
# Activate virtual environment
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
# Install from requirements.txt
pip install -r requirements.txtWhen you add new dependencies:
Option A: Update pyproject.toml first (Recommended)
# 1. Edit pyproject.toml and add your dependency
# 2. Regenerate requirements.txt
uv pip compile pyproject.toml -o requirements.txt
# 3. Install the new dependencies
pip install -r requirements.txtOption B: Direct pip install
# Install new package
pip install package-name
# Update requirements.txt
pip freeze > requirements.txtmcp-arxiv-research-server/
βββ research_server.py # Main MCP server implementation
βββ main.py # Entry point
βββ pyproject.toml # Project configuration and dependencies
βββ requirements.txt # Pip-compatible dependency list
βββ runtime.txt # Python version specification
βββ uv.lock # uv lock file (if using uv)
βββ .python-version # Python version for pyenv
βββ papers/ # Directory for stored papers (created at runtime)
β βββ {topic}/
β βββ papers_info.json
βββ .gitignore
βββ LICENSE
βββ README.md
python research_server.pyThe server will start on port 8001 using SSE (Server-Sent Events) transport.
# The MCP server exposes the following tool
search_papers(topic="machine learning", max_results=5)This will:
- Search arXiv for papers on "machine learning"
- Store metadata in
papers/machine_learning/papers_info.json - Return a list of paper IDs
# Extract information about a specific paper
extract_info(paper_id="2301.12345")Access stored papers through MCP resources:
papers://folders- List all available topicspapers://machine_learning- Get all papers on machine learning
The project has two main dependencies defined in pyproject.toml:
[project]
name = "mcp-arxiv-research-server"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"arxiv>=2.4.0",
"mcp>=1.26.0",
]- Minimum Required: Python 3.12
- Runtime Version: Python 3.12.3 (as specified in
runtime.txt) - Specified in:
pyproject.toml:requires-python = ">=3.12"runtime.txt:python-3.12.3.python-version:3.12(for pyenv users)
Papers are stored in the following structure:
papers/
βββ {topic_name}/
βββ papers_info.json
Each papers_info.json contains:
{
"paper_id": {
"title": "Paper Title",
"authors": ["Author 1", "Author 2"],
"summary": "Abstract text...",
"pdf_url": "https://arxiv.org/pdf/...",
"published": "2024-01-15"
}
}Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
-
Import Error for mcp.server.fastmcp
- Ensure you have
mcp>=1.26.0installed - Try reinstalling:
pip install --upgrade mcp
- Ensure you have
-
Python Version Mismatch
- Check your Python version:
python --version - Must be Python 3.12 or higher
- Update
runtime.txtif deploying to a platform
- Check your Python version:
-
Papers Directory Not Found
- The
papers/directory is created automatically - Ensure you have write permissions in the project directory
- The
-
Dependency Conflicts
- Delete
venv/and reinstall:rm -rf venv python -m venv venv source venv/bin/activate pip install -r requirements.txt
- Delete
# Install in editable mode
uv pip install -e .
# Add a new dependency
# Edit pyproject.toml, then:
uv pip compile pyproject.toml -o requirements.txt
uv pip install -e .# Install in editable mode
pip install -e .
# Add a new dependency
pip install new-package
pip freeze > requirements.txtWhen deploying to platforms like Heroku, Render, or Railway:
- Ensure
runtime.txtspecifies the correct Python version - Use
requirements.txtfor dependency installation - Set environment variables if needed
- Ensure the
papers/directory is writable (or configure persistent storage)
# Create Heroku app
heroku create your-app-name
# Ensure files are present
# - runtime.txt (python-3.12.3)
# - requirements.txt
# Deploy
git push heroku mainMade with β€οΈ for the research community