arxiv-mcp-server
- Type
- MCP server
- Scanned
- Nov 12, 2026
- Version
- 572e301bb319
- Files read
- 114
This MCP server searches arXiv, downloads and reads academic papers as Markdown or original LaTeX sections, builds citation graphs via Semantic Scholar, and monitors watched research topics. Because paper text and LaTeX come from external authors, the main risks are untrusted paper content attempting prompt injection against the AI agent and crafted LaTeX macros exhausting memory when source archives are parsed.
What it can reach
- Files
- Reads and writes downloaded paper Markdown, metadata sidecars, LaTeX source caches, citation graph caches, watched topics, and an optional semantic search SQLite index inside ~/.arxiv-mcp-server/papers (or the directory passed to --storage-path).
- Network
- Makes HTTPS requests to arxiv.org, export.arxiv.org, and api.semanticscholar.org (plus Hugging Face for the all-MiniLM-L6-v2 model when the optional pro extra is installed), and optionally listens on 127.0.0.1:8000 if TRANSPORT=http is configured.
- Secrets
- Reads the optional SEMANTIC_SCHOLAR_API_KEY environment variable and sends it in the x-api-key header to api.semanticscholar.org.
Findings
-
LowUnbounded LaTeX macro expansion can exhaust memory
src/arxiv_mcp_server/tools/latex_flatten.py:146
When parsing LaTeX sources downloaded from arXiv, _expand_title_macros and _expand_macros_once expand nested TeX macros for up to eight rounds without checking the growing string size during each round. A small crafted TeX file in an arXiv source archive with chained macro definitions (including inside conditional blocks ignored by arXiv's TeX compiler) can expand exponentially into gigabytes of text before size caps are checked, causing out-of-memory crashes or hangs in the MCP server.
Fix: Track the running output character count inside _expand_macros_once as replacements are appended and raise SourceArchiveLimitError immediately when the accumulated length exceeds MAX_SECTION_TITLE_CHARS for section titles or MAX_FLATTENED_CHARS for document bodies.
