zotero-bridge 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README-en.md +324 -0
- package/README.md +324 -0
- package/dist/database.d.ts +280 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +1031 -0
- package/dist/database.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +504 -0
- package/dist/index.js.map +1 -0
- package/dist/pdf.d.ts +57 -0
- package/dist/pdf.d.ts.map +1 -0
- package/dist/pdf.js +143 -0
- package/dist/pdf.js.map +1 -0
- package/dist/tools.d.ts +396 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +425 -0
- package/dist/tools.js.map +1 -0
- package/package.json +50 -0
- package/server.json +20 -0
- package/src/database.ts +1225 -0
- package/src/index.ts +630 -0
- package/src/pdf.ts +184 -0
- package/src/tools.ts +489 -0
- package/tsconfig.json +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Combjellyshen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README-en.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# ZoteroBridge
|
|
2
|
+
|
|
3
|
+
<p align="right">
|
|
4
|
+
<a href="README.md">简体中文</a> | <a href="README-en.md">English</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>Model Context Protocol (MCP) Server for Zotero SQLite Database</b>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.zotero.org/"><img src="https://img.shields.io/badge/Zotero-7.0+-red" alt="Zotero"></a>
|
|
13
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-18+-green" alt="Node.js"></a>
|
|
14
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0+-blue" alt="TypeScript"></a>
|
|
15
|
+
<a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-1.0-purple" alt="MCP"></a>
|
|
16
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow" alt="License"></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📚 Overview
|
|
22
|
+
|
|
23
|
+
ZoteroBridge is a Model Context Protocol (MCP) server that connects directly to Zotero's SQLite database (`zotero.sqlite`), enabling AI assistants (like Claude, ChatGPT, etc.) to interact with your Zotero reference library.
|
|
24
|
+
|
|
25
|
+
### ✨ Key Features
|
|
26
|
+
|
|
27
|
+
- 🗂️ **Collection Management** - Create, rename, move, and delete Zotero collections (folders)
|
|
28
|
+
- 🏷️ **Tag Management** - Add, remove, and query tags for references
|
|
29
|
+
- 📖 **Item Operations** - Search items, get details, manage collection relationships
|
|
30
|
+
- 📝 **Abstract Management** - Read and set item abstracts, add notes
|
|
31
|
+
- 📄 **PDF Processing** - Extract PDF full text, generate summaries, full-text search
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🚀 Quick Start
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
- Node.js 18.0 or higher
|
|
40
|
+
- Zotero 7.0 or higher
|
|
41
|
+
- An MCP-compatible AI client (e.g., Claude Desktop, Cursor)
|
|
42
|
+
|
|
43
|
+
### Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Clone the repository
|
|
47
|
+
git clone https://github.com/Combjellyshen/ZoteroBridge.git
|
|
48
|
+
cd ZoteroBridge
|
|
49
|
+
|
|
50
|
+
# Install dependencies
|
|
51
|
+
npm install
|
|
52
|
+
|
|
53
|
+
# Build the project
|
|
54
|
+
npm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Configure AI Clients
|
|
58
|
+
|
|
59
|
+
#### Claude Desktop
|
|
60
|
+
|
|
61
|
+
Add to your Claude Desktop configuration file:
|
|
62
|
+
|
|
63
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
64
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"zotero-bridge": {
|
|
70
|
+
"command": "node",
|
|
71
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"],
|
|
72
|
+
"env": {}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Cursor IDE
|
|
79
|
+
|
|
80
|
+
Create `.cursor/mcp.json` in your project root:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"zotero-bridge": {
|
|
86
|
+
"command": "node",
|
|
87
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### VS Code Copilot
|
|
94
|
+
|
|
95
|
+
1. Open VS Code Settings (`Ctrl+,`).
|
|
96
|
+
2. Search for `github.copilot.chat.mcpServers`.
|
|
97
|
+
3. Click "Edit in settings.json".
|
|
98
|
+
4. Add the following configuration:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
"github.copilot.chat.mcpServers": {
|
|
102
|
+
"zotero-bridge": {
|
|
103
|
+
"command": "node",
|
|
104
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
Make sure to replace `path/to/ZoteroBridge/dist/index.js` with the actual absolute path.
|
|
109
|
+
|
|
110
|
+
#### Custom Database Path
|
|
111
|
+
|
|
112
|
+
If your Zotero database is not in the default location:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"zotero-bridge": {
|
|
118
|
+
"command": "node",
|
|
119
|
+
"args": [
|
|
120
|
+
"path/to/ZoteroBridge/dist/index.js",
|
|
121
|
+
"--db", "D:/MyZotero/zotero.sqlite"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🛠️ Available Tools
|
|
131
|
+
|
|
132
|
+
### Collection Management
|
|
133
|
+
|
|
134
|
+
| Tool | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `list_collections` | List all collections |
|
|
137
|
+
| `get_collection` | Get collection details |
|
|
138
|
+
| `create_collection` | Create a new collection |
|
|
139
|
+
| `rename_collection` | Rename a collection |
|
|
140
|
+
| `move_collection` | Move collection to new parent |
|
|
141
|
+
| `delete_collection` | Delete a collection |
|
|
142
|
+
| `get_subcollections` | Get subcollections |
|
|
143
|
+
|
|
144
|
+
### Tag Management
|
|
145
|
+
|
|
146
|
+
| Tool | Description |
|
|
147
|
+
|------|-------------|
|
|
148
|
+
| `list_tags` | List all tags |
|
|
149
|
+
| `create_tag` | Create a new tag |
|
|
150
|
+
| `add_tag` | Add a tag to an item |
|
|
151
|
+
| `remove_tag` | Remove a tag from an item |
|
|
152
|
+
| `get_item_tags` | Get all tags for an item |
|
|
153
|
+
|
|
154
|
+
### Item Operations
|
|
155
|
+
|
|
156
|
+
| Tool | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `search_items` | Search items by title |
|
|
159
|
+
| `get_item_details` | Get detailed item information |
|
|
160
|
+
| `add_item_to_collection` | Add item to a collection |
|
|
161
|
+
| `remove_item_from_collection` | Remove item from a collection |
|
|
162
|
+
| `get_collection_items` | Get all items in a collection |
|
|
163
|
+
|
|
164
|
+
### Abstract and Notes
|
|
165
|
+
|
|
166
|
+
| Tool | Description |
|
|
167
|
+
|------|-------------|
|
|
168
|
+
| `get_item_abstract` | Get item abstract |
|
|
169
|
+
| `set_item_abstract` | Set item abstract |
|
|
170
|
+
| `get_item_notes` | Get item notes |
|
|
171
|
+
| `add_item_note` | Add a note to an item |
|
|
172
|
+
|
|
173
|
+
### PDF Processing
|
|
174
|
+
|
|
175
|
+
| Tool | Description |
|
|
176
|
+
|------|-------------|
|
|
177
|
+
| `extract_pdf_text` | Extract full text from PDF |
|
|
178
|
+
| `get_pdf_summary` | Get PDF summary information |
|
|
179
|
+
| `get_item_pdfs` | Get PDF attachments for an item |
|
|
180
|
+
| `search_pdf` | Search text within a PDF |
|
|
181
|
+
| `generate_abstract_from_pdf` | Generate abstract from PDF content |
|
|
182
|
+
|
|
183
|
+
### Utilities
|
|
184
|
+
|
|
185
|
+
| Tool | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `get_database_info` | Get database information |
|
|
188
|
+
| `raw_query` | Execute raw SQL query (SELECT only) |
|
|
189
|
+
|
|
190
|
+
### Identifier Search (DOI/ISBN)
|
|
191
|
+
|
|
192
|
+
| Tool | Description |
|
|
193
|
+
|------|-------------|
|
|
194
|
+
| `find_by_doi` | Find item by DOI |
|
|
195
|
+
| `find_by_isbn` | Find item by ISBN |
|
|
196
|
+
| `find_by_identifier` | Find item by any identifier (DOI, ISBN, PMID, arXiv) |
|
|
197
|
+
|
|
198
|
+
### PDF Annotations
|
|
199
|
+
|
|
200
|
+
| Tool | Description |
|
|
201
|
+
|------|-------------|
|
|
202
|
+
| `get_item_annotations` | Get all annotations for an item (highlights, notes, etc.) |
|
|
203
|
+
| `get_attachment_annotations` | Get annotations from a specific attachment |
|
|
204
|
+
| `get_annotations_by_type` | Filter annotations by type (highlight, note, etc.) |
|
|
205
|
+
| `get_annotations_by_color` | Filter annotations by color |
|
|
206
|
+
| `search_annotations` | Search within annotation content |
|
|
207
|
+
|
|
208
|
+
### Fulltext Search
|
|
209
|
+
|
|
210
|
+
| Tool | Description |
|
|
211
|
+
|------|-------------|
|
|
212
|
+
| `search_fulltext` | Search in fulltext index |
|
|
213
|
+
| `get_fulltext_content` | Get fulltext content of an attachment |
|
|
214
|
+
| `search_fulltext_with_context` | Fulltext search with context snippets |
|
|
215
|
+
|
|
216
|
+
### Related Items
|
|
217
|
+
|
|
218
|
+
| Tool | Description |
|
|
219
|
+
|------|-------------|
|
|
220
|
+
| `get_related_items` | Get manually linked related items |
|
|
221
|
+
| `find_similar_by_tags` | Find similar items by shared tags |
|
|
222
|
+
| `find_similar_by_creators` | Find similar items by shared authors |
|
|
223
|
+
| `find_similar_by_collection` | Find similar items in same collection |
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 📖 Usage Examples
|
|
228
|
+
|
|
229
|
+
### Using with Claude
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
# List all collections
|
|
233
|
+
List all collections in my Zotero library
|
|
234
|
+
|
|
235
|
+
# Create a new collection
|
|
236
|
+
Create a new collection called "Machine Learning Papers"
|
|
237
|
+
|
|
238
|
+
# Search items
|
|
239
|
+
Search for items with "deep learning" in the title
|
|
240
|
+
|
|
241
|
+
# Extract PDF content
|
|
242
|
+
Extract the full text from this item's PDF and generate a summary
|
|
243
|
+
|
|
244
|
+
# Add tags
|
|
245
|
+
Add "important" and "to-read" tags to this item
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 🏗️ Project Structure
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
ZoteroBridge/
|
|
254
|
+
├── src/
|
|
255
|
+
│ ├── index.ts # MCP server entry point
|
|
256
|
+
│ ├── database.ts # Zotero SQLite database operations
|
|
257
|
+
│ ├── pdf.ts # PDF processing module
|
|
258
|
+
│ └── tools.ts # MCP tool definitions
|
|
259
|
+
├── dist/ # Compiled output
|
|
260
|
+
├── package.json
|
|
261
|
+
├── tsconfig.json
|
|
262
|
+
└── README.md
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 👨💻 Development Guide
|
|
268
|
+
|
|
269
|
+
### Development Mode
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Watch for file changes and auto-compile
|
|
273
|
+
npm run dev
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Build
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm run build
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Command Line Arguments
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Show help
|
|
286
|
+
node dist/index.js --help
|
|
287
|
+
|
|
288
|
+
# Specify database path
|
|
289
|
+
node dist/index.js --db /path/to/zotero.sqlite
|
|
290
|
+
|
|
291
|
+
# Read-only mode
|
|
292
|
+
node dist/index.js --readonly
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## ⚠️ Important Notes
|
|
298
|
+
|
|
299
|
+
1. **Close Zotero**: When using write features, close the Zotero client to avoid database locking
|
|
300
|
+
2. **Backup Data**: Backup `zotero.sqlite` before making modifications
|
|
301
|
+
3. **Read-only Mode**: Use `--readonly` flag when only reading data for safety
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 📄 License
|
|
306
|
+
|
|
307
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 🙏 Acknowledgements
|
|
312
|
+
|
|
313
|
+
- [Zotero](https://www.zotero.org/) - Excellent open-source reference management tool
|
|
314
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) - AI tool integration protocol
|
|
315
|
+
- [cookjohn/zotero-mcp](https://github.com/cookjohn/zotero-mcp) - Project reference
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 📬 Contact
|
|
320
|
+
|
|
321
|
+
- Author: Combjellyshen
|
|
322
|
+
- GitHub: [https://github.com/Combjellyshen/ZoteroBridge](https://github.com/Combjellyshen/ZoteroBridge)
|
|
323
|
+
|
|
324
|
+
Feel free to submit Issues or Pull Requests!
|
package/README.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# ZoteroBridge
|
|
2
|
+
|
|
3
|
+
<p align="right">
|
|
4
|
+
<a href="README.md">简体中文</a> | <a href="README-en.md">English</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>Model Context Protocol (MCP) Server for Zotero SQLite Database</b>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.zotero.org/"><img src="https://img.shields.io/badge/Zotero-7.0+-red" alt="Zotero"></a>
|
|
13
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-18+-green" alt="Node.js"></a>
|
|
14
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0+-blue" alt="TypeScript"></a>
|
|
15
|
+
<a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-1.0-purple" alt="MCP"></a>
|
|
16
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow" alt="License"></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📚 项目概述
|
|
22
|
+
|
|
23
|
+
ZoteroBridge 是一个基于 Model Context Protocol (MCP) 的服务器,它直接连接 Zotero 的 SQLite 数据库 (`zotero.sqlite`),为 AI 助手(如 Claude、ChatGPT 等)提供与 Zotero 文献库交互的能力。
|
|
24
|
+
|
|
25
|
+
### ✨ 主要功能
|
|
26
|
+
|
|
27
|
+
- 🗂️ **目录管理** - 创建、重命名、移动、删除 Zotero 集合(文件夹)
|
|
28
|
+
- 🏷️ **标签管理** - 添加、删除、查询文献标签
|
|
29
|
+
- 📖 **文献操作** - 搜索文献、获取详情、管理集合关系
|
|
30
|
+
- 📝 **摘要管理** - 读取和设置文献摘要、添加笔记
|
|
31
|
+
- 📄 **PDF 处理** - 提取 PDF 全文、生成摘要、全文搜索
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🚀 快速开始
|
|
36
|
+
|
|
37
|
+
### 系统要求
|
|
38
|
+
|
|
39
|
+
- Node.js 18.0 或更高版本
|
|
40
|
+
- Zotero 7.0 或更高版本
|
|
41
|
+
- 一个支持 MCP 的 AI 客户端(如 Claude Desktop、Cursor 等)
|
|
42
|
+
|
|
43
|
+
### 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 克隆项目
|
|
47
|
+
git clone https://github.com/Combjellyshen/ZoteroBridge.git
|
|
48
|
+
cd ZoteroBridge
|
|
49
|
+
|
|
50
|
+
# 安装依赖
|
|
51
|
+
npm install
|
|
52
|
+
|
|
53
|
+
# 构建项目
|
|
54
|
+
npm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 配置 AI 客户端
|
|
58
|
+
|
|
59
|
+
#### Claude Desktop
|
|
60
|
+
|
|
61
|
+
在 Claude Desktop 的配置文件中添加:
|
|
62
|
+
|
|
63
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
64
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"zotero-bridge": {
|
|
70
|
+
"command": "node",
|
|
71
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"],
|
|
72
|
+
"env": {}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Cursor IDE
|
|
79
|
+
|
|
80
|
+
在项目根目录创建 `.cursor/mcp.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"zotero-bridge": {
|
|
86
|
+
"command": "node",
|
|
87
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### VS Code Copilot
|
|
94
|
+
|
|
95
|
+
1. 打开 VS Code 设置 (`Ctrl+,`)。
|
|
96
|
+
2. 搜索 `github.copilot.chat.mcpServers`。
|
|
97
|
+
3. 点击 "在 settings.json 中编辑"。
|
|
98
|
+
4. 添加以下配置:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
"github.copilot.chat.mcpServers": {
|
|
102
|
+
"zotero-bridge": {
|
|
103
|
+
"command": "node",
|
|
104
|
+
"args": ["path/to/ZoteroBridge/dist/index.js"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
确保将 `path/to/ZoteroBridge/dist/index.js` 替换为这一文件的实际绝对路径。
|
|
109
|
+
|
|
110
|
+
#### 自定义数据库路径
|
|
111
|
+
|
|
112
|
+
如果你的 Zotero 数据库不在默认位置,可以指定路径:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"zotero-bridge": {
|
|
118
|
+
"command": "node",
|
|
119
|
+
"args": [
|
|
120
|
+
"path/to/ZoteroBridge/dist/index.js",
|
|
121
|
+
"--db", "D:/MyZotero/zotero.sqlite"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🛠️ 可用工具
|
|
131
|
+
|
|
132
|
+
### 目录/集合管理
|
|
133
|
+
|
|
134
|
+
| 工具 | 描述 |
|
|
135
|
+
|------|------|
|
|
136
|
+
| `list_collections` | 列出所有集合 |
|
|
137
|
+
| `get_collection` | 获取集合详情 |
|
|
138
|
+
| `create_collection` | 创建新集合 |
|
|
139
|
+
| `rename_collection` | 重命名集合 |
|
|
140
|
+
| `move_collection` | 移动集合到新父级 |
|
|
141
|
+
| `delete_collection` | 删除集合 |
|
|
142
|
+
| `get_subcollections` | 获取子集合 |
|
|
143
|
+
|
|
144
|
+
### 标签管理
|
|
145
|
+
|
|
146
|
+
| 工具 | 描述 |
|
|
147
|
+
|------|------|
|
|
148
|
+
| `list_tags` | 列出所有标签 |
|
|
149
|
+
| `create_tag` | 创建新标签 |
|
|
150
|
+
| `add_tag` | 为文献添加标签 |
|
|
151
|
+
| `remove_tag` | 移除文献标签 |
|
|
152
|
+
| `get_item_tags` | 获取文献的所有标签 |
|
|
153
|
+
|
|
154
|
+
### 文献操作
|
|
155
|
+
|
|
156
|
+
| 工具 | 描述 |
|
|
157
|
+
|------|------|
|
|
158
|
+
| `search_items` | 按标题搜索文献 |
|
|
159
|
+
| `get_item_details` | 获取文献详细信息 |
|
|
160
|
+
| `add_item_to_collection` | 将文献添加到集合 |
|
|
161
|
+
| `remove_item_from_collection` | 从集合中移除文献 |
|
|
162
|
+
| `get_collection_items` | 获取集合中的所有文献 |
|
|
163
|
+
|
|
164
|
+
### 摘要和笔记
|
|
165
|
+
|
|
166
|
+
| 工具 | 描述 |
|
|
167
|
+
|------|------|
|
|
168
|
+
| `get_item_abstract` | 获取文献摘要 |
|
|
169
|
+
| `set_item_abstract` | 设置文献摘要 |
|
|
170
|
+
| `get_item_notes` | 获取文献笔记 |
|
|
171
|
+
| `add_item_note` | 添加笔记到文献 |
|
|
172
|
+
|
|
173
|
+
### PDF 处理
|
|
174
|
+
|
|
175
|
+
| 工具 | 描述 |
|
|
176
|
+
|------|------|
|
|
177
|
+
| `extract_pdf_text` | 提取 PDF 全文 |
|
|
178
|
+
| `get_pdf_summary` | 获取 PDF 摘要信息 |
|
|
179
|
+
| `get_item_pdfs` | 获取文献的 PDF 附件 |
|
|
180
|
+
| `search_pdf` | 在 PDF 中搜索文本 |
|
|
181
|
+
| `generate_abstract_from_pdf` | 从 PDF 生成摘要 |
|
|
182
|
+
|
|
183
|
+
### 实用工具
|
|
184
|
+
|
|
185
|
+
| 工具 | 描述 |
|
|
186
|
+
|------|------|
|
|
187
|
+
| `get_database_info` | 获取数据库信息 |
|
|
188
|
+
| `raw_query` | 执行原始 SQL 查询(仅 SELECT) |
|
|
189
|
+
|
|
190
|
+
### 标识符搜索 (DOI/ISBN)
|
|
191
|
+
|
|
192
|
+
| 工具 | 描述 |
|
|
193
|
+
|------|------|
|
|
194
|
+
| `find_by_doi` | 通过 DOI 查找文献 |
|
|
195
|
+
| `find_by_isbn` | 通过 ISBN 查找文献 |
|
|
196
|
+
| `find_by_identifier` | 通过任意标识符(DOI, ISBN, PMID, arXiv)查找文献 |
|
|
197
|
+
|
|
198
|
+
### PDF 注释
|
|
199
|
+
|
|
200
|
+
| 工具 | 描述 |
|
|
201
|
+
|------|------|
|
|
202
|
+
| `get_item_annotations` | 获取文献的所有注释(高亮、批注等) |
|
|
203
|
+
| `get_attachment_annotations` | 获取特定附件的注释 |
|
|
204
|
+
| `get_annotations_by_type` | 按类型筛选注释(高亮、笔记等) |
|
|
205
|
+
| `get_annotations_by_color` | 按颜色筛选注释 |
|
|
206
|
+
| `search_annotations` | 在注释内容中搜索 |
|
|
207
|
+
|
|
208
|
+
### 全文搜索
|
|
209
|
+
|
|
210
|
+
| 工具 | 描述 |
|
|
211
|
+
|------|------|
|
|
212
|
+
| `search_fulltext` | 在全文索引中搜索 |
|
|
213
|
+
| `get_fulltext_content` | 获取附件的全文内容 |
|
|
214
|
+
| `search_fulltext_with_context` | 带上下文的全文搜索 |
|
|
215
|
+
|
|
216
|
+
### 相关文献推荐
|
|
217
|
+
|
|
218
|
+
| 工具 | 描述 |
|
|
219
|
+
|------|------|
|
|
220
|
+
| `get_related_items` | 获取手动关联的相关文献 |
|
|
221
|
+
| `find_similar_by_tags` | 根据共同标签查找相似文献 |
|
|
222
|
+
| `find_similar_by_creators` | 根据共同作者查找相似文献 |
|
|
223
|
+
| `find_similar_by_collection` | 在同一集合中查找相似文献 |
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 📖 使用示例
|
|
228
|
+
|
|
229
|
+
### 在 Claude 中使用
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
# 列出所有集合
|
|
233
|
+
请列出我 Zotero 中的所有集合
|
|
234
|
+
|
|
235
|
+
# 创建新集合
|
|
236
|
+
帮我创建一个名为"机器学习论文"的新集合
|
|
237
|
+
|
|
238
|
+
# 搜索文献
|
|
239
|
+
搜索标题包含"deep learning"的文献
|
|
240
|
+
|
|
241
|
+
# 获取 PDF 内容
|
|
242
|
+
提取这篇文献的 PDF 全文并生成摘要
|
|
243
|
+
|
|
244
|
+
# 添加标签
|
|
245
|
+
为这篇文献添加"重要"和"待读"标签
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 🏗️ 项目结构
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
ZoteroBridge/
|
|
254
|
+
├── src/
|
|
255
|
+
│ ├── index.ts # MCP 服务器入口
|
|
256
|
+
│ ├── database.ts # Zotero SQLite 数据库操作
|
|
257
|
+
│ ├── pdf.ts # PDF 处理模块
|
|
258
|
+
│ └── tools.ts # MCP 工具定义
|
|
259
|
+
├── dist/ # 编译输出
|
|
260
|
+
├── package.json
|
|
261
|
+
├── tsconfig.json
|
|
262
|
+
└── README.md
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 👨💻 开发指南
|
|
268
|
+
|
|
269
|
+
### 开发模式
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# 监听文件变化并自动编译
|
|
273
|
+
npm run dev
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 构建
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm run build
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### 命令行参数
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# 显示帮助
|
|
286
|
+
node dist/index.js --help
|
|
287
|
+
|
|
288
|
+
# 指定数据库路径
|
|
289
|
+
node dist/index.js --db /path/to/zotero.sqlite
|
|
290
|
+
|
|
291
|
+
# 只读模式
|
|
292
|
+
node dist/index.js --readonly
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## ⚠️ 注意事项
|
|
298
|
+
|
|
299
|
+
1. **关闭 Zotero**: 在使用写入功能时,建议关闭 Zotero 客户端以避免数据库锁定
|
|
300
|
+
2. **备份数据**: 修改数据库前建议备份 `zotero.sqlite`
|
|
301
|
+
3. **只读模式**: 如果只需要读取数据,使用 `--readonly` 参数更安全
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 📄 许可证
|
|
306
|
+
|
|
307
|
+
本项目采用 [MIT License](LICENSE) 许可证。
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 🙏 致谢
|
|
312
|
+
|
|
313
|
+
- [Zotero](https://www.zotero.org/) - 优秀的开源文献管理工具
|
|
314
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) - AI 工具集成协议
|
|
315
|
+
- [cookjohn/zotero-mcp](https://github.com/cookjohn/zotero-mcp) - 项目参考
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 📬 联系方式
|
|
320
|
+
|
|
321
|
+
- 作者: Combjellyshen
|
|
322
|
+
- GitHub: [https://github.com/Combjellyshen/ZoteroBridge](https://github.com/Combjellyshen/ZoteroBridge)
|
|
323
|
+
|
|
324
|
+
如有问题或建议,欢迎提交 Issue 或 Pull Request!
|