lectio
Retrieves arXiv papers by ID, arXiv DOI, or URL, resolving full text through sources such as arxiv.org/html, ar5iv, TeX archives, or PDF and staging math-preserving Markdown/PDF for indexed section reading.
Resolves DOI targets via doi.org, OpenAlex, and optional Unpaywall to obtain verified open-access full text, PDFs, substantive OA HTML, or metadata-only records.
Fetches GitHub files by rewriting GitHub blob URLs to raw content, enabling retrieval of technical documents and repository files for reading.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
lectio
Full-text academic and technical literature reader CLI and stdio Model Context Protocol (MCP) server for coding agents.
lectio retrieves full primary sources across academic papers (arXiv, DOI, PMCID, PMID), formal specifications (IETF RFCs, Python PEPs, language RFCs), and technical web pages, normalizes them into math-preserving Markdown or confined local PDFs, and returns a compact (≤ 3,600 B) provenance header and line- or page-indexed Table of Contents so agents can read exact sections with read_file without flooding their context window.
Why lectio
Structured digital text before binary PDFs: Keyless open-access (OA) waterfalls prefer origin
text/markdown,LaTeXMLHTML (arxiv.org/html,ar5iv),Europe PMCJATSXML,RFCXMLv3, and flattenedTeXsource archives ahead of PDFs—preserving verbatimLaTeXequations, code listings, and GitHub-Flavored Markdown tables.Adaptive
20-page PDF workflow: When only a PDF exists,lectiostages the PDF with a companion<slug>.pages.mdbookmark/page map (pure-Rustlopdf, optionally enriched bypdftotextwhen present) and exposes lossless1–8-page vector PDF slicing (slice-pdf/slice_pdf) so multimodal agents inspect exact pages without attaching an entire40–150-page monograph.Epistemic honesty on closed-access works: Disjoint outcomes (
OKfull text,OKPDF, andMETADATA_ONLY) prevent agents from deriving unverified formulas from abstracts when no legal open-access copy exists.Zero-prompt least-privilege safety: Exposes read-only
GET/HEADnetwork retrieval with hop-by-hop IP-pinned SSRF validation, bounded decompression (25 MiBHTTP /40 MiBTeX archives /100 MiBlocal PDFs), zero-I/O XML DTD-bomb rejection, andopenat(O_DIRECTORY | O_NOFOLLOW)filesystem confinement blocking configured forbidden prefixes, VCS/credential directories, and agent configuration roots.
Related MCP server: paper-search-mcp
Installation
Standalone Binary (cargo-binstall or GitHub Releases)
cargo binstall lectioPrebuilt archives (x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-msvc) are attached to each GitHub Release.
Python cp310-abi3 Wheel (uv tool / Managed macOS)
On managed macOS hosts where binary authorization restricts standalone third-party executables, install the ad-hoc signed Apple Silicon cp310-abi3 wheel via Homebrew Python and uv:
uv tool install --python /opt/homebrew/opt/python@3.13/bin/python3.13 lectioFrom Source
cargo install --locked --path .Usage
CLI
# Fetch an arXiv paper, DOI, PMCID, PMID, IETF RFC, GitHub file, or web URL
lectio fetch 2409.13740
lectio fetch 10.1038/s41586-025-10072-4 -o /tmp/lit
lectio fetch 2409.13740 --no-pdf-index
lectio fetch PMC11456789
lectio fetch "RFC 9110"
lectio fetch https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md
# Extract a lossless 1..=8-page vector slice from a staged PDF
lectio slice-pdf /tmp/lectio-1000/paper.pdf -p 8-10
lectio slice-pdf /tmp/lectio-1000/paper.pdf -p 8-10 -o /tmp/lit
# Start the newline-delimited JSON-RPC 2.0 stdio MCP server or print version
lectio mcp
lectio --versionCLI exit codes: 0 on success (including BrokenPipe / EPIPE on stdout), 1 on operational, safety, or filesystem errors, and 2 on argument usage errors.
Stdio MCP Configuration
Register lectio mcp with an absolute executable path in your agent's mcp_config.json:
{
"mcpServers": {
"lectio": {
"command": "/absolute/path/to/lectio",
"args": ["mcp"]
}
}
}(When bundling inside a plugin manifest that namespaces servers by plugin ID, the server key may be shortened—for example "mcp" under a lectio plugin.)
The MCP server negotiates protocol versions 2025-06-18, 2025-03-26, and 2024-11-05 and exposes two read-only tools:
fetch({ target, output_dir?, include_pdf_index? })(readOnlyHint: true,openWorldHint: true)slice_pdf({ pdf_path, start_page, end_page?, output_dir? })(readOnlyHint: true,openWorldHint: false)
Supported Retrieval Waterfalls
Target Family | Examples | Resolution Precedence |
arXiv |
| Atom metadata → |
DOI |
|
|
PMCID / PMID |
| Europe PMC metadata + JATS |
IETF RFC |
| IETF Datatracker ( |
Web / GitHub |
| GitHub |
Environment Variables
Variable | Purpose |
| Optional default staging directory (validated against forbidden prefixes, VCS/config roots, and over-broad |
| Optional OS path-list ( |
| Optional OS path-list of additional absolute path prefixes where staging is blocked fail-closed. |
| Optional comma-separated host suffixes blocked from outbound HTTP(S) retrieval (exact domain and subdomains). |
| Optional non-placeholder email enabling Unpaywall v2 and OpenAlex polite-pool |
| Truthy value ( |
| Standard uppercase/lowercase HTTP(S) proxy configuration (SOCKS proxies are rejected explicitly). |
Architecture & Development
lectio is structured around a compile-time-verified component DAG in src/architecture.rs checked by tests/architecture_conformance.rs:
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo doc --workspace --no-deps
omnicoach codeReferences
PaperQA2 (Skarlinski et al., 2024) — Full-text staging and contextual summarization ahead of synthesis.
OpenScholar (Asai et al., Nature 2026) — Full-text passage retrieval and citation verification.
ReadAgent (Lee et al., 2024) — Compact gist Table of Contents paired with verbatim section lookup.
Model Context Protocol Specification (
2025-06-18) — Newline-delimited JSON-RPC2.0stdio transport and batch-array removal.ISO 32000-1:2008 PDF 1.7 Specification, §7.7.3.4 — Inheritable
/Pagesattributes materialized during PDF slicing.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Papers, SEC filings, Wikipedia, HN and web reading for research agents. 15 tools, x402.
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
Source-backed prompting and coding-agent guidance with provenance and freshness checks.
SEC filings, Wikipedia, arXiv, US Census and more for AI agents, with every answer source-linked.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables LLMs to search, download, and read arXiv papers with automatic PDF text extraction and section filtering. Provides AI assistants direct access to scientific literature with local caching for fast re-access.334 PyPI1MIT
- FlicenseAqualityDmaintenanceEnables agents to search papers across Semantic Scholar and arXiv, read and extract text from arXiv PDFs, align records across sources, and produce structured literature-analysis digests.101-
- AlicenseNot gradedqualityBmaintenanceConverts DOIs and arXiv IDs into local PDFs via official open-access APIs, designed as an agent-facing companion for academic paper retrieval.2MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to retrieve the full text of research articles as downloadable files from DOIs, arXiv, PubMed Central, or OpenReview identifiers, falling back automatically across publisher APIs, open-access aggregators, and polite scraping. It supports single and concurrent batch requests, verifies the returned file matches the requested paper, can include supplementary files, and reports which source produced each result.66 PyPI30BSD 3-Clause