zotero-cloudflare-mcp
Provides tools to search and read a Zotero library via the Zotero Web API, including items, collections, tags, notes, recent additions, library stats, and PDF full text; optional write tools can add items, notes, tags, collections, and attach PDFs, and extracted PDF text can be saved back to Zotero's full-text index.
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.
zotero-cloudflare-mcp
Self-hosted remote MCP server for your Zotero library, running on your own Cloudflare account. Claude can search your library and read your PDFs from the claude.ai website, the Claude phone apps, Claude Desktop and Claude Code, without Zotero desktop running.
Not affiliated with, endorsed by or sponsored by Zotero or the Corporation for Digital Scholarship. "Zotero" is used only to describe what this software connects to.
What it does
Searches and reads your library through the Zotero Web API: items, collections, tags, notes, recent additions.
Reads PDF text page by page and in chunks, so long papers don't flood the conversation.
Indexes PDFs Zotero hasn't indexed. Zotero's API only has full text for PDFs that Zotero desktop has already processed. This server downloads the PDF itself, extracts the text and saves it back to Zotero's full-text index, so it becomes searchable everywhere, including in Zotero itself. An hourly background job does this for new PDFs, so papers you add from your phone become searchable without asking.
Sign-in with GitHub, limited to the GitHub usernames you list. Works as a claude.ai custom connector.
Read-only by default. Optional write tools (add items, add notes, add/remove tags and collections) are off unless you turn them on. There are no delete tools.
Optional WebDAV file storage on Cloudflare R2 (packages/webdav) as a cheaper alternative to Zotero Storage. The MCP server can read PDFs from either.
Tools
Tool | What it returns |
| Matching items (title, creators, year, venue, DOI, tags, short abstract), with paging. |
| Full metadata of one item plus its attachments and notes. |
| All collections with their full path and item counts. |
| Items in one collection. |
| Tags with item counts. |
| Most recently added or modified items. |
| Counts of items, attachments, notes, collections, tags, indexed PDFs. |
| Text of an item's PDF, by page range ( |
| Creates an item from metadata. |
| Adds a note to an item, or a standalone note. |
| Adds/removes tags, adds/removes collections, edits fields. Never replaces the whole tag or collection list; refuses if the item changed in the meantime. |
| Downloads a PDF and attaches it to an existing item, after automatic safety and match checks (see Attaching PDFs). |
* Only when ENABLE_WRITES is "true".
Limits
Citation keys are not searchable. Zotero's quick search doesn't index them (e.g. Better BibTeX keys). Search by title, author or year instead.
Scanned PDFs without a text layer are detected and reported, but not OCR'd.
PDFs over 30 MB are skipped (change with
MAX_PDF_MB; Workers have 128 MB of memory).Linked files (files that live only on one computer, not synced to Zotero Storage or WebDAV) can't be read.
Personal library only. Group libraries are not supported in this version.
The background job indexes 5 PDFs per hour by default (
INDEX_PER_RUN, up to 20) and looks at the 2,000 most recent attachments. A large backlog of older, unindexed PDFs takes a while. Any PDF is indexed immediately when Claude reads it withget_item_fulltext.
Costs
Needed? | Cost | |
Cloudflare Workers Paid plan | Yes, for PDF text extraction and background indexing | US$5/month, includes far more requests and CPU time than one person uses |
Workers KV (2 namespaces) | Yes | Within the included allowance for personal use |
R2 (WebDAV file storage) | Optional | First 10 GB free, then about US$0.015 per GB-month |
Workers AI (fallback text extractor) | Optional, off by default | Pay per use |
Zotero Storage | Only if you use it for files | Free up to 300 MB, paid plans beyond |
GitHub account and OAuth App | Yes, for sign-in | Free |
On the Workers Free plan (10 ms CPU per request) the metadata tools should work, but reading or indexing PDFs will fail, because extracting a typical paper takes 100–700 ms of CPU. Check Cloudflare's Workers pricing for current numbers.
Related MCP server: zotero-mcp
How PDF text works
When Claude asks for an item's text:
If this server extracted the PDF before, the stored text (with page boundaries) is used.
Otherwise, if Zotero already has indexed full text, that is used.
Otherwise the PDF is downloaded, from the R2 WebDAV bucket if configured (Zotero stores each file there as
zotero/KEY.zip), otherwise from Zotero Storage.Text is extracted page by page with unpdf (PDF.js) inside the Worker. In tests on real papers this took 0.1–0.25 s per paper in the Workers runtime and keeps page boundaries, which page ranges need. Workers AI's
toMarkdown()can be enabled as a fallback for PDFs unpdf can't open; it returns text without page boundaries and was not tested against real papers for this release.The text is written back to Zotero (
PUT …/fulltext) with page breaks, so Zotero search (qmode: everything) and all your Zotero apps can find it. If your API key can't write, the text is kept in the server's KV cache instead. Text that Zotero desktop indexed is never overwritten.
Attaching PDFs from a link
attach_pdf_from_url (write tools only) attaches a PDF to an item that already exists. It runs these checks automatically and refuses with the specific reason if any fail. Nothing is created in Zotero until every check has passed.
The link:
https://only; no local or private network addresses; 30-second download limit; the size cap (MAX_PDF_MB).It's really a PDF: checked from the file's contents, not the website's label. Login pages, paywalls and landing pages are recognised and refused ("the link returned a web page, not a PDF").
No risky features. Refused if the PDF contains JavaScript, a Launch action (can start programs), embedded files, Flash or other rich media, an XFA form, a form that submits data, a data-import action, or links that open files or programs on your computer. The file is checked twice: once by scanning its internal structure (including compressed sections, and undoing tricks that disguise these names), and once by the PDF library. Normal papers don't contain any of these. This is a filter for known-dangerous features, not an antivirus. It cannot detect attacks on bugs in PDF reader software.
It matches the reference: the item's DOI appears on the PDF's first two pages, or at least 80% of the title's significant words and the first author's surname do. Scanned PDFs without text can't be checked and are refused. A preprint whose title changed may be refused too.
Not a duplicate: if the exact same file is already attached, nothing new is added.
There is deliberately no "attach anyway" switch: if Claude could set it, a malicious web page could talk Claude into setting it. For the rare refused file you trust, attach it yourself in Zotero.
The file goes to one place: your WebDAV bucket if ZOTERO_FILES is configured, otherwise Zotero Storage, which should match the file-sync setting in your Zotero apps. Its text is indexed straight away. If the upload fails partway, the server removes the empty attachment it just created, the only case where it deletes anything, so you aren't left with a broken attachment.
Before you start
You need:
A Zotero account with your library synced to zotero.org.
A Cloudflare account (free to create) on the Workers Paid plan ($5/month). Upgrade under Workers & Pages → Plans in the Cloudflare dashboard.
A GitHub account: it holds your copy of this code, and you sign in with it.
Everything below happens in a web browser, so a phone or tablet works too. You don't need to install anything. Cloudflare builds the server straight from GitHub and redeploys it whenever the repository changes.
Deploy, step by step
1. Get your own copy of the repository
On this repository's GitHub page, click Fork → Create fork. (If you are the repository owner, skip this.)
2. Create a Zotero API key
Go to zotero.org/settings/keys and sign in.
Note the number after "Your userID for use in API calls is". That is your library ID (not secret).
Click Create new private key. Name it e.g.
Cloudflare MCP. Under Personal Library, tick:Allow library access (needed to read items and download PDFs)
Allow notes access (needed to read notes)
Allow write access (needed to save extracted PDF text back to Zotero, and for the optional write tools). If you leave this off, the server still works and keeps extracted text in its own cache, but Zotero search won't find it.
Leave Default Group Permissions at None. Click Save Key and keep the key somewhere private (a password manager); Zotero shows it only once.
3. Create the Worker from GitHub
In the Cloudflare dashboard, go to Workers & Pages → Create application and choose to import a repository from GitHub. The first time, Cloudflare asks to connect to GitHub; allow it access to your copy of this repository.
Pick the repository, then fill in the project settings:
Setting
Value
Project / Worker name
zotero-mcp(must matchnameinpackages/mcp-server/wrangler.jsonc)Branch
mainRoot directory
packages/mcp-serverBuild command
cd ../.. && npm ciDeploy command
npx wrangler deploy(the default)Click Save and Deploy and wait for the build to finish (a few minutes). Cloudflare creates the two storage namespaces it needs automatically.
Note your server's address, shown on the Worker's page:
https://zotero-mcp.<your-subdomain>.workers.dev. Opening it should show a short "Zotero MCP server" page.
From now on, every change pushed to main is built and deployed automatically.
4. Create a GitHub OAuth App (for sign-in)
Go to github.com/settings/developers → OAuth Apps → New OAuth App.
Fill in:
Application name:
Zotero MCP(anything)Homepage URL:
https://zotero-mcp.<your-subdomain>.workers.devAuthorization callback URL:
https://zotero-mcp.<your-subdomain>.workers.dev/callback
Click Register application. Copy the Client ID. Click Generate a new client secret and copy it.
The app only asks GitHub for your public profile (to learn your username). It gets no access to your repositories.
5. Enter your settings and secrets
In Cloudflare: your Worker → Settings → Variables and Secrets → Add. Add each of these, then click Deploy:
Name | Type | Value |
| Text | your userID from step 2 |
| Text | your GitHub username (several: comma-separated) |
| Secret | the Zotero key from step 2 |
| Secret | from step 4 |
| Secret | from step 4 |
Secrets are stored encrypted and can't be viewed again. These values live only in Cloudflare, never in the repository, and later deploys from GitHub keep them (the config sets keep_vars).
6. Connect Claude
claude.ai (web) and the phone apps: In claude.ai, open Settings → Connectors → Add custom connector. Enter a name and the URL
https://zotero-mcp.<your-subdomain>.workers.dev/mcp, then click Connect. A page asks whether to allow Claude; click Allow, then sign in with GitHub. Connectors you add on the web also appear in the Claude phone apps.Claude Desktop: same steps under Settings → Connectors.
Claude Code:
claude mcp add --transport http zotero https://zotero-mcp.<your-subdomain>.workers.dev/mcp, then run/mcpinside Claude Code to sign in.
Try: "Search my Zotero library for papers on attention mechanisms and summarise the methods section of the most recent one."
Prefer the command line?
From a clone: npm install, then in packages/mcp-server run npx wrangler login and npx wrangler deploy. Set the step 5 values with npx wrangler secret put NAME (secrets) or in the dashboard (text values).
Optional settings
Add these as Text variables under your Worker's Settings → Variables and Secrets, then click Deploy:
Setting | Default | Meaning |
|
|
|
|
| Hourly indexing of new PDFs. |
|
| PDFs indexed per hourly run (max 20). |
|
| Largest PDF the server will download. |
| your address + | Only needed with a custom domain that serves several hostnames. |
Removing a name from ALLOWED_GITHUB_USERS locks that account out on its next request.
These two are changed in the code instead. Edit packages/mcp-server/wrangler.jsonc on GitHub (open the file, click the pencil icon, then Commit changes), and Cloudflare redeploys automatically:
PDFs in WebDAV on R2: set up packages/webdav, then uncomment the
r2_bucketsline (bindingZOTERO_FILES). The server checks R2 first and falls back to Zotero Storage, so mixed setups work.Workers AI fallback extractor: uncomment the
"ai"line.
Security
Only you can sign in. Sign-in goes through GitHub and only usernames in
ALLOWED_GITHUB_USERSget through; the list is checked again on every request. Every app that connects must first be approved on a consent page showing where access will be sent.No tokens in URLs. Claude gets short-lived OAuth tokens (1 hour, refreshed automatically) bound to your server's address.
Secrets live only in Cloudflare's encrypted secret store (added as Secret in the dashboard, or with
wrangler secret put)..dev.vars(local testing) is git-ignored. Never commit keys.The server never logs API keys, tokens or file contents.
Read-only unless you opt in, and no delete tools at all. (The only delete the server ever does is removing an attachment it created moments earlier when that attachment's upload fails.)
Your Zotero API key can do whatever its permissions allow. Use a dedicated key for this server, and revoke it at zotero.org/settings/keys if you stop using it.
Development
npm install
npm test # unit tests (Zotero API mocked)
npm run lint
npm run typecheckLocal server: copy packages\mcp-server\.dev.vars.example to .dev.vars, fill in values (use a GitHub OAuth App whose callback is http://localhost:8787/callback), then:
cd packages\mcp-server
npx wrangler dev
npx @modelcontextprotocol/inspector # connect to http://localhost:8787/mcpDesign notes:
MCP over Streamable HTTP via
createMcpHandler(Cloudflareagents) with MCP SDK v2 (@modelcontextprotocol/server). Stateless: no Durable Objects.OAuth 2.1 via
@cloudflare/workers-oauth-provider, with its consent-page and upstream sign-in helpers (per-client consent before the GitHub redirect, browser-bound state, PKCE).Repository layout:
packages/mcp-server(the MCP server),packages/webdav(optional WebDAV server).
Troubleshooting
Symptom | Fix |
The build fails | Open the build log (Worker → Deployments). Check the step 3 settings: name |
Tools say "Server setup problem: ZOTERO_API_KEY is not set" | Add the step 5 variables and secrets, then click Deploy. |
"Not allowed" after GitHub sign-in | Your GitHub username isn't in |
"GitHub sign-in failed" | Check the GitHub secrets and that the OAuth App's callback URL ends in |
Tools say "Forbidden: the Zotero API key lacks permission" | Recreate the key with the permissions in step 2 and update the |
"File not found in Zotero Storage" | The file hasn't synced from Zotero desktop yet, it's a linked file, or it lives in WebDAV and |
PDF tools time out or fail on the Free plan | Upgrade to Workers Paid. |
Live logs: your Worker → Observability (or Logs) in the Cloudflare dashboard, or npx wrangler tail from a clone.
License
Apache-2.0. See LICENSE. packages/webdav includes code from abersheeran/r2-webdav (Apache-2.0); see its NOTICE.
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
Zotero MCP server for Claude and ChatGPT: search, citations, safe writes, PDF passages and pages.
A self-hostable feed of reminders, learnings and work that Claude and ChatGPT can read and write
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Zotero library management MCP server designed for Cloudflare Workers that enables searching, reading, and writing library items. It allows users to manage metadata, full-text content, and attachments through natural language interactions.1-
- FlicenseNot gradedqualityDmaintenanceMCP server for natural-language search over a local Zotero library, enabling tools to search, retrieve, and manage paper metadata, notes, and PDF fulltext via Claude.-
- AlicenseAqualityDmaintenanceA local-only, read-only MCP server for Zotero that lets Claude search and retrieve library items, collections, tags, and attachment full text from your Zotero desktop client.9-
- AlicenseNot gradedqualityCmaintenanceConnects Zotero to Claude Desktop, allowing Claude to read, search, and organize a user's Zotero library through local and web APIs.1MIT