{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/arxiv-mcp-server</h1>\n  <p><b>Search arXiv, fetch paper metadata, and read full-text content via MCP. STDIO or Streamable HTTP.</b>\n  <div>4 Tools • 2 Resources</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-1.5.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/arxiv-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/arxiv-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/arxiv-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/arxiv-mcp-server/releases/latest/download/arxiv-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=arxiv-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvYXJ4aXYtbWNwLXNlcnZlciJdfQ==) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22arxiv-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads/arxiv-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n<div align=\"center\">\n\n**Public Hosted Server:** [https://arxiv.caseyjhand.com/mcp](https://arxiv.caseyjhand.com/mcp)\n\n</div>\n\n---\n\n## Tools\n\nFour tools for searching and reading arXiv papers:\n\n| Tool Name | Description |\n|:----------|:------------|\n| `arxiv_search` | Search arXiv papers by query with category and sort filters. |\n| `arxiv_get_metadata` | Get full metadata for one or more arXiv papers by ID. |\n| `arxiv_read_paper` | Fetch the full text content of an arXiv paper from its HTML rendering, or from the PDF when no render exists. |\n| `arxiv_list_categories` | List arXiv category taxonomy, optionally filtered by group. |\n\n### `arxiv_search`\n\nSearch for papers using free-text queries with field prefixes and boolean operators.\n\n- Field prefixes: `ti:` (title), `au:` (author), `abs:` (abstract), `cat:` (category), `all:` (all fields)\n- Boolean operators: `AND`, `OR`, `ANDNOT`\n- Optional category filter, sorting (relevance, submitted, updated), and pagination\n- Category accepts a leaf code (`cs.CL`) or a whole archive (`astro-ph`, `cs`, `math`) — a bare archive covers its subject classes plus the legacy flat papers filed before it was subdivided\n- `submitted_from` / `submitted_to` bound the submission date (inclusive, UTC `YYYY-MM-DD`). Consecutive windows cover the matches with no gap — a paper submitted exactly at a midnight seam falls in both, so de-duplicate by ID — which is how to reach results past the 10,000 pagination ceiling\n- Echoes back the query as actually searched, with every filter folded in — replaying it reproduces the same result set\n- Returns up to 50 results per request with full metadata including abstract\n\n---\n\n### `arxiv_get_metadata`\n\nFetch full metadata for one or more papers by known arXiv ID.\n\n- Batch fetch up to 10 papers in a single request\n- Accepts both versioned (`2401.12345v2`) and unversioned (`2401.12345`) IDs\n- Legacy ID format supported (`hep-th/9901001`)\n- Reports not-found IDs separately from found papers\n\n---\n\n### `arxiv_read_paper`\n\nRead the full body of an arXiv paper.\n\n- Tries native arXiv HTML first, then ar5iv, then text extracted from the PDF — the `source` field reports which one answered\n- Strips HTML head/boilerplate and collapses MathML to dollar-delimited LaTeX (`$…$` inline, `$$…$$` block) so the character budget targets paper content\n- Returns raw HTML — no parsing or extraction; the LLM interprets content directly. PDF-extracted bodies are plain text: prose is reliable, but math, tables, and heading structure flatten\n- `max_characters` defaults to 100,000; pass `null` for the whole paper in one call. Raw HTML can be 500KB-3MB+ for math-heavy papers, which is more than most clients accept in a single tool result — page with `start` instead\n\n---\n\n### `arxiv_list_categories`\n\nList arXiv category codes and names for discovery.\n\n- ~155 categories across 8 top-level groups (cs, math, physics, q-bio, q-fin, stat, eess, econ)\n- Optional group filter to narrow results\n- Static data — always succeeds\n\n## Resources\n\n| URI Pattern | Description |\n|:------------|:------------|\n| `arxiv://paper/{paperId}` | Paper metadata by arXiv ID. Percent-encode a legacy ID's slash — `arxiv://paper/hep-th%2F9901001`. |\n| `arxiv://categories` | Full arXiv category taxonomy. |\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling across all tools\n- Pluggable auth (`none`, `jwt`, `oauth`)\n- Structured logging with optional OpenTelemetry tracing\n- Runs locally (stdio/HTTP) from the same codebase\n\narXiv-specific:\n\n- Read-only, no authentication required — arXiv API is free, metadata is CC0\n- Rate-limited request queue enforcing arXiv's 3-second crawl delay\n- Adaptive cooldown on rate-limit (5s → 10s → 20s → 30s), honors `Retry-After`\n- Retry with exponential backoff for transient failures\n- Content fallback chain: native arXiv HTML → ar5iv → PDF text extraction (both HTML renders run LaTeXML, so they tend to fail together; the PDF is the artifact every paper has, and it also covers an ar5iv outage rather than letting one fail the read)\n- Full arXiv category taxonomy embedded as static data\n- Optional local OAI-PMH metadata mirror (SQLite + FTS5) — opt-in, eliminates rate-limit exposure for `arxiv_search` and `arxiv_get_metadata`. See [Optional: Local Mirror](#optional-local-mirror).\n\n## Getting Started\n\n### Public Hosted Instance\n\nA public instance is available at `https://arxiv.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"arxiv-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://arxiv.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nAdd to your MCP client config (e.g., `claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"arxiv-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/arxiv-mcp-server@latest\"]\n    }\n  }\n}\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher.\n\n### Installation\n\n1. **Clone the repository:**\n```sh\ngit clone https://github.com/cyanheads/arxiv-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n```sh\ncd arxiv-mcp-server\n```\n\n3. **Install dependencies:**\n```sh\nbun install\n```\n\n## Configuration\n\nAll configuration is optional — the server works out of the box with sensible defaults.\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `ARXIV_API_BASE_URL` | arXiv API base URL. | `https://export.arxiv.org/api` |\n| `ARXIV_REQUEST_DELAY_MS` | Minimum delay between arXiv API requests (ms). | `3000` |\n| `ARXIV_CONTENT_TIMEOUT_MS` | Timeout for paper body fetches — HTML renders and PDF downloads (ms). | `30000` |\n| `ARXIV_API_TIMEOUT_MS` | Timeout for API search/metadata requests (ms). | `15000` |\n| `ARXIV_MIRROR_ENABLED` | Enable local OAI-PMH metadata mirror for search and metadata. | `false` |\n| `ARXIV_MIRROR_PATH` | SQLite path for the mirror. | `./data/arxiv-mirror.db` |\n| `ARXIV_MIRROR_REFRESH_CRON` | UTC cron expression for in-process daily refresh (HTTP mode only). | unset |\n| `ARXIV_MIRROR_FALLBACK_LIVE` | Fall through to live API on local ID-lookup miss. | `true` |\n| `ARXIV_MIRROR_RECENT_DAYS_LIVE` | Route `sortBy=submitted` descending queries within this window to the live API. | `2` |\n| `ARXIV_MIRROR_OAI_BASE_URL` | arXiv OAI-PMH endpoint base URL. | `https://oaipmh.arxiv.org/oai` |\n| `ARXIV_MIRROR_OAI_REQUEST_DELAY_MS` | Minimum delay between OAI-PMH requests (ms). | `3000` |\n| `ARXIV_MIRROR_REFRESH_TIMEOUT_MS` | Abort budget for one scheduled refresh subprocess (ms). | `7200000` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n\n## Running the Server\n\n### Local Development\n\n- **Build and run:**\n  ```sh\n  bun run build\n  bun run start:http   # or start:stdio\n  ```\n\n- **Run checks and tests:**\n  ```sh\n  bun run devcheck     # Lint, format, typecheck, audit\n  bun run test         # Vitest\n  ```\n\n### Optional: Local Mirror\n\nFor self-hosted deployments behind a single egress IP, arXiv's ~3-second per-IP crawl delay serializes concurrent users. An optional local mirror eliminates rate-limit exposure for `arxiv_search` and `arxiv_get_metadata` by serving from a SQLite + FTS5 store harvested via OAI-PMH. `arxiv_read_paper` continues to use the live API — full-content harvest is forbidden by arXiv's data policy.\n\nDisabled by default. To enable:\n\n```sh\n# 1. Cold-start harvest (~4.4h sequential, resumable from checkpoint). One-time per installation.\nbun run mirror:init\n\n# 2. Enable the mirror.\nexport ARXIV_MIRROR_ENABLED=true\n\n# 3. Start the server — reads switch to the mirror once the harvest completes.\nbun run start:http\n```\n\nDaily incremental refresh (small delta; duration depends on arXiv's OAI-PMH page pacing) via:\n\n```sh\nbun run mirror:refresh   # wire to cron / systemd timer / launchd, OR\n                         # set ARXIV_MIRROR_REFRESH_CRON to schedule it in HTTP mode (spawned as a child process)\nbun run mirror:verify    # schema version + PRAGMA integrity_check / quick_check\n```\n\n**Schema upgrades.** The mirror records a schema version and migrates itself in place the first time a newer server opens it — never a re-harvest, and never a separate operator step. The upgrade that added `comment` and `journal_ref` to the full-text index ([#37](https://github.com/cyanheads/arxiv-mcp-server/issues/37)) rebuilds that index from the rows already stored, so `co:` and `jr:` searches resolve against a mirror harvested before it. The rebuild runs at startup, before the store answers its first read, and logs `mirror migration v2→v3 (fts rebuild)` progress lines throughout — on a full-corpus mirror, expect the first start after the upgrade to take noticeably longer than usual. An interrupted rebuild is repeated on the next open rather than left half-applied. `bun run mirror:verify` prints the schema version the file carries and exits non-zero if a migration never completed.\n\n**Behavior notes.** Ranking divergence: FTS5 BM25 differs from arXiv's internal ranking, so `sortBy=relevance` against the mirror returns a different top-K than the live API. Queries sorted by `submitted` descending within `ARXIV_MIRROR_RECENT_DAYS_LIVE` days route to the live API to cover the nightly-update gap. Refresh resilience: after the initial cold harvest completes, an in-progress or failed daily refresh keeps serving the existing dataset from the mirror — `arxiv_search` and `arxiv_get_metadata` don't drop to the live API during the refresh window ([#21](https://github.com/cyanheads/arxiv-mcp-server/issues/21)). The scheduled HTTP-mode refresh runs in a child process, so the harvest's synchronous SQLite writes never block the request event loop — search and metadata stay responsive throughout ([#22](https://github.com/cyanheads/arxiv-mcp-server/issues/22)). The mirror stores the latest version only; per-version reads continue to use the live API. See [#12](https://github.com/cyanheads/arxiv-mcp-server/issues/12) for the full design.\n\n### Docker\n\n```sh\ndocker build -t arxiv-mcp-server .\ndocker run -p 3010:3010 arxiv-mcp-server\n```\n\n## Project Structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |\n| `src/mcp-server/resources/definitions/` | Resource definitions (`*.resource.ts`). |\n| `src/services/arxiv/` | `ArxivService` — live arXiv API client (search, metadata, HTML). |\n| `src/services/arxiv/mirror/` | Optional OAI-PMH mirror — harvester, SQLite + FTS5 store, query translator, runner. |\n| `src/config/` | Environment variable parsing and validation with Zod. |\n| `scripts/arxiv-mirror-*.ts` | Mirror lifecycle scripts (`init`, `refresh`, `verify`). |\n| `tests/` | Unit and integration tests. |\n| `docs/` | Design document and directory structure. |\n\n## Development Guide\n\nSee [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for domain-specific logging\n- Rate limiting is managed by `ArxivService` — don't add per-tool delays\n- arXiv API returns HTTP 200 for everything — check content-type and response body\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks before submitting:\n\n```sh\nbun run devcheck\nbun test\n```\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 13731,
  "sha": "cb12480f6ad5f282ac8d1830cb00eb7e301c6172742341e1ed45a3e2282696fd",
  "repo_slug": "cyanheads/arxiv-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_arxiv_mcp_server_214beadc/readme"
}