Sandbox
@introfini/mcp-server-zotero-dev

MCP server and Zotero bridge for plugin development

This project connects an AI assistant to a running Zotero app through Model Context Protocol and Firefox remote debugging. The server can inspect the UI, run JavaScript in Zotero, read logs, query the database, and manage plugins while you work on an add-on.

39 stars9 forksTypeScriptUpdated 28d ago
Who it's for

Builders who develop Zotero plugins with an AI assistant and want live access to the app while they iterate.

What it delivers

You can debug Zotero plugins with screenshots, DOM state, logs, and direct code execution instead of guessing from text alone.

What it does

UI inspection

Captures screenshots, inspects DOM trees, finds elements, and reads computed styles from Zotero windows and panels.

UI interaction

Clicks elements and types into inputs, including shadow-DOM-aware controls in Zotero.

JavaScript execution

Runs privileged JavaScript in Zotero, inspects objects and APIs, and reads or sets preferences.

Build integration

Connects to zotero-plugin-scaffold to build, serve, lint, and typecheck a plugin during development.

Logs and errors

Reads debug output, error console entries, watches logs in real time, and clears the log buffer.

Plugin management

Installs, reloads, and lists Zotero plugins from inside the assistant workflow.

Read-only database access

Queries zotero.sqlite and reads schema or stats for debugging, with read-only access.

How to get it

  1. 1Use install-mcp to add the server to your AI assistant
    npx -y install-mcp @introfini/mcp-server-zotero-dev --client claude-code
  2. 2Supported clients: claude-code, cursor, windsurf, vscode, cline, roo-cline, claude, zed,…
    npx -y install-mcp @introfini/mcp-server-zotero-dev --client claude-code
  3. 3Run
    npx -y install-mcp @introfini/mcp-server-zotero-dev --client cursor
  4. 4Run
    npx -y install-mcp @introfini/mcp-server-zotero-dev --client vscode
  5. 5Run
    npx -y install-mcp @introfini/mcp-server-zotero-dev --client windsurf

README

MCP Server Zotero Dev

Give your AI assistant superpowers for Zotero plugin development

License: MIT Zotero 7+

Architecture · Getting Started · Available Tools

MCP Server Zotero Dev in action

A Model Context Protocol (MCP) server that enables AI assistants like Claude, Cursor, and Windsurf to build, test, and debug Zotero 7, 8, 9, and 10 plugins. Screenshots, DOM state, debug logs, and JavaScript execution give the AI rich context to understand what's happening—and tools to help you fix it.

✨ Features

CategoryCapabilities
🎯 UI InspectionScreenshots, DOM tree, element finding, computed styles
🖱️ UI InteractionClick elements and type text (shadow-DOM aware)
💻 JS ExecutionRun code in Zotero context, inspect APIs, test snippets
🔧 Build ToolsScaffold integration for build, serve, hot reload
📋 Logs & ErrorsStream debug output, error console, watch for issues
🗃️ DatabaseRead-only access to zotero.sqlite for debugging
🔌 Plugin ManagementInstall, reload, list plugins

🚀 Quick Start

Prerequisites

  • Node.js 20+ and npm
  • Zotero 7+ — Works on all Zotero 7, 8, 9, and 10 builds (release, beta, dev)
  • For plugin development: zotero-plugin-scaffold

1. Install MCP Server

Use install-mcp to add the server to your AI assistant:

npx -y install-mcp @introfini/mcp-server-zotero-dev --client claude-code

Supported clients: claude-code, cursor, windsurf, vscode, cline, roo-cline, claude, zed, goose, warp, codex

Claude Code
npx -y install-mcp @introfini/mcp-server-zotero-dev --client claude-code
Cursor
npx -y install-mcp @introfini/mcp-server-zotero-dev --client cursor
VS Code / Copilot
npx -y install-mcp @introfini/mcp-server-zotero-dev --client vscode
Windsurf
npx -y install-mcp @introfini/mcp-server-zotero-dev --client windsurf
Manual Configuration

Add to your MCP client config:

{
  "mcpServers": {
    "zotero-dev": {
      "command": "npx",
      "args": ["-y", "@introfini/mcp-server-zotero-dev@1.1.1"],
      "env": {
        "ZOTERO_RDP_PORT": "6100"
      }
    }
  }
}

Version & updates: pin an exact version as shown above. A bare npx <pkg> (no version) keeps running whatever npx cached and won't pick up new releases, so always include a version and -y (without -y, npx hangs waiting for an install prompt). Bump the pinned version to upgrade, or use @latest to always fetch the newest at launch (auto-updates, but a bad release would run automatically and it adds a registry check on every start). Note that install-mcp may write a config without -y or a version, so the manual configuration above is the most robust path.

Restart your AI assistant after adding the configuration.

2. Install MCP Bridge Plugin in Zotero

Download zotero-mcp-bridge.xpi and install:

  1. In Zotero: Tools → Plugins
  2. Click ⚙️ → Install Plugin From File
  3. Select the downloaded .xpi file
  4. Restart Zotero

