mcp-zotero

mcp
Guvenlik Denetimi
Basarisiz
Health Gecti
  • License — License: NOASSERTION
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 37 GitHub stars
Code Basarisiz
  • rm -rf — Recursive force deletion command in .github/workflows/test.yml
  • process.env — Environment variable access in scripts/smoke-fetch-stub.mjs
  • process.env — Environment variable access in scripts/smoke-stdio.mjs
  • exec() — Shell command execution in skills/zotero-skill-mcp-integrations/scripts/inject.js
  • process.env — Environment variable access in src/__mocks__/setup.ts
  • Hardcoded secret — Potential hardcoded credential in src/__mocks__/setup.ts
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

MCP server that exposes Zotero library operations as tools for Claude. Supports searching, browsing collections, adding items by DOI, importing PDFs with fulltext indexing, open access PDF discovery via Unpaywall, and injecting Zotero citation field codes into .docx documents.

README.md

MCP Zotero

Note: This is an unofficial community project and is not affiliated with, endorsed by, or supported by the Zotero team or the Corporation for Digital Scholarship. "Zotero" is a registered trademark of the Corporation for Digital Scholarship.

A Model Context Protocol server for Zotero integration. It gives any LLM full access to your Zotero library: search, organize, add papers by DOI, import PDFs, read full-text content, and inject live citations into Word documents.

Originally based on mcp-zotero by Abhishek Kalia.
This project has since been extensively rewritten with a new architecture, 15 tools (up from 5), citation injection, PDF management, and Claude skill support.

How it works

The server is designed to be usable by any LLM without external documentation. On connection, it sends workflow instructions via the MCP instructions field, and each tool description includes cross-references and usage guidance. An LLM that has never seen this server before can discover the full workflow — from adding papers to producing a cited Word document — directly from the tool listing.

For advanced use cases (PDF upload policy, citation style guidance, source transparency), a Claude skill is included for Claude.ai Projects. But the skill is optional: the MCP server is fully self-documenting.

Local vs Remote LLMs

Scenario MCP server Skill needed?
LLM with filesystem access (Claude Code, LM Studio, etc.) All 15 tools No
LLM without filesystem access (Claude.ai Projects, Claude Desktop) API tools (search, add, metadata) Yes, for citation injection

LLMs with filesystem access can use all tools directly, including inject_citations which reads and writes .docx files on disk.

LLMs without filesystem access — including Claude Desktop, which connects to MCP but cannot generate files locally — can use the included Claude skill (skills/zotero-skill-mcp-integrations/), which runs citation injection entirely inside a sandbox. MCP tools handle all Zotero API operations; the skill handles document assembly.

Claude Skill Setup (for Claude.ai Projects and Claude Desktop)

  1. Download the skill .zip from the latest GitHub Release
  2. Extract it and upload the folder to your Claude.ai Project as a skill
  3. The skill enables citation injection directly inside the sandbox, without requiring local filesystem access

Setup

Requires Node.js 22 or newer.

  1. Get your Zotero credentials:

    # Create an API key at https://www.zotero.org/settings/keys
    # (enable library read/write + file access)
    # Then retrieve your user ID:
    curl -H "Zotero-API-Key: YOUR_API_KEY" https://api.zotero.org/keys/current
    
  2. Set environment variables:

    export ZOTERO_API_KEY="your-api-key"
    export ZOTERO_USER_ID="user-id-from-curl"
    export UNPAYWALL_EMAIL="[email protected]"   # Optional: enables OA PDF lookup via Unpaywall
    export UNSAFE_OPERATIONS="none"           # Optional: "none" | "items" | "all" (see below)
    

Targeting a group library

By default the server targets your personal Zotero library (/users/<ZOTERO_USER_ID>/...).
To target a group library instead, set two additional environment variables:

Variable Values Required? Default
ZOTERO_LIBRARY_TYPE user | group No user
ZOTERO_LIBRARY_ID numeric library ID Yes when type=group; otherwise falls back to ZOTERO_USER_ID —

Example for a group library:

ZOTERO_API_KEY=...
ZOTERO_USER_ID=12345               # optional for groups: used by get_user_id and per-call library_type="user"
ZOTERO_LIBRARY_TYPE=group
ZOTERO_LIBRARY_ID=6178978          # the group ID

The API key in ZOTERO_API_KEY must have access to the target group library — generate or scope keys at https://www.zotero.org/settings/keys.

The server refuses to start if ZOTERO_LIBRARY_TYPE=group is set without ZOTERO_LIBRARY_ID, or if a library ID is not numeric.

Per-call library override

Every tool accepts two optional args that override the env defaults for that single call:

  • library_type — "user" or "group"
  • library_id — numeric library ID

Resolution order: per-call arg > env var > implicit default (user, ZOTERO_USER_ID). library_id must be numeric. Overriding library_type to group on a server configured for a user library requires library_id; overriding to user on a group server without library_id uses ZOTERO_USER_ID.

Note that per-call overrides let the LLM reach any library the API key can access. Scope the key to the libraries you want exposed; deletions remain gated by UNSAFE_OPERATIONS.

