# 54yyyu/zotero-mcp architecture

> Architecture diagram of the GitHub repository 54yyyu/zotero-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/54yyyu/zotero-mcp
- Repository: https://github.com/54yyyu/zotero-mcp

## Overview

Zotero MCP exposes research-library operations through an MCP server and CLI, with a separate Zotero-embedded chat plugin. The principal workflow is an assistant request routed to search or retrieval tools, which read Zotero data and return metadata or extracted paper text; optional semantic search indexes text with embeddings. Other documented branches cover writing, annotations, and Scite. The plugin adds an in-Zotero chat path with an agent session and Zotero context. Relationships for unsampled subsystems are limited to README statements or SOURCE INDEX references; those references do not establish every runtime call.

Main entry points: [`src/zotero_mcp/server.py`](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/server.py) (MCP server), [`src/zotero_mcp/tools/retrieval.py`](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/retrieval.py) (Read tools), [`src/zotero_mcp/semantic_search.py`](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/semantic_search.py) (Semantic indexing), [`src/zotero_mcp/tools/search.py`](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/search.py) (Search tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Assistant entry points"]
  node_mcp["MCP server<br/>[server.py]"]
  node_cli["Zotero CLI<br/>[cli.py]"]
end

subgraph group_tools["Library operations"]
  node_search["Search tools<br/>[search.py]"]
  node_retrieval["Read tools<br/>[retrieval.py]"]
  node_annotations["Annotation tools<br/>[annotations.py]"]
  node_writes["Write tools<br/>[write.py]"]
  node_scite["Scite lookup<br/>[scite.py]"]
  node_helpers["Shared tool helpers<br/>[_helpers.py]"]
end

subgraph group_data["Zotero data access"]
  node_library["Library facade<br/>[library.py]"]
  node_client["Zotero client<br/>[client.py]"]
  node_localdb[("Local reader<br/>[local_db.py]")]
  node_extract["Text extraction<br/>[extract.py]"]
end

subgraph group_semantic["Semantic search"]
  node_semantic_search["Semantic indexing<br/>[semantic_search.py]"]
  node_chroma[("Vector store<br/>[chroma_client.py]")]
  node_embeddings["Embedding providers<br/>[registry.py]"]
end

subgraph group_plugin["Zotero Agent"]
  node_plugin_ui["Chat UI<br/>[index.ts]"]
  node_session["Agent session<br/>[session.ts]"]
  node_runtime["Agent runtime<br/>[runtime.ts]"]
  node_zotero_context["Zotero context<br/>[context.ts]"]
end

node_assistant(("AI assistant"))
node_scite_service["Scite service"]
node_plugin_user(("Zotero user"))

node_assistant -->|"requests tools"| node_mcp
node_mcp -->|"registers tools"| node_search
node_mcp -->|"registers tools"| node_retrieval
node_mcp -->|"registers tools"| node_annotations
node_mcp -->|"registers tools"| node_writes
node_search -->|"queries library"| node_library
node_search -->|"runs semantic query"| node_semantic_search
node_retrieval -->|"reads locally"| node_localdb
node_retrieval -.->|"reads Zotero"| node_client
node_retrieval -->|"extracts full text"| node_extract
node_writes -->|"writes items"| node_client
node_writes -->|"uses helpers"| node_helpers
node_annotations -.->|"annotates library"| node_client
node_semantic_search -->|"extracts content"| node_extract
node_semantic_search -->|"stores vectors"| node_chroma
node_semantic_search -->|"creates embeddings"| node_embeddings
node_scite -.->|"fetches citations"| node_scite_service
node_plugin_user -->|"chats in Zotero"| node_plugin_ui
node_plugin_ui -.->|"sends chat input"| node_session
node_session -->|"opens agent"| node_runtime
node_plugin_ui -.->|"uses open item context"| node_zotero_context
node_cli -.->|"serves shell agents"| node_assistant

click node_mcp "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/server.py"
click node_cli "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/cli.py"
click node_search "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/search.py"
click node_retrieval "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/retrieval.py"
click node_annotations "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/annotations.py"
click node_writes "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/write.py"
click node_scite "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/scite.py"
click node_helpers "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/_helpers.py"
click node_library "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/library.py"
click node_client "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/client.py"
click node_localdb "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/local_db.py"
click node_extract "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/extract.py"
click node_semantic_search "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/semantic_search.py"
click node_chroma "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/chroma_client.py"
click node_embeddings "https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/embeddings/registry.py"
click node_plugin_ui "https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/ui/index.ts"
click node_session "https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/agent/session.ts"
click node_runtime "https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/agent/runtime.ts"
click node_zotero_context "https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/zotero/context.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp,node_cli,node_plugin_user toneBlue
class node_search,node_retrieval,node_annotations,node_writes,node_scite,node_helpers toneAmber
class node_library,node_client,node_localdb,node_extract toneMint
class node_semantic_search,node_chroma,node_embeddings toneRose
class node_plugin_ui,node_session,node_runtime,node_zotero_context,node_assistant,node_scite_service toneIndigo
```

## Components

### Assistant entry points

- [MCP server](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/server.py): `src/zotero_mcp/server.py`
- [Zotero CLI](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/cli.py): `src/zotero_mcp/cli.py`

### Library operations

- [Search tools](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/search.py): `src/zotero_mcp/tools/search.py`
- [Read tools](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/retrieval.py): `src/zotero_mcp/tools/retrieval.py`
- [Annotation tools](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/annotations.py): `src/zotero_mcp/tools/annotations.py`
- [Write tools](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/write.py): `src/zotero_mcp/tools/write.py`
- [Scite lookup](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/scite.py): `src/zotero_mcp/tools/scite.py`
- [Shared tool helpers](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/tools/_helpers.py): `src/zotero_mcp/tools/_helpers.py`

### Zotero data access

- [Library facade](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/library.py): `src/zotero_mcp/library.py`
- [Zotero client](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/client.py): `src/zotero_mcp/client.py`
- [Local reader](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/local_db.py): `src/zotero_mcp/local_db.py`
- [Text extraction](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/extract.py): `src/zotero_mcp/extract.py`

### Semantic search

- [Semantic indexing](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/semantic_search.py): `src/zotero_mcp/semantic_search.py`
- [Vector store](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/chroma_client.py): `src/zotero_mcp/chroma_client.py`
- [Embedding providers](https://github.com/54yyyu/zotero-mcp/blob/main/src/zotero_mcp/embeddings/registry.py): `src/zotero_mcp/embeddings/registry.py`

### Zotero Agent

- [Chat UI](https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/ui/index.ts): `plugin/src/ui/index.ts`
- [Agent session](https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/agent/session.ts): `plugin/src/agent/session.ts`
- [Agent runtime](https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/agent/runtime.ts): `plugin/src/agent/runtime.ts`
- [Zotero context](https://github.com/54yyyu/zotero-mcp/blob/main/plugin/src/zotero/context.ts): `plugin/src/zotero/context.ts`

### Other components

- **AI assistant**
- **Scite service**
- **Zotero user**

## Connections

- AI assistant → MCP server: requests tools (evidence: `README.md`)
- MCP server → Search tools: registers tools (evidence: `src/zotero_mcp/server.py`)
- MCP server → Read tools: registers tools (evidence: `src/zotero_mcp/server.py`)
- MCP server → Annotation tools: registers tools (evidence: `src/zotero_mcp/server.py`)
- MCP server → Write tools: registers tools (evidence: `src/zotero_mcp/server.py`)
- Search tools → Library facade: queries library (evidence: `src/zotero_mcp/tools/search.py`)
- Search tools → Semantic indexing: runs semantic query (evidence: `src/zotero_mcp/tools/search.py`)
- Read tools → Local reader: reads locally (evidence: `src/zotero_mcp/tools/retrieval.py`)
- Read tools → Zotero client: reads Zotero (evidence: `src/zotero_mcp/tools/retrieval.py`)
- Read tools → Text extraction: extracts full text (evidence: `src/zotero_mcp/extract.py`)
- Write tools → Zotero client: writes items (evidence: `src/zotero_mcp/tools/write.py`)
- Write tools → Shared tool helpers: uses helpers (evidence: `src/zotero_mcp/tools/write.py`)
- Annotation tools → Zotero client: annotates library (evidence: `README.md`)
- Semantic indexing → Text extraction: extracts content (evidence: `src/zotero_mcp/extract.py`)
- Semantic indexing → Vector store: stores vectors (evidence: `src/zotero_mcp/semantic_search.py`)
- Semantic indexing → Embedding providers: creates embeddings (evidence: `src/zotero_mcp/semantic_search.py`)
- Scite lookup → Scite service: fetches citations (evidence: `README.md`)
- Zotero user → Chat UI: chats in Zotero (evidence: `README.md`)
- Chat UI → Agent session: sends chat input
- Agent session → Agent runtime: opens agent (evidence: `plugin/src/agent/runtime.ts`)
- Chat UI → Zotero context: uses open item context (evidence: `README.md`)
- Zotero CLI → AI assistant: serves shell agents (evidence: `README.md`)
