Labsco
introfini logo

MCP Bridge for Zotero

β˜… 36

from introfini

MCP server that enables AI assistants to build, test, and debug Zotero plugins via 26 tools for UI inspection, JS execution, logging, and more.

πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

MCP Server Zotero Dev

Give your AI assistant superpowers for Zotero plugin development

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, and 9 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

🧰 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

πŸ“Έ 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/
β”‚       β”‚   └── index.ts          # Starts RDP server
β”‚       β”œβ”€β”€ addon/
β”‚       β”‚   └── manifest.json
β”‚       └── package.json
β”‚
β”œβ”€β”€ docs/                         # Documentation
└── package.json                  # Monorepo root

πŸ“š Resources


🀝 Contributing

Contributions are welcome! Please:

  1. Follow existing code patterns
  2. Add tests for new features
  3. Update documentation
  4. Ensure npm test and npm run lint pass

πŸ“„ License

MIT Β© introfini