This lets a single MCP instance target multiple libraries (e.g., a staging group and a final-output group) without restarting:

// First call targets the staging group
{
  "tool": "add_items",
  "args": {
    "items": [...],
    "library_type": "group",
    "library_id": "5597114"
  }
}

// Second call targets DART-output (different group)
{
  "tool": "add_items",
  "args": {
    "items": [...],
    "library_type": "group",
    "library_id": "6178978"
  }
}

Environment Variables

Variable Required Description
ZOTERO_API_KEY Yes API key for Zotero Web API v3. Create one at zotero.org/settings/keys with library read/write and file access permissions.
ZOTERO_USER_ID Yes Your Zotero numeric user ID. Retrieve it with curl -H "Zotero-API-Key: KEY" https://api.zotero.org/keys/current.
UNPAYWALL_EMAIL No Email for Unpaywall API requests (rate-limit policy). Enables OA PDF lookup in add_items_by_doi and find_and_attach_pdfs. If not set, OA PDF features are silently skipped.
UNSAFE_OPERATIONS No Controls destructive operations (deletion). See Unsafe Operations below. Default: none (all deletions blocked).

Unsafe Operations

By default, the MCP server does not allow any deletion. This is a safety measure to prevent an LLM from accidentally deleting items or collections from your library.

To enable deletion, set the UNSAFE_OPERATIONS environment variable to one of the following values:

Value delete_items delete_collection Use case
none (default) Blocked Blocked Safe mode — no deletions possible
items Allowed Blocked Allow deleting items but protect collection structure
all Allowed Allowed Full access — items and collections can be deleted

Important notes:

  • If UNSAFE_OPERATIONS is not set, empty, or set to an unrecognized value, it defaults to none.
  • The value is case-insensitive (e.g. ALL, Items, NONE all work).
  • delete_items deletes items permanently: the Zotero Web API multi-item DELETE does not move them to the Zotero trash, so they cannot be restored from the desktop client.
  • delete_collection removes the collection (folder) only — items inside it are not deleted and remain in your library.
  • The all value includes both item and collection deletion because managing collections inherently requires item-level access.

Configuration example:

{
  "mcpServers": {
    "zotero": {
      "command": "npx",
      "args": ["-y", "@xevos117/mcp-zotero"],
      "env": {
        "ZOTERO_API_KEY": "YOUR_API_KEY",
        "ZOTERO_USER_ID": "YOUR_USER_ID",
        "UNSAFE_OPERATIONS": "items"
      }
    }
  }
}

Integration with Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "zotero": {
      "command": "npx",
      "args": ["-y", "@xevos117/mcp-zotero"],
      "env": {
        "ZOTERO_API_KEY": "YOUR_API_KEY",
        "ZOTERO_USER_ID": "YOUR_USER_ID",
        "UNPAYWALL_EMAIL": "YOUR_EMAIL"
      }
    }
  }
}

Integration with Claude Code

claude mcp add-json "zotero" '{"command":"npx","args":["tsx","src/server.ts"],"env":{"ZOTERO_API_KEY":"...","ZOTERO_USER_ID":"..."}}'

Available Tools

Library browsing

Tool Description
get_collections List all collections (folders) with keys, names, and parent relationships
get_collection_items Get items in a specific collection with keys, titles, authors, dates
search_library Search by query, or list items sorted by field (date, title, etc.)
get_items_details Batch metadata retrieval for multiple items — returns all type-specific fields (bookTitle, proceedingsTitle, university, etc.), the authors string and the structured creators
get_item_fulltext Get full-text content of a PDF attachment via Zotero's fulltext index

Adding content

Tool Description
add_items_by_doi Add papers by DOI with automatic metadata resolution. Auto-attaches OA PDFs via Unpaywall
add_items Add items with direct metadata — supports all 37 Zotero item types (books, theses, reports, etc.), batch-capable
create_collection Create a new collection, optionally nested under a parent
import_pdf_to_zotero Download a PDF from URL, upload to Zotero storage, auto-index full text
find_and_attach_pdfs Batch OA PDF lookup and auto-attach via Unpaywall (by item keys or collection)
add_linked_url_attachment Attach a URL to an existing item or create a standalone link

Deleting content

Tool Description
delete_items Permanently delete up to 50 items per call (not moved to the Zotero trash). Requires UNSAFE_OPERATIONS=items or all
delete_collection Delete a collection (folder). Items inside are kept. Requires UNSAFE_OPERATIONS=all

Citation & documents

Tool Description
inject_citations Inject live Zotero citations into a Word document. Supports APA, IEEE, Vancouver, Harvard, Chicago. Output is saved in the same folder as the input file with a _cited suffix (e.g. paper.docx → paper_cited.docx)
get_user_id Returns the configured Zotero user ID

Development

npm install
npm run build          # Compile TypeScript
npm test               # Run tests (vitest, 404 tests)
npx tsx src/server.ts  # Run directly without building

Debug with MCP Inspector

npx @modelcontextprotocol/inspector npx tsx src/server.ts

License

MIT - see LICENSE for details.

Yorumlar (0)

Sonuc bulunamadi