paperstack
Enables arXiv paper search, PDF download, text extraction, and context chunking for LLM pipelines, along with advanced features like citation graphs and reproducibility scoring.
README
paperstack (Model Context Protocol)
Overview
paperstack is a production-grade Model Context Protocol (MCP) server focused on arXiv research retrieval.
It provides:
- arXiv Atom API search by ID/query
- PDF download, validation, and cache
- PDF text extraction (title, abstract, body, references)
- Token-aware context chunking for LLM pipelines
- CLI, API, and autonomous agent integration support
Table of Contents
- Quickstart
- Installation
- Usage
- MCP Server
- Project structure
- Configuration
- Testing
- Troubleshooting
- Contributing
- License
Quickstart
1. Clone repository
git clone https://github.com/Aldrin-Joan/paperstack.git
cd paperstack
2. Set up Python environment (recommended)
python -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
3. Install dependencies
pip install -r requirements.txt
4. Run smoke test
python test_smoke.py
Installation
From source:
pip install -e .
From PyPI:
pip install paperstack-mcp
Usage
CLI
paperstack --help
Run server locally:
python -m src.mcp_server
Python API
from paperstack_mcp import entrypoint # import alias for the package
from src.arxiv_client import ArxivClient
from src.pdf_fetcher import PdfFetcher
from src.pdf_parser import PdfParser
from src.context_builder import ContextBuilder
client = ArxivClient()
results = client.search('quantum computing', max_results=3)
pdf_path = PdfFetcher().fetch_paper(results[0].id)
parsed = PdfParser().parse(pdf_path)
context = ContextBuilder().build(parsed)
print(context.summary)
Architecture Layers
| Layer | Features |
|---|---|
| Layer 1 — retrieval (both tools have this) | Search · PDF fetch + cache · Text extraction + chunking |
| Layer 2 — intelligence (your opportunity) | Citation graph · Concept extraction · Cross-paper synthesis |
| Layer 3 — dev tooling (highly unique) | Code + dataset links · Implementation diff · Reproducibility audit |
| Layer 4 — research workflows (unique) | Reading lists · Topic tracking + alerts · Agent-ready Q&A |
MCP Server
src/mcp_server/__main__.py starts an MCP tool server exposing:
arxiv_search(query or ID expand)arxiv_fetch_pdf(download + cache)arxiv_parse_pdf(extract text and metadata)arxiv_build_context(chunk to LLM-friendly context)arxiv_citation_graph(author/paper citation network)arxiv_extract_contributions(structured contribution extractor)arxiv_semantic_index(semantic similarity index builder/query)arxiv_compare_papers(paper comparison report)arxiv_extract_code_links(discover official GitHub/HuggingFace/Kaggle links from a paper)arxiv_reproducibility_score(reproducibility heuristic score with evidence details)arxiv_diff_implementations(compare paper method claims against a GitHub implementation)arxiv_reading_list(persistent reading list CRUD and filters)arxiv_watch_topic(watch query topics and detect new papers)arxiv_explain_for_audience(audience-specific explanation synthesis)
Use any MCP-capable client (VS Code MCP extension, custom agent SDK) to connect.
VS Code MCP server setup
In VS Code, add an MCP server entry to your workspace settings (e.g., .vscode/settings.json):
{
"servers": {
"arxiv-mcp": {
"command": "D:/Softwares/Anaconda3/python.exe",
"args": ["-m", "src.mcp_server"],
"cwd": "${workspaceFolder}",
"env": {
"PYTHONPATH": "${workspaceFolder}",
"ARXIV_DOWNLOAD_DIR": "${workspaceFolder}/downloads",
"ARXIV_KEEP_PDFS": "true",
"CHUNK_SIZE_TOKENS": "800",
"CHUNK_OVERLAP_TOKENS": "100",
"ARXIV_RATE_LIMIT_DELAY": "3.0",
"MAX_RETRIES": "3",
"HTTP_TIMEOUT": "60"
}
}
}
}
MCP JSON entry for paperstack-mcp
If you installed from PyPI (pip install paperstack-mcp), the MCP server command can be the package executable instead of a direct Python module path. In .vscode/mcp.json or your .code-workspace settings, use an entry like:
{
"servers": {
"paperstack-mcp": {
"command": "paperstack-mcp",
"args": [],
"cwd": "C:\\path\\to\\your\\project",
"env": {
"PYTHONPATH": "C:\\path\\to\\your\\project",
"ARXIV_DOWNLOAD_DIR": "C:\\path\\to\\your\\project\\downloads",
"ARXIV_KEEP_PDFS": "false",
"CHUNK_SIZE_TOKENS": "800",
"CHUNK_OVERLAP_TOKENS": "100",
"ARXIV_RATE_LIMIT_DELAY": "3.0",
"MAX_RETRIES": "3",
"HTTP_TIMEOUT": "60"
}
}
}
}
Adjust values for your local path, rate limit, and retry/timeouts.
- Run
pip install paperstack-mcpfirst. - Ensure workspace
cwdandPYTHONPATHpoint to the project root. - Customize
ARXIV_DOWNLOAD_DIRfor your downloaded PDF cache location.
Adjust values for your local path, rate limit, and retry/timeouts.
-
Run
pip install paperstack-mcpfirst. -
Ensure workspace
cwdandPYTHONPATHpoint to the project root. -
Customize
ARXIV_DOWNLOAD_DIRfor your downloaded PDF cache location. -
ARXIV_DOWNLOAD_DIR: local storage for downloaded PDFs. -
ARXIV_KEEP_PDFS: keep cached PDFs after parse. -
CHUNK_SIZE_TOKENS/CHUNK_OVERLAP_TOKENS: controls text-chunking in context builder. -
ARXIV_RATE_LIMIT_DELAY: delay between arXiv API calls. -
MAX_RETRIES,HTTP_TIMEOUT: network robustness.
You can apply this configuration also in other compatible MCP clients using their server configuration schema.
Project structure
src/- package sourcearxiv_client/- arXiv Atom API logicpdf_fetcher/- download/cache PDFpdf_parser/- extract/clean PDF textcontext_builder/- tokenization + chunkingmcp_server/- MCP protocol/adapters
tests/- pytest suiterequirements.txt- dependenciespyproject.toml- package metadata
Configuration
Environment variables:
ARXIV_CACHE_DIR(default:./downloads)ARXIV_CACHE_TTL(default:604800seconds / 7 days)ARXIV_DB_PATH(default:${ARXIV_DOWNLOAD_DIR}/arxiv_mcp.db) path to the SQLite workflow databaseARXIV_RATE_LIMIT(default:1request/sec)S2_API_KEY(optional; Semantic Scholar API key for higher rate limits)OLLAMA_BASE_URL(default:http://localhost:11434)OLLAMA_MODEL(default:mistral)SEMANTIC_INDEX_DIR(default:${ARXIV_DOWNLOAD_DIR}/semantic_index)CITATION_CACHE_TTL(default:86400seconds / 24 hours)CONTRIBUTION_CACHE_TTL(default:604800seconds / 7 days)EMBEDDING_MODEL(default:sentence-transformers/all-MiniLM-L6-v2)GITHUB_TOKEN(optional; for GitHub API auth, improves 60 -> 5000 req/hour)LINK_CACHE_TTL(default:172800seconds / 48 hours)REPRO_CACHE_TTL(default:604800seconds / 7 days)DIFF_CACHE_TTL(default:86400seconds / 24 hours)GITHUB_MAX_FILES(default:20)GITHUB_MAX_FILE_SIZE_KB(default:50)
Set in shell or via .env before running.
Testing
Run full tests:
pytest -q
Smoke test:
python test_smoke.py
Troubleshooting
arxiv-mcpcommand not found: ensure virtualenv is active and package installed- PDF download failure: check network access to
https://arxiv.org/pdf/ - Rate-limit errors: lower request frequency or adjust
ARXIV_RATE_LIMIT - Topic duplicates observed after repeated tests: use
DatabaseClient.reset()on workflow DB and/ortopic_watcher.addnow enforces dedupe by(query, label). - Reading list duplicate notes:
ReadingListManager.addnow avoids re-appending identical note blocks. - Ollama not available fallback:
_passthroughnow uses arXivmetadata.abstractfor all explanation fields (what_it_is/problem_solved/how_it_works/why_it_matters/key_result). - Dependency pin check:
pip install -r requirements.txtincludesprotobuf==3.20.3andurllib3>=2.0.0,<3to avoid known warning/conflict cases (TensorFlow + ChromaDBMessageFactoryand RequestsRequestsDependencyWarning). - Smoke harness summary:
scripts/run_all_tools.pyprints final status with count of run/passed/failed tools.
Contributing
- Fork repo
- Create feature branch
- Add tests and update README
- Open PR
Follow style checks (Black, formatting and lint).
License
Apache-2.0
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。