This lightweight plugin enables the Remote Debugging Protocol when Zotero starts. It only needs to be installed once and works on all Zotero 7+ builds (release, beta, and dev).

3. Start Developing!

Just open Zotero normally and ask your AI assistant:

"Take a screenshot of Zotero and list installed plugins"

That's it! No special launch flags, no configuration. 🎉


🧰 Available Tools (28 total)

UI Inspection — Screenshots, DOM, styles
ToolDescription
zotero_screenshotCapture window, element, or region screenshots
zotero_inspect_elementFind elements by CSS selector
zotero_get_dom_treeGet DOM structure of a window/panel
zotero_get_stylesGet computed CSS styles for element
zotero_list_windowsList all open Zotero windows

Screenshot Targets: Main window, preferences, PDF reader, dialogs, or any element by selector. Use highlightSelector to add a red border before capture.

UI Interaction — Click and type in the Zotero UI
ToolDescription
zotero_click_elementClick an element by CSS selector (toolbar/menu button, preference control, list row). Pierces shadow DOM; index picks among multiple matches; mouseEvents synthesizes a full mouse sequence.
zotero_send_keysType text into an input/textarea/contenteditable (focuses it first, fires input/change). Optional clear and pressEnter.

Resolution tries light DOM first, then pierces open shadow roots (Zotero's XUL custom elements keep internals in shadow DOM). Limitation: cannot dismiss a blocking native modal dialog (Services.prompt.confirmEx) — its nested modal loop blocks the eval thread these tools run on.

JavaScript Execution — Run code in Zotero context
ToolDescription
zotero_execute_jsExecute JavaScript in Zotero's privileged context. Auto-wraps code with top-level return statements in IIFE.
zotero_inspect_objectExplore Zotero APIs - list methods and properties of any object (e.g., Zotero.Items)
zotero_open_preferencesOpen Zotero's settings window, optionally to a specific pane (built-in or plugin)
zotero_search_prefsSearch/discover preferences by pattern (e.g., find all prefs containing "debug")
zotero_get_prefGet a preference value
zotero_set_prefSet a preference value

Examples: Zotero.Items.getAll(1), Zotero.Prefs.get('export.quickCopy.setting'), ZoteroPane.getSelectedItems()

Tip: Use zotero_inspect_object to explore APIs before writing code. Use zotero_search_prefs to discover preference keys.

Build & Scaffold — Integration with zotero-plugin-scaffold
ToolDescription
zotero_scaffold_buildBuild plugin (dev or production mode)
zotero_scaffold_serveStart dev server with hot reload
zotero_scaffold_lintRun ESLint on plugin source
zotero_scaffold_typecheckRun TypeScript type checking
Logs & Debugging — Error console and debug output
ToolDescription
zotero_read_logsRead debug output (Zotero.debug)
zotero_read_errorsRead error console entries
zotero_watch_logsStream logs in real-time
zotero_clear_logsClear log buffer
Plugin Management — Install, reload, inspect
ToolDescription
zotero_plugin_reloadHot reload your dev plugin
zotero_plugin_installInstall plugin from XPI path
zotero_plugin_listList installed plugins with version/status
Database Access — Read-only SQLite access
ToolDescription
zotero_db_queryExecute SELECT query on zotero.sqlite
zotero_db_schemaGet table schema information
zotero_db_statsGet database statistics (items, attachments, collections, size)

Note: Database access is read-only and requires Zotero to be closed, or uses a copy of the database.


🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        AI Assistant                             │
│                  (Claude, Cursor, Windsurf)                     │
└─────────────────────────┬───────────────────────────────────────┘
                          │ MCP Protocol (stdio)
                          ▼
┌─────────────────────────────────────────────────────────────────┐
│                  MCP Server (Node.js/TypeScript)                │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────┐   │
│  │   Scaffold   │  │     RDP      │  │      Database        │   │
│  │  Integration │  │    Client    │  │      Reader          │   │
│  └──────────────┘  └──────┬───────┘  └──────────────────────┘   │
└─────────────────────────────┼───────────────────────────────────┘
                              │ Firefox RDP (port 6100)
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                      Zotero Application                         │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │            MCP Bridge for Zotero                         │   │
│  │         Starts DevToolsServer on launch                  │   │
│  └──────────────────────────────────────────────────────────┘   │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              Firefox DevTools Server (built-in)          │   │
│  │           JS Execution • DOM • Console • Screenshots     │   │
│  └──────────────────────────────────────────────────────────┘   │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                   Your Plugin (dev)                      │   │
│  └──────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────┘

Why this approach?

  • Lightweight plugin — Just enables RDP, Firefox DevTools does the rest
  • Zero-config after install — Just open Zotero normally, no special flags
  • Rich AI context — Screenshots, DOM, and logs help the AI understand your plugin's state
  • Hot reload — Integrates with zotero-plugin-scaffold for instant feedback
  • Full Zotero access — Execute any Zotero API in the privileged context
  • Cross-platform — Works on Linux, Windows, macOS

🔧 Environment Variables

VariableDescriptionDefault
ZOTERO_RDP_PORTRemote debugging port6100
ZOTERO_RDP_HOSTDebugging host127.0.0.1
ZOTERO_DATA_DIRPath to Zotero data directoryAuto-detect
ZOTERO_PROFILE_PATHPath to Zotero profileAuto-detect

🔌 Changing the RDP Port

The bridge listens on port 6100 by default. You only need to change it if you run two Zotero instances at the same time (a normal profile and a development one, say), or if another process already holds 6100.

The port lives on both sides of the bridge, and both have to agree on it.

1. Zotero side — set the plugin preference:

  1. Settings → Advanced → Config Editor, and accept the warning
  2. Search for extensions.mcp-rdp.port
  3. If it doesn't exist, create it: select Number, name it extensions.mcp-rdp.port, and enter your port
  4. Restart Zotero — the listener only opens at startup

Watch the type. The Config Editor pre-selects Boolean. Creating the preference without switching to Number stores true instead of a port, and Zotero then opens the bridge on a local pipe rather than a TCP port — the debug log reports success while no MCP client can connect.

2. Client side — set ZOTERO_RDP_PORT to the same value in your MCP client config:

{
  "mcpServers": {
    "zotero-dev": {
      "command": "npx",
      "args": ["-y", "@introfini/mcp-server-zotero-dev@1.1.2"],
      "env": {
        "ZOTERO_RDP_PORT": "6101"
      }
    }
  }
}

Change both or neither. Moving only one side disconnects the bridge: Zotero listens on one port while the client keeps dialing the other.

Actually running two instances

Launching Zotero a second time hands you the window you already have — like Firefox, it forwards to the running instance instead of starting another. A second instance needs its own profile and -no-remote:

# macOS; adjust the binary path on Windows/Linux
MOZ_NO_REMOTE=1 "/Applications/Zotero.app/Contents/MacOS/zotero" -P <profile-name> -no-remote

Give that profile its own extensions.mcp-rdp.port and the two bridges stay out of each other's way. Verified with 9.0.6 on 6100 and 10.0-beta.22 on 6101 at the same time.

Requires MCP Bridge plugin 1.0.5 or later. In 1.0.4 and earlier, extensions.mcp-rdp.port was read under the wrong preference branch and silently ignored, so the bridge stayed on 6100 no matter what you set. If you configured a custom port against an older build, it is stored as extensions.zotero.extensions.mcp-rdp.port — that name still works, but prefer the one above.

Disabling the bridge

Set extensions.mcp-rdp.enabled to false (Boolean) in the Config Editor and restart Zotero. The plugin stays installed but opens no listener, and no MCP client can reach Zotero until you set it back to true.


📸 Screenshot Examples

// Capture main Zotero window
await zotero_screenshot({ target: 'main-window' });

// Capture your plugin's panel with highlight
await zotero_screenshot({
  target: 'element',
  selector: '#my-plugin-panel',
  highlightSelector: '#my-plugin-button'
});

// Capture a specific window by ID (use zotero_list_windows to find IDs)
await zotero_screenshot({
  target: 'window',
  windowId: 12345
});

// Capture element after triggering UI action
await zotero_execute_js({ code: 'document.querySelector("#menu").click()' });
await zotero_screenshot({ target: 'element', selector: 'menupopup[state="open"]' });

🧑‍💻 Development

# Clone and install
git clone https://github.com/introfini/mcp-server-zotero-dev.git
cd mcp-server-zotero-dev
npm install

# Build everything
npm run build

# Build individual packages
npm run build:server
npm run build:plugin

# Run tests
npm test

# Development mode (watch)
npm run dev
Project Structure
mcp-server-zotero-dev/
├── packages/
│   ├── mcp-server/               # MCP server (npm package)
│   │   ├── src/
│   │   │   ├── index.ts          # MCP server entry
│   │   │   ├── rdp/              # RDP client
│   │   │   ├── tools/            # Tool implementations
│   │   │   └── prompts/          # Slash commands
│   │   └── package.json
│   │
│   └── zotero-plugin-mcp-rdp/    # Tiny Zotero plugin (.xpi)
│       ├── src/
│       │   └── bootstrap.js      # Starts RDP server (shipped verbatim)
│       ├── addon/
│       │   └── manifest.json
│       └── package.json
│
├── docs/                         # Documentation
└── package.json                  # Monorepo root

📚 Resources


🤝 Contributing

Contributions are welcome. See CONTRIBUTING.md for setup, test conventions and the codebase-specific rules worth knowing before you start.

The short version:

  1. Follow existing code patterns
  2. Add tests for new features, and skip rather than fail when Zotero is not running
  3. Update documentation
  4. There is no CI, so run npm run build, npm run typecheck, npm run lint and npm test yourself, and say in the PR which Zotero version you verified against

📄 License

MIT © introfini


Acknowledgments

Files in the repo

Repository payload11 top-level entries
  • docs
  • packages
  • .gitignore
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CONTRIBUTING.md
  • LICENSE
  • package-lock.json
  • package.json
  • README.md
  • update.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k