zotero-fulltext-mcp

zotero-fulltext-mcp

Enables searching and reading full text of papers in a Zotero library by converting PDF attachments to Markdown and exposing a full-text search index to LLM tools.

Category
访问服务器

README

zotero-fulltext-mcp

Convert a Zotero library's linked PDF attachments to Markdown, build a full-text search index, and expose it to LLM tools (Claude Code, Codex, etc.) through an MCP server — so an assistant can search and read your papers' full text, not just their metadata.

The pipeline is read-only with respect to Zotero: it never writes to your live zotero.sqlite except through the optional, approval-gated zotero-write workflow. Everything else reads Zotero's data and writes only to a separate converted_text output folder that you control.

Prerequisites

  • Python 3.11+.
  • A Zotero library that uses linked attachments (Zotero.Attachments.linkFromFile, i.e. PDFs stay in a folder you choose rather than Zotero's internal storage/). Stored/managed attachments are not the tested path for this project.
  • Windows is the primary, verified platform. macOS/Linux are supported in the code (path resolution, process detection) but not yet verified end-to-end — see "Cross-platform notes" below.

Install

Create a virtual environment outside this repository — a venv contains a machine-specific absolute Python path and compiled dependencies, so keeping it inside a folder you might sync or re-clone elsewhere just produces a broken venv there.

py -3.11 -m venv C:\Users\you\.venvs\zotero_fulltext_mcp
C:\Users\you\.venvs\zotero_fulltext_mcp\Scripts\python.exe -m pip install -U pip
cd C:\path\to\zotero_fulltext_mcp
C:\Users\you\.venvs\zotero_fulltext_mcp\Scripts\python.exe -m pip install -e .[mcp]
$python = C:\Users\you\.venvs\zotero_fulltext_mcp\Scripts\python.exe

macOS/Linux:

python3.11 -m venv ~/.venvs/zotero_fulltext_mcp
~/.venvs/zotero_fulltext_mcp/bin/python -m pip install -U pip
cd /path/to/zotero_fulltext_mcp
~/.venvs/zotero_fulltext_mcp/bin/python -m pip install -e '.[mcp]'
python=~/.venvs/zotero_fulltext_mcp/bin/python

Optional extras: [zotero-write] (write-plan workflow via pyzotero), [marker] (marker-pdf, needed for reconvert-math/reconvert_with_math_ocr, GPU-bound), [test] (pytest, needed to run the test suite — pip install -e .[mcp,test]). A plain pip install -e . with no extras gets you the conversion pipeline and CLI but not the MCP server.

Configure

Copy the template and fill in your own paths:

Copy-Item config.example.json config.json

Edit config.json:

  • zotero_root — a working folder for this project's own outputs/reports.
  • zotero_data_directory — your local, non-synced Zotero data directory (where zotero.sqlite lives). Never point this at a cloud-synced folder (Dropbox, Nextcloud, OneDrive, etc.) — see docs/architecture.md for why.
  • linked_attachments — the folder your Zotero library links PDFs from (baseAttachmentPath in Zotero's settings).
  • output_root — where converted Markdown and the search index get written.

If you run this from more than one machine, name each machine's config config.<hostname>.json (Python's platform.node()) instead of hand-maintaining separate files — zotero-pdf-text picks the right one automatically. You can also point at any config file explicitly via the ZOTERO_PDF_TEXT_CONFIG environment variable, which takes priority over both the hostname-based file and the plain config.json fallback. This is the mechanism to use when your config/data live somewhere other than next to this repo checkout.

Build the index

& $python -m zotero_pdf_text ensure-zotero
& $python -m zotero_pdf_text dry-run --config .\config.json
& $python -m zotero_pdf_text convert-new --config .\config.json

convert-new runs mapping, conversion, and index updates together for newly linked verified PDFs, and is the incremental command you'll run repeatedly as you add papers. See docs/operations.md for the full command reference (sampling, manual review of unverified matches, rebuilding vs. appending to the index, etc.) and docs/architecture.md/ docs/data-dictionary.md for how the pipeline and schema fit together.

Smoke-test the index directly:

& $python -m zotero_pdf_text search-fts --db .\converted_text\index\zotero_text_index.sqlite --query "some topic" --limit 3

Register the MCP server

& $python -m zotero_pdf_text install-mcp --config .\config.json

This resolves the current venv's zotero-fulltext-mcp executable, your config, and the FTS database path, then prints a ready-to-paste claude mcp add command and a Codex config.toml block — no manual path editing. Add --apply to also run the Claude Code registration for you (falls back to printing the command if claude isn't on PATH). Codex's config.toml is never edited automatically; paste the printed block in yourself.

Verify:

claude mcp get zotero-fulltext

Expected status: Connected.

Tool contract

The server exposes:

  • ensure_zotero_running — check/start the Zotero application.
  • search_fulltext(query) — ranked full-text search with bounded snippets.
  • get_fulltext_chunk(attachment_key) — full converted text for one paper.
  • get_item_context(parent_key | attachment_key) — sidecar metadata (title, authors, DOI, citation key, file paths).
  • coverage_report() — how many items are indexed vs. total, including has_math counts.
  • export_bibtex_entries_by_key(citation_keys) — Better BibTeX/BibLaTeX entries by citation key (requires Zotero + Better BibTeX running locally).
  • reconvert_with_math_ocr(attachment_key) — re-extract one paper with marker-pdf when equations/figures look garbled; blocking, GPU-bound, just-in-time only (see the server's own tool description for the reasoning against bulk use).

Companion MCP server: pairing with the official Zotero MCP

This server is deliberately scoped to offline full-text search over a pre-built index — it works even when Zotero and its connector are closed, and it never talks to Zotero's live API. It does not expose collections, tags, notes, or other live metadata.

For that, install the official Zotero MCP server alongside this one — the two are meant to be used together, not merged:

  • This server (zotero-fulltext-mcp): full-text search and retrieval from the sidecar index.
  • Official Zotero MCP: live collections, tags, notes, child attachments, Zotero URIs. Requires Zotero running.

If the official server's connector is down, zotero-fulltext-mcp tools remain fully functional since they never depend on it.

Optional: write-side workflows (debug-bridge, ZotMoov)

import-doi, find-pdf, and link-pdf (CLI commands, also documented in the MCP server's own instructions for use mid-conversation) drive Zotero's UI-equivalent actions through the debug-bridge plugin — see docs/debug-bridge-setup.md for setup, including generating your own bridge token. link-pdf additionally uses the ZotMoov plugin to relocate linked files into your managed linked_attachments folder. Both are optional; core search/conversion works without them.

Cross-platform notes

  • Zotero executable auto-detection (--zotero-exe default) and process-name checks (ensure_zotero_running) are Windows-verified. macOS (/Applications/Zotero.app/...) and Linux (/usr/lib/zotero/zotero) defaults are best-effort, untested guesses — pass --zotero-exe explicitly if the default doesn't match your install.
  • Dependencies (pyproject.toml) are minimum-pinned (>=) only, with no lockfile and no tested upper bounds.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选