Content
# arxiv_mcp
An MCP tool for searching and downloading arXiv papers based on the arXiv library.
## Overview of Functions
Provides three core MCP tool functions:
- **query_paper**: Search for arXiv papers based on keywords
- **download_paper**: Download papers (supporting PDF or LaTeX formats)
- **search_download**: Supplementary download (continue the current unfinished download when the download_paper cache is not hit)
## Install Dependencies
```bash
pip install mcp pydantic arxiv
```
## MCP Access Configuration (Opencode Edition)
Modify the parameters in `opencode.json`:
```json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"arxiv_mcp": {
"type": "local",
"command": ["python.exe interpreter absolute path", "MCP code arxiv_mcp.py absolute path"],
"enabled": true,
"environment": {
"DOWNLOAD_PATH": "absolute path of default paper save location"
}
}
}
}
```
## SKILL Access
SKILL.md provides query statement rules. To enhance the query capabilities of large models, it is strongly recommended to use SKILL.md in conjunction.
## MCP Function Content
### 1. query_paper
Search for papers based on the query statement.
**Parameters:**
- `query`: Search keywords/expressions (supporting arXiv native retrieval syntax)
- Single keyword: `"transformer"`
- Multiple conditions: `"title:transformer AND author:attention"`
- List form: `["transformer", "attention"]` (OR logic)
- `max_results`: Maximum number of papers returned (default 5)
- `sort_by`: Sorting rules
- `arxiv.SortCriterion.Relevance` (relevance, default)
- `arxiv.SortCriterion.SubmittedDate` (submission time)
- `arxiv.SortCriterion.LastUpdatedDate` (last updated time)
- `sort_order`: Sorting order
- `arxiv.SortOrder.Descending` (descending)
- `arxiv.SortOrder.Ascending` (ascending)
**Return Value:**
```python
{
"id": "complete paper ID (including version number)",
"title": "paper title",
"abstract": "paper abstract",
"categories": ["cs.CL", "cs.LG"],
"authors": ["author1", "author2"],
"pdf_url": "https://arxiv.org/pdf/...",
"publish_date": "2026-04-27 17:23:37+00:00",
"journal_ref": None,
"doi": None
}
```
### 2. download_paper
Download the specified paper.
**Parameters:**
- `target_num`: Number of papers to be downloaded
- `target_id`: List of arXiv IDs of papers to be downloaded
- `file_type`: Download format (`"PDF"` or `"LaTeX"`, default `"PDF"`)
- `dir`: Save path (default using environment variable `DOWNLOAD_PATH`)
**Return Value:**
- Success:
```python
{
"download_result": "success",
"message": "download completed, total download quantity: 1, save location: ..."
}
```
- Failure:
```python
{
"download_result": "error",
"message": "error message",
"undo_ids": ["list of arXiv IDs that were not downloaded"]
}
```
### 3. search_download
Supplementary download when the `download_paper` cache is not hit.
**Parameters:**
- `target_num`: Number of papers to be downloaded
- `undo_ids`: List of arXiv IDs that were not downloaded
- `file_type`: Download format
- `dir`: Save path
**Return Value:** Same as `download_paper`
## Query Syntax Reference
| Field | Description |
|------|------|
| `ti` | Title |
| `au` | Author |
| `abs` | Abstract |
| `cat` | Category |
| `doi` | DOI number |
| `all` | Match all fields |
**Logical Operators:** `AND`, `OR`, `NOT`, `*` (wildcard)
**Examples:**
- `ti:LLM AND cat:cs.CL` - Find papers with LLM in the title and in the cs.CL category
- `all:transformer` - Search all fields for transformer
- `submittedDate:[2024 TO 2025]` - Find papers submitted between 2024 and 2025
Use the `stdio` transmission protocol to directly integrate with the MCP client.