Skip to main content
Glama
chan4kum

ArXivLens MCP

by chan4kum
README.md
<div align="center">

# ๐Ÿ” ArXivLens MCP

### Autonomous Real-Time Academic Intelligence, Paper Discovery & Code-Implementation Mapping

[![CI Status](https://img.shields.io/badge/CI-Passing-brightgreen?style=for-the-badge&logo=github-actions)](https://github.com/chan4kum/arxivlens-mcp/actions)
[![Python Version](https://img.shields.io/badge/Python-3.10%20|%203.11%20|%203.12-blue?style=for-the-badge&logo=python)](https://python.org)
[![Protocol](https://img.shields.io/badge/Protocol-MCP%202.0-orange?style=for-the-badge&logo=anthropic)](https://modelcontextprotocol.io)
[![Framework](https://img.shields.io/badge/Framework-FastMCP%202.0-purple?style=for-the-badge)](https://gofastmcp.com)
[![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE)

*An enterprise-grade Model Context Protocol (MCP) server and client built with **FastMCP 2.0**, standardizing how AI agents scout research papers, extract structured insights, and verify open-source GitHub implementations in real time.*

---

[Key Features](#-key-features) โ€ข
[Architecture](#-architecture) โ€ข
[Real-Time Problem Statement](#-real-time-problem-statement) โ€ข
[Quickstart](#-quickstart) โ€ข
[Claude & Cursor Setup](#-claude--cursor-desktop-integration) โ€ข
[Interactive Agent](#-interactive-agent-cli)

</div>

---

## โšก Real-Time Problem Statement

Every day, hundreds of cutting-edge AI, Machine Learning, and Computer Science papers are published to arXiv, while corresponding open-source code repositories, benchmarks, and model checkpoints are scattered across GitHub, Hugging Face, and Papers With Code.

Researchers, AI engineers, and technical leads face three critical real-time challenges:
1. **Information Overload & Latency**: Finding newly dropped breakthrough papers in specific niches (e.g., test-time compute, reasoning models, KV-cache compression) before they get buried.
2. **The Implementation Gap**: Locating verified, highly-starred GitHub repositories and code implementations that correspond to an arXiv paper in real time.
3. **Synthesis & Evaluation Friction**: Manually downloading and reading 30-page PDFs just to extract key contributions, methodology gaps, and experimental baselines.
4. **Agent Integration Bottleneck**: LLM agents (Claude Desktop, Cursor, Custom Agents) lack standardized, safe, and live access to academic repositories and code-linkage databases.

**ArXivLens MCP solves this end-to-end** by exposing production-grade MCP Tools, dynamic Resources, and structured Prompts over standard transports (`stdio` and `SSE`).

---

## ๐ŸŽฏ Key Features

- **๐Ÿ” Live arXiv Search**: Real-time querying across arXiv's Atom 1.0 XML API with category filtering (`cs.AI`, `cs.LG`, `cs.CL`, `cs.CV`, `stat.ML`), author matching, and date sorting.
- **๐Ÿ’ป Automated Code Discovery**: Proactively scans GitHub for repositories implementing or referencing the paper, extracting star counts, languages, licenses, and direct URLs.
- **๐Ÿ“‘ Structured Research Briefs**: Synthesizes paper abstracts into executive 1-page briefs breaking down Problem Statement, Proposed Methodology, Key Contributions, Limitations, and Matching Code.
- **๐Ÿ“ก Dynamic MCP Resources**:
  - `arxiv://categories`: Catalog of supported research domains.
  - `arxiv://feed/{category}`: Live category paper feed.
  - `paper://{arxiv_id}/brief`: Dynamic markdown research brief for any paper ID.
- **๐Ÿง  Expert Prompt Templates**: Standardized prompt templates for systematic literature reviews, critical methodology peer-reviews, and reproducibility audits.
- **๐Ÿ–ฅ๏ธ Dual Interface**: Includes both a **FastMCP Server** and a **Rich Terminal Client** with an interactive autonomous agent loop.
- **โšก Zero-Cost Local Evaluation**: Built-in mock reasoning fallback allows testing and evaluation immediately without requiring paid API keys!

---

## ๐Ÿ—๏ธ Architecture

```mermaid
flowchart TD
    subgraph Clients["MCP Clients & AI Hosts"]
        Claude["Claude Desktop"]
        Cursor["Cursor AI"]
        TerminalCLI["ArXivLens CLI / Agent"]
        CustomAgent["LangChain / LlamaIndex / Agent Frameworks"]
    end

    subgraph Protocol["Model Context Protocol (MCP Transport)"]
        StdIO["stdio (Subprocess Pipe)"]
        SSE["SSE / HTTP Transport"]
    end

    subgraph Server["ArXivLens FastMCP 2.0 Server"]
        Router["FastMCP Request Dispatcher"]
        
        subgraph Capabilities["Server Primitives"]
            Tools["MCP Tools\nโ€ข search_arxiv\nโ€ข get_paper_details\nโ€ข find_code_repositories\nโ€ข generate_research_brief"]
            Resources["MCP Resources\nโ€ข arxiv://categories\nโ€ข arxiv://feed/{cat}\nโ€ข paper://{id}/brief"]
            Prompts["MCP Prompts\nโ€ข literature_review\nโ€ข paper_critique\nโ€ข reproducibility_audit"]
        end

        subgraph CoreServices["Internal Services"]
            ArxivSvc["ArxivService\n(Atom 1.0 XML Async Client)"]
            GitHubSvc["GitHubService\n(REST Search API & Matcher)"]
            BriefSvc["BriefService\n(Synthesis & Markdown Engine)"]
        end
    end

    subgraph Upstream["Upstream Real-Time Data Sources"]
        ArXivAPI["arXiv Official API\n(export.arxiv.org)"]
        GitHubAPI["GitHub Search API\n(api.github.com)"]
    end

    Clients --> Protocol
    Protocol --> Router
    Router --> Capabilities
    Tools --> CoreServices
    Resources --> CoreServices
    CoreServices --> ArXivAPI
    CoreServices --> GitHubAPI
```

---

## ๐Ÿš€ Quickstart

### 1. Installation

Clone the repository and install dependencies using `uv` (recommended) or `pip`:

```bash
git clone https://github.com/chan4kum/arxivlens-mcp.git
cd arxivlens-mcp

# Using uv (fastest)
uv sync

# Or using standard pip
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```

### 2. Configure Environment (Optional)

Copy `.env.example` to `.env`:

```bash
cp .env.example .env
```
*Tip: Adding a `GITHUB_TOKEN` increases your GitHub API rate limit from 60 req/hr to 5,000 req/hr.*

---

## ๐Ÿ’ป CLI & Interactive Client

ArXivLens comes out-of-the-box with an interactive CLI built with `rich`:

### Inspect Server Capabilities
Inspect all registered MCP tools, resources, and prompts:
```bash
uv run arxivlens-client inspect
```

### Real-Time Paper Search
```bash
uv run arxivlens-client search "DeepSeek-R1 reasoning" --max 3
```

### Generate Structured Research Brief
```bash
uv run arxivlens-client brief 1706.03762
```

### Find GitHub Code Repositories
```bash
uv run arxivlens-client code 1706.03762
```

### Autonomous Agent Loop
Launch the interactive terminal agent to scout papers and match code conversationally:
```bash
uv run arxivlens-client agent
```

---

## ๐Ÿ”Œ Claude & Cursor Desktop Integration

### Claude Desktop
Add this to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "arxivlens": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/arxivlens-mcp",
        "run",
        "arxivlens-server"
      ],
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}
```

### Cursor AI
1. Open **Cursor Settings > Features > MCP Servers**.
2. Click **Add New MCP Server**:
   - **Name**: `ArXivLens`
   - **Type**: `command`
   - **Command**: `uv --directory /absolute/path/to/arxivlens-mcp run arxivlens-server`

---

## ๐Ÿงช Testing

Run the comprehensive unit and integration test suite:

```bash
# Run pytest with coverage
uv run pytest -v tests/

# Run linter
uv run ruff check .
```

---

## ๐Ÿ“‚ Repository Structure

```
arxivlens-mcp/
โ”œโ”€โ”€ .github/workflows/ci.yml       # GitHub Actions automated CI
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ claude_desktop_config.json # Claude Desktop configuration
โ”‚   โ””โ”€โ”€ cursor_mcp.json            # Cursor AI configuration
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md            # In-depth architectural documentation
โ”‚   โ””โ”€โ”€ SETUP_GUIDE.md             # Integration guide for agents & hosts
โ”œโ”€โ”€ src/arxivlens/
โ”‚   โ”œโ”€โ”€ __init__.py                # Package exports
โ”‚   โ”œโ”€โ”€ server.py                  # FastMCP 2.0 Server (Tools, Resources, Prompts)
โ”‚   โ”œโ”€โ”€ client.py                  # FastMCP Client async wrapper
โ”‚   โ”œโ”€โ”€ cli.py                     # Rich terminal CLI & Agent loop
โ”‚   โ”œโ”€โ”€ models.py                  # Pydantic data models
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ arxiv_service.py       # Async arXiv Atom XML client
โ”‚       โ”œโ”€โ”€ github_service.py      # GitHub search & code matcher
โ”‚       โ””โ”€โ”€ brief_service.py       # Research brief synthesis engine
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ conftest.py                # Mock fixtures for offline testing
โ”‚   โ”œโ”€โ”€ test_services.py           # Unit tests for services
โ”‚   โ”œโ”€โ”€ test_server.py             # Server endpoints tests
โ”‚   โ””โ”€โ”€ test_client.py             # Client integration tests
โ”œโ”€โ”€ .env.example                   # Environment configuration template
โ”œโ”€โ”€ .gitignore                     # Git ignore patterns
โ”œโ”€โ”€ LICENSE                        # MIT License
โ”œโ”€โ”€ pyproject.toml                 # Packaging & CLI entrypoints
โ””โ”€โ”€ README.md                      # Project documentation
```

---

## ๐Ÿค Contributing

Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create your feature branch (`git checkout -b feature/amazing-feature`).
3. Run tests and linter (`uv run pytest && uv run ruff check .`).
4. Commit your changes (`git commit -m 'feat: add amazing feature'`).
5. Push to the branch (`git push origin feature/amazing-feature`).
6. Open a Pull Request.

---

## ๐Ÿ“œ License

Distributed under the **MIT License**. See [`LICENSE`](LICENSE) for more information.

---

<div align="center">
Built with โค๏ธ using <a href="https://gofastmcp.com">FastMCP 2.0</a> and <a href="https://modelcontextprotocol.io">Model Context Protocol</a>
</div>

TDQS

A3.9/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct stage of the research workflow: searching, retrieving metadata, finding code, and generating a synthesis. There is no meaningful overlap between tool purposes.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with clear, descriptive verbs: search, get, find, generate. The naming convention is uniform throughout.

Tool Count5/5

Four tools is well-scoped for an arXiv research assistant: search, detail retrieval, code discovery, and brief generation. Each tool earns its place and the set is neither bloated nor too thin.

Completeness5/5

The surface covers the full research journey from discovery to synthesis, including practical follow-up like finding code repositories. No obvious dead ends or missing lifecycle steps are apparent for this domain.

Maintenance

ActivityMaintained
ResponsivenessNo issues