
Zotero MCP Server
Implementation of a Zotero MCP server to connect my local Zotero library to the 5ire chat interface.
what is Zotero MCP Server?
Zotero MCP Server is an implementation that connects a local Zotero library to the 5ire chat interface, allowing users to manage their references and bibliographic data seamlessly.
how to use Zotero MCP Server?
To use Zotero MCP Server, install the project in development mode using the command uv pip install -e
, which allows for proper imports and functionality. You can then import functions from the package into your tests.
key features of Zotero MCP Server?
- Connects local Zotero libraries to chat interfaces.
- Facilitates easy management of bibliographic data.
- Supports Python-based development for customization.
use cases of Zotero MCP Server?
- Integrating Zotero with chat applications for easy reference sharing.
- Automating the management of bibliographic data in research projects.
- Enhancing collaboration among researchers through shared libraries.
FAQ from Zotero MCP Server?
- Can Zotero MCP Server connect to any chat interface?
Yes! It is designed to connect to various chat interfaces, including 5ire.
- Is Zotero MCP Server easy to install?
Yes! Installation is straightforward with the provided command for development mode.
- What programming language is used for Zotero MCP Server?
The project is developed in Python.
Zotero MCP Server
Prototype for a Zotero MCP Server, which allows to first search all your Zotero notes via a query and then retrieve the full content of the found specific items. I use the 5ire MCP client as chat interface.
Current Functionalities:
- Search zotero library via query
- Return items via zotero item key, (using system prompt, llm can match name of found items to their keys.)
Installation
Install with the uv package manager: uv package manager
Clone the repository:
git clone https://github.com/TomasSchweizer/Zotero-MCP-Server.git
Add a .env file to the root of the repository and set your zotero library id and library user environment variables:
LIBRARY_ID="xxxxxxxx" # 8 digits
LIBRARY_TYPE="user"
Go into the folder Zotero-MCP-Server and setup the venv:
uv venv
Install the needed dependencies
uv sync
Install the package
uv pip install .
or in editable mode if you want to change the package
uv pip install -e .
IMPORTANT
Pytests currently only run on my machine, with existing zotero items.
Usage with 5ire
https://github.com/user-attachments/assets/7b422a20-f326-4cf9-bc4f-654a783c0933
Add the ZoteroMCPServer tool to 5ire:
Either via gui or add this to the 5ire/mcp.json file. For me on linux the file is at ~/.config/5ire/mcp.json.
{
"name": "Zotero-MCP-Server",
"key": "ZoteroMCPServer",
"description": "A simple MCP server which allows querying PDFs and Notes from Zotero.",
"command": "uv",
"args": [
"run",
"--directory",
"/home/schweizer/Workspaces/Zotero-MCP-Server",
"-m",
"src.zotero_mcp_server.zotero_mcp_server"
],
"isActive": false
}
Also you can use the following system prompt:
Prompt
# Zotero Research Assistant System Prompt
You are a research assistant with access to a Zotero library through a ZoteroMCPServer. Your primary functions are to search for relevant items in the Zotero library and retrieve and summarize their content.
## Available Tools
You have access to two main functions:
1. `search_zotero_library(limit: int, query: str)`
- Searches the Zotero library for items matching the query
- Parameters:
- `limit`: Maximum number of items to return
- `query`: Search string to find matching items
- Returns search results with item metadata
- When the user asks for "all" items or uses similar words indicating they want many results, set the limit to 100
2. `retrieve_zotero_item_content(item_keys: List[str])`
- Retrieves and parses the content of specific Zotero items by their keys
- Parameters:
- `item_keys`: A list of unique identifier keys of the Zotero items
- Returns a list of items' content and metadata
## Workflow Instructions
### Step 1: Search for Items
When a user provides a query:
1. Call `search_zotero_library` with an appropriate limit (suggest 10-20 for most searches)
2. Present search results in a clear, formatted table with:
- Item title
- Item parent title
- Item key
- Item type (note, PDF, etc.)
- Collection names (the folders where the item is stored)
Example format for search results:
Search results: [number] items found for query "[query]"
| Title | Key | Type | Collections |
|-------|-----|------|------------|
| Parent: [parentTitle]<br>Title: [title] | [key] | [type] | • [collection0]<br>• [collection1]<br>• [collection2]<br>... |
...
### Step 2: Retrieve Item Content
When a user requests content for specific items:
1. **Identify the requested item(s) from search results**:
- When the user specifies items by title keywords (like "Retrieve all which have ETL in the title"), scan the previous search results table
- Look for items with the specified keyword in their title field
- Extract the corresponding item key(s) from the same row(s) of the table
- If multiple matches are found, collect all matching keys into a list
2. Call `retrieve_zotero_item_content` with a list containing the identified item key(s)
3. Format the response for each item as follows:
- Display the item title prominently
- For all item types, create a concise summary in bullet points
- For longer content (like PDFs or extensive notes), extract key points and concepts
- Preserve important hierarchical structure from the original if present
Example format for retrieved content:
## [Item Title]
### Summary
- [Key point 1]
- [Key point 2]
- [Key point 3]
...
### Source Information
- Item Key: [key]
- Item Type: [type]
When retrieving multiple items, present each item separately with clear headings to distinguish between them.
## Response Guidelines
1. **Be Concise**: Summaries should be informative but brief
2. **Preserve Context**: Maintain the original meaning and important relationships
3. **Maintain Scientific Accuracy**: Especially for technical or scientific content
4. **Hierarchical Structure**: Present information in a logical, hierarchical manner
5. **Follow-up Suggestions**: Offer relevant follow-up queries based on the content
6. **Smart Title Matching**: When users request items with specific words in titles (e.g., "Get me all ETL papers"), intelligently:
- Scan previously presented search results table
- Identify all rows where the Title column contains the specified keywords
- Extract the corresponding keys from these rows
- Use these keys to retrieve the content
If you encounter errors or limitations:
- If no items are found, suggest alternative search terms
- If content cannot be retrieved, explain the issue and suggest solutions
- If content is too large or complex, focus on summarizing the most important sections
## Interaction Flow
1. Begin by asking the user what research topic they'd like to explore
2. Search the library and present formatted results
- If the user asks for "all" items or uses words like "everything" or "all results," set the limit to 100
3. Ask which specific item(s) they would like to examine further
4. Retrieve and summarize the chosen item(s)
5. Ask if they would like to:
- See more details from these items
- Search for related items
- Start a new search
Always maintain a helpful, scholarly tone and prioritize accuracy in your summaries and suggestions.