Local read-write control of a Zotero library — from your terminal or your AI agent. No cloud, no API key.
Project description
zotero-agent
Full local control of your Zotero library — from your terminal or your AI agent.
No cloud, no account, no API key. Your library never leaves your machine.
zot gives you full read-write control of your local Zotero library:
search, bulk-edit metadata, tag, deduplicate, import by DOI/ISBN/arXiv, export,
enrich missing fields, and summarize PDFs into notes — scriptable from the shell
or drivable by an AI agent. It ships as a CLI, an MCP server, a Claude
Code skill, and portable AGENTS.md instructions.
Why it's different. Zotero's local HTTP API is read-only, so the popular tools (zotero-mcp, pyzotero) can only write through the zotero.org web API — which needs an account, an API key, and sync. zotero-agent writes locally through a tiny token-protected bridge plugin. Local, offline, private — and it finally does the bulk metadata editing people have asked Zotero for since 2016. See the honest comparison.
flowchart BT
U(["👤 you / AI agent"])
subgraph SURF ["zotero-agent (one package)"]
direction LR
MCP["MCP server (zot mcp)"]
SKILL["agent skill"]
CLI["zot CLI"]
end
READ["Zotero local API<br/>GET /api/… — fast, read-only"]
WRITE["bridge plugin<br/>POST /zotero-agent<br/>privileged JS · token-gated"]
LIB[("your local<br/>Zotero library")]
U --> SURF
SURF -->|read| READ
SURF -->|write| WRITE
READ --> LIB
WRITE --> LIB
Works with your agent
Anything that speaks MCP or can run a shell command can drive your library:
| Tool | How |
|---|---|
| Claude Code | the bundled zotero skill, or claude mcp add zotero-agent -- zot mcp |
| Claude Desktop | add zot mcp to claude_desktop_config.json |
| Codex CLI | ~/.codex/config.toml MCP entry, or it reads AGENTS.md and calls zot |
| Gemini CLI | ~/.gemini/settings.json MCP entry |
| Cursor | .cursor/mcp.json MCP entry |
| OpenCode / Windsurf / any MCP client | generic stdio server: command: "zot", args: ["mcp"] |
| Local models / custom agents | run the zot CLI directly (see AGENTS.md) — no MCP needed |
Per-client setup: docs/ai-agents.md · website.
Install
# 1) the CLI (pick one)
uv tool install zotero-agent # recommended
uv tool install "zotero-agent[mcp]" # + the MCP server (zot mcp)
pipx install "zotero-agent[mcp]"
brew install alex-roc/tap/zotero-agent
# 2) the bridge plugin in Zotero (one-click, no restart):
# Tools → Plugins → gear → "Install Plugin From File" → the .xpi from Releases:
# https://github.com/alex-roc/zotero-agent/releases/latest
# 3) wire it up
zot init # generates a token, writes config, auto-detects your userID
zot ping # local API up? bridge answering? userID known?
Requires Zotero 7+ (tested through 9.x) running with the local API enabled
(the default), and Python 3.9+. Full guide: docs/install.md.
Use it from the shell
zot search "bolivia" --limit 10 # fast local read
zot missing abstract --collection SS5MVVB6 # items lacking a field
zot stats # library analytics
zot add doi 10.1371/journal.pmed.0020124 --pdf # import + attach an OA PDF
zot dedupe --by title --fuzzy # find near-duplicate titles
zot enrich --field doi --dry-run # fill missing DOIs from Crossref
zot apply edits.jsonl # declarative batch edit (undoable)
zot undo last # roll it back
zot tag normalize --dry-run # fold case/space tag variants
zot export "My Collection" --format bibtex --out refs.bib
zot bib ABCD1234 @smith2020 --style apa # formatted bibliography (Zotero key or citekey)
Every command takes --json for scripting. Writes refuse to run
non-interactively without --yes. Full reference: docs/commands.md.
Commands at a glance
| Group | Commands |
|---|---|
| Read / analyze | search get cite pdf collections tags export missing author stats recent bib annotations related notes lint |
| Edit / organize | add dedupe tag (add/rm/rename/purge/normalize) set move collection note |
| Batch (undoable) | apply undo enrich |
| Setup / escape | ping init backup sync exec mcp completion |
Batch edits are undoable
zot apply takes a JSONL script (one edit per line) and snapshots every touched
item first, so you can reverse it:
{"key":"ABCD1234","set":{"date":"2021"},"addTags":["review"]}
{"key":"@smith2020","addToCollection":"To Read","removeTags":["old"]}
zot apply edits.jsonl --dry-run # preview (runs NO JS — cannot write)
zot apply edits.jsonl # apply, snapshotting first
zot undo last # restore exactly the prior state
This is how agents do LLM-assisted cleanup safely: the model decides the values
and writes the JSONL; zot performs the writes. The CLI never calls an LLM itself.
Use it from an agent
Ask your agent things like "tag every abstract-less item #review and merge
duplicate titles in collection X", "fill in missing DOIs", or "summarize this
paper's PDF chapter by chapter and save it as a note." It drives zot and
follows a safe workflow (backup → sync-off → dry-run → small batch), and batch
edits stay undoable.
Security
The bridge runs arbitrary privileged JavaScript inside Zotero — deliberately,
because it's the only complete local write path. It's gated by a required token,
a browser-origin/CSRF guard, loopback-only binding, and an append-only audit log.
This is a real capability: read docs/security.md before
installing. Report issues privately via SECURITY.md.
Documentation
- Website: https://alex-roc.github.io/zotero-agent/ (quickstarts, cookbook, reference)
docs/install.md·docs/ai-agents.md·docs/security.md·docs/architecture.md·docs/commands.md- JS recipe book:
skill/references/recipes.md
Contributing / development
git clone https://github.com/alex-roc/zotero-agent.git && cd zotero-agent
./install.sh # dev shim on PATH + skill + XPI + zot init
python3 -m unittest discover -s tests # tests: fake Zotero server, no network
uvx ruff check src tests cli/zot scripts
uv build # wheel + sdist
bash plugin/build.sh # rebuild the bridge XPI
The core is stdlib-only (the MCP server is the sole optional dependency).
See CONTRIBUTING.md and CHANGELOG.md.
License: MIT.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zotero_agent-0.2.1.tar.gz.
File metadata
- Download URL: zotero_agent-0.2.1.tar.gz
- Upload date:
- Size: 716.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a509f45f998d43576b38ef51d6b06653a43c0be1ef2a40f11561560b0434ae8a
|
|
| MD5 |
e4681f9cfd1e8f2ecdd49abf67f6fa9f
|
|
| BLAKE2b-256 |
7d5b76d1d2ea01b497a4909e1dd613fb4bc3d1f354b71e225190f3eeb72c6a95
|
Provenance
The following attestation bundles were made for zotero_agent-0.2.1.tar.gz:
Publisher:
release.yml on alex-roc/zotero-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zotero_agent-0.2.1.tar.gz -
Subject digest:
a509f45f998d43576b38ef51d6b06653a43c0be1ef2a40f11561560b0434ae8a - Sigstore transparency entry: 2235768884
- Sigstore integration time:
-
Permalink:
alex-roc/zotero-agent@4e7546aab80b4363347e5d911658560de7072952 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alex-roc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e7546aab80b4363347e5d911658560de7072952 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zotero_agent-0.2.1-py3-none-any.whl.
File metadata
- Download URL: zotero_agent-0.2.1-py3-none-any.whl
- Upload date:
- Size: 41.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3d8d308cc341ec3274819516b86121435a4d189c4d6549344100176264bef16
|
|
| MD5 |
d9d91e8eee46933d569eb482dd5e8b43
|
|
| BLAKE2b-256 |
85532e55c9193fea11b482829f310294500d8501e2d36c99f6e0b694a0227e03
|
Provenance
The following attestation bundles were made for zotero_agent-0.2.1-py3-none-any.whl:
Publisher:
release.yml on alex-roc/zotero-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zotero_agent-0.2.1-py3-none-any.whl -
Subject digest:
c3d8d308cc341ec3274819516b86121435a4d189c4d6549344100176264bef16 - Sigstore transparency entry: 2235769392
- Sigstore integration time:
-
Permalink:
alex-roc/zotero-agent@4e7546aab80b4363347e5d911658560de7072952 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/alex-roc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e7546aab80b4363347e5d911658560de7072952 -
Trigger Event:
push
-
Statement type: