openclaw-zotero-mcp
README.md
# openclaw-zotero-mcp
Zotero integration for OpenClaw.
This repository now provides two integration modes:
- native OpenClaw plugin for the main agent
- stdio MCP server for ACP/acpx workflows
## What it provides
- `search_items`
- `get_item`
- `export_items`
- `create_collection`
- `create_item`
- `add_to_collection`
- `attach_file`
## Recommended mode: native OpenClaw plugin
If your goal is "talk to the main OpenClaw agent in Telegram and ask it to search Zotero in natural language", use the native plugin mode.
### Plugin setup
1. Install dependencies:
```bash
npm install
```
2. Keep `.env` in this repo, or configure the API key in `~/.openclaw/openclaw.json`.
3. Point OpenClaw at this plugin directory and enable it:
```json5
{
"plugins": {
"load": {
"paths": ["/absolute/path/to/openclaw-zotero-mcp"]
},
"entries": {
"zotero": {
"enabled": true
}
}
}
}
```
Optional explicit plugin config:
```json5
{
"plugins": {
"entries": {
"zotero": {
"enabled": true,
"config": {
"apiKey": "your-zotero-api-key",
"libraryType": "user",
"libraryId": "123456"
}
}
}
}
}
```
If `plugins.entries.zotero.config.apiKey` is unset, the plugin falls back to:
- `ZOTERO_API_KEY`
- this repo's `.env` file
Then restart OpenClaw.
### What the native plugin gives you
It registers a main-agent tool named `zotero`, so the normal OpenClaw agent can use it directly from natural-language requests.
Examples:
- "Search my Zotero library for transformer papers"
- "Find 5 Zotero items about retrieval augmented generation"
- "Export this Zotero item as BibTeX"
## Secondary mode: ACP MCP server
If you specifically want ACP/acpx sessions such as `codex` to use Zotero through MCP, this repo still exposes the original stdio MCP server.
## Setup
1. Copy `.env.example` to `.env`
2. Fill in your Zotero API key
3. Install dependencies
```bash
npm install
```
For user libraries, the server resolves `ZOTERO_LIBRARY_ID` automatically from the API key.
If you want to inspect the resolved account manually:
```bash
curl -H "Zotero-API-Key: <your-key>" https://api.zotero.org/keys/current
```
Use explicit `ZOTERO_LIBRARY_TYPE` and `ZOTERO_LIBRARY_ID` only when you need to override the detected user library or connect to a group library.
## ACP/acpx configuration
Add an `acpx` entry in `~/.openclaw/openclaw.json`:
```json5
{
"acp": {
"enabled": true,
"dispatch": {
"enabled": true
},
"backend": "acpx",
"defaultAgent": "codex"
},
"plugins": {
"entries": {
"acpx": {
"enabled": true,
"config": {
"permissionMode": "approve-reads",
"nonInteractivePermissions": "fail",
"mcpServers": {
"zotero": {
"command": "node",
"args": [
"/absolute/path/to/openclaw-zotero-mcp/src/index.js"
]
}
}
}
}
}
}
}
```
Use an absolute path for `src/index.js`. OpenClaw `mcpServers` config supports `command`, `args`, and `env`, but not a dedicated `cwd`, so absolute paths are the safest option.
After updating config, restart OpenClaw and spawn an ACP session such as:
```text
/acp spawn codex --mode persistent
```
Then ask the ACP agent to search or export Zotero items.
## Running the MCP server directly
For manual testing:
```bash
node /absolute/path/to/openclaw-zotero-mcp/src/index.js
```
or from the project directory:
```bash
npm start
```
This starts a standard `stdio` MCP server. It is expected to be launched by an MCP client, not used as an interactive terminal program.
## Environment variables
- `ZOTERO_API_KEY`: Zotero API key with read access; write-enabled if you want to create collections/items or upload attachments
- `ZOTERO_LIBRARY_TYPE`: optional override, `user` or `group`
- `ZOTERO_LIBRARY_ID`: optional override for user libraries, required for group libraries
## Native plugin tool behavior
The native plugin exposes one main tool:
- `zotero`
Supported actions:
- `search`
- `get_item`
- `export_items`
- `create_collection`
- `create_item`
- `add_to_collection`
- `attach_file`
## MCP tool behavior
### `search_items`
Searches top-level Zotero items by title, creator, or year.
### `get_item`
Fetches one item as:
- `json`
- `bibtex`
- `csljson`
### `export_items`
Exports one or more items as:
- `bibtex`
- `csljson`
### `create_collection`
Creates a Zotero collection (folder).
### `create_item`
Creates a Zotero item from metadata and can place it into one or more collections.
### `add_to_collection`
Adds an existing Zotero item into a collection.
### `attach_file`
Uploads a local file as an attachment under an existing Zotero item.
## Current scope
- Read and write access to Zotero items when the API key has write permission
- Local file attachment upload is supported
- Telegram-native file ingestion into Zotero is not implemented yet
## Troubleshooting
If startup fails immediately:
- check that `.env` exists
- check that `ZOTERO_API_KEY` is valid
- check that the `node` command exists in the OpenClaw runtime environment
If OpenClaw cannot use the tools:
- make sure `acp.enabled` is `true`
- make sure `acp.dispatch.enabled` is `true`
- make sure `plugins.entries.acpx.enabled` is `true`
- make sure the `mcpServers.zotero.args[0]` path is absolute and correct
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessOutdated data