triliumnext-mcp 0.3.11 → 0.3.13
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/README.md +149 -149
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -4
- package/build/index.js.map +1 -0
- package/build/modules/attributeManager.js +2 -36
- package/build/modules/attributes/attributeListHandler.d.ts +14 -0
- package/build/modules/attributes/attributeListHandler.d.ts.map +1 -0
- package/build/modules/{attributeListHandler.js → attributes/attributeListHandler.js} +2 -1
- package/build/modules/attributes/attributeListHandler.js.map +1 -0
- package/build/modules/attributes/attributeManageHandler.d.ts +16 -0
- package/build/modules/attributes/attributeManageHandler.d.ts.map +1 -0
- package/build/modules/attributes/attributeManageHandler.js +261 -0
- package/build/modules/attributes/attributeManageHandler.js.map +1 -0
- package/build/modules/attributes/attributeManageManager.d.ts +13 -0
- package/build/modules/attributes/attributeManageManager.d.ts.map +1 -0
- package/build/modules/attributes/attributeManageManager.js +520 -0
- package/build/modules/attributes/attributeManageManager.js.map +1 -0
- package/build/modules/attributes/attributeReadHandler.d.ts +16 -0
- package/build/modules/attributes/attributeReadHandler.d.ts.map +1 -0
- package/build/modules/attributes/attributeReadHandler.js +136 -0
- package/build/modules/attributes/attributeReadHandler.js.map +1 -0
- package/build/modules/attributes/operations/attributeCreation.d.ts +15 -0
- package/build/modules/attributes/operations/attributeCreation.d.ts.map +1 -0
- package/build/modules/attributes/operations/attributeCreation.js +238 -0
- package/build/modules/attributes/operations/attributeCreation.js.map +1 -0
- package/build/modules/attributes/operations/attributeDeletion.d.ts +11 -0
- package/build/modules/attributes/operations/attributeDeletion.d.ts.map +1 -0
- package/build/modules/attributes/operations/attributeDeletion.js +63 -0
- package/build/modules/attributes/operations/attributeDeletion.js.map +1 -0
- package/build/modules/attributes/operations/attributeList.d.ts +29 -0
- package/build/modules/attributes/operations/attributeList.d.ts.map +1 -0
- package/build/modules/{attributeListManager.js → attributes/operations/attributeList.js} +3 -2
- package/build/modules/attributes/operations/attributeList.js.map +1 -0
- package/build/modules/attributes/operations/attributeRead.d.ts +13 -0
- package/build/modules/attributes/operations/attributeRead.d.ts.map +1 -0
- package/build/modules/attributes/operations/attributeRead.js +43 -0
- package/build/modules/attributes/operations/attributeRead.js.map +1 -0
- package/build/modules/attributes/operations/attributeUpdate.d.ts +11 -0
- package/build/modules/attributes/operations/attributeUpdate.d.ts.map +1 -0
- package/build/modules/attributes/operations/attributeUpdate.js +107 -0
- package/build/modules/attributes/operations/attributeUpdate.js.map +1 -0
- package/build/modules/attributes/operations/batchOperations.d.ts +18 -0
- package/build/modules/attributes/operations/batchOperations.d.ts.map +1 -0
- package/build/modules/attributes/operations/batchOperations.js +49 -0
- package/build/modules/attributes/operations/batchOperations.js.map +1 -0
- package/build/modules/attributes/validation/attributeValidator.d.ts +40 -0
- package/build/modules/attributes/validation/attributeValidator.d.ts.map +1 -0
- package/build/modules/attributes/validation/attributeValidator.js +84 -0
- package/build/modules/attributes/validation/attributeValidator.js.map +1 -0
- package/build/modules/attributes/validation/containerProtection.d.ts +14 -0
- package/build/modules/attributes/validation/containerProtection.d.ts.map +1 -0
- package/build/modules/attributes/validation/containerProtection.js +105 -0
- package/build/modules/attributes/validation/containerProtection.js.map +1 -0
- package/build/modules/fileManager.js +329 -0
- package/build/modules/noteHandler.js +73 -8
- package/build/modules/noteManager.js +167 -98
- package/build/modules/notes/crud/noteCreation.d.ts +26 -0
- package/build/modules/notes/crud/noteCreation.d.ts.map +1 -0
- package/build/modules/notes/crud/noteCreation.js +206 -0
- package/build/modules/notes/crud/noteCreation.js.map +1 -0
- package/build/modules/notes/crud/noteDeletion.d.ts +10 -0
- package/build/modules/notes/crud/noteDeletion.d.ts.map +1 -0
- package/build/modules/notes/crud/noteDeletion.js +19 -0
- package/build/modules/notes/crud/noteDeletion.js.map +1 -0
- package/build/modules/notes/crud/noteRetrieval.d.ts +10 -0
- package/build/modules/notes/crud/noteRetrieval.d.ts.map +1 -0
- package/build/modules/notes/crud/noteRetrieval.js +64 -0
- package/build/modules/notes/crud/noteRetrieval.js.map +1 -0
- package/build/modules/notes/crud/noteUpdate.d.ts +10 -0
- package/build/modules/notes/crud/noteUpdate.d.ts.map +1 -0
- package/build/modules/notes/crud/noteUpdate.js +305 -0
- package/build/modules/notes/crud/noteUpdate.js.map +1 -0
- package/build/modules/notes/noteHandler.d.ts +51 -0
- package/build/modules/notes/noteHandler.d.ts.map +1 -0
- package/build/modules/notes/noteHandler.js +211 -0
- package/build/modules/notes/noteHandler.js.map +1 -0
- package/build/modules/notes/noteManager.d.ts +102 -0
- package/build/modules/notes/noteManager.d.ts.map +1 -0
- package/build/modules/notes/noteManager.js +20 -0
- package/build/modules/notes/noteManager.js.map +1 -0
- package/build/modules/notes/operations/duplicateChecker.d.ts +12 -0
- package/build/modules/notes/operations/duplicateChecker.d.ts.map +1 -0
- package/build/modules/notes/operations/duplicateChecker.js +43 -0
- package/build/modules/notes/operations/duplicateChecker.js.map +1 -0
- package/build/modules/notes/operations/searchReplace.d.ts +14 -0
- package/build/modules/notes/operations/searchReplace.d.ts.map +1 -0
- package/build/modules/notes/operations/searchReplace.js +206 -0
- package/build/modules/notes/operations/searchReplace.js.map +1 -0
- package/build/modules/notes/validation/containerValidator.d.ts +13 -0
- package/build/modules/notes/validation/containerValidator.d.ts.map +1 -0
- package/build/modules/notes/validation/containerValidator.js +87 -0
- package/build/modules/notes/validation/containerValidator.js.map +1 -0
- package/build/modules/notes/validation/contentValidator.d.ts +14 -0
- package/build/modules/notes/validation/contentValidator.d.ts.map +1 -0
- package/build/modules/notes/validation/contentValidator.js +12 -0
- package/build/modules/notes/validation/contentValidator.js.map +1 -0
- package/build/modules/notes/validation/hashValidator.d.ts +12 -0
- package/build/modules/notes/validation/hashValidator.d.ts.map +1 -0
- package/build/modules/notes/validation/hashValidator.js +24 -0
- package/build/modules/notes/validation/hashValidator.js.map +1 -0
- package/build/modules/resolve/resolveHandler.d.ts +6 -0
- package/build/modules/resolve/resolveHandler.d.ts.map +1 -0
- package/build/modules/resolve/resolveHandler.js +53 -0
- package/build/modules/resolve/resolveHandler.js.map +1 -0
- package/build/modules/resolve/resolveManager.d.ts +31 -0
- package/build/modules/resolve/resolveManager.d.ts.map +1 -0
- package/build/modules/resolve/resolveManager.js +145 -0
- package/build/modules/resolve/resolveManager.js.map +1 -0
- package/build/modules/search/filtering/hierarchyFilter.d.ts +35 -0
- package/build/modules/search/filtering/hierarchyFilter.d.ts.map +1 -0
- package/build/modules/search/filtering/hierarchyFilter.js +187 -0
- package/build/modules/search/filtering/hierarchyFilter.js.map +1 -0
- package/build/modules/search/filtering/resultFilter.d.ts +42 -0
- package/build/modules/search/filtering/resultFilter.d.ts.map +1 -0
- package/build/modules/search/filtering/resultFilter.js +132 -0
- package/build/modules/search/filtering/resultFilter.js.map +1 -0
- package/build/modules/search/query/queryBuilder.d.ts +19 -0
- package/build/modules/search/query/queryBuilder.d.ts.map +1 -0
- package/build/modules/search/query/queryBuilder.js +471 -0
- package/build/modules/search/query/queryBuilder.js.map +1 -0
- package/build/modules/search/query/queryOptimizer.d.ts +30 -0
- package/build/modules/search/query/queryOptimizer.d.ts.map +1 -0
- package/build/modules/search/query/queryOptimizer.js +133 -0
- package/build/modules/search/query/queryOptimizer.js.map +1 -0
- package/build/modules/search/query/queryValidator.d.ts +53 -0
- package/build/modules/search/query/queryValidator.d.ts.map +1 -0
- package/build/modules/search/query/queryValidator.js +157 -0
- package/build/modules/search/query/queryValidator.js.map +1 -0
- package/build/modules/search/searchHandler.d.ts +15 -0
- package/build/modules/search/searchHandler.d.ts.map +1 -0
- package/build/modules/search/searchHandler.js +36 -0
- package/build/modules/search/searchHandler.js.map +1 -0
- package/build/modules/search/searchManager.d.ts +33 -0
- package/build/modules/search/searchManager.d.ts.map +1 -0
- package/build/modules/search/searchManager.js +77 -0
- package/build/modules/search/searchManager.js.map +1 -0
- package/build/modules/searchManager.js +1 -53
- package/build/modules/searchQueryBuilder.js +0 -7
- package/build/modules/shared/index.d.ts +18 -0
- package/build/modules/shared/index.d.ts.map +1 -0
- package/build/modules/shared/index.js +26 -0
- package/build/modules/shared/index.js.map +1 -0
- package/build/modules/toolDefinitions.js +42 -55
- package/build/modules/tools/definitions/attributeTools.d.ts +13 -0
- package/build/modules/tools/definitions/attributeTools.d.ts.map +1 -0
- package/build/modules/tools/definitions/attributeTools.js +130 -0
- package/build/modules/tools/definitions/attributeTools.js.map +1 -0
- package/build/modules/tools/definitions/readTools.d.ts +9 -0
- package/build/modules/tools/definitions/readTools.d.ts.map +1 -0
- package/build/modules/tools/definitions/readTools.js +130 -0
- package/build/modules/tools/definitions/readTools.js.map +1 -0
- package/build/modules/tools/definitions/writeTools.d.ts +9 -0
- package/build/modules/tools/definitions/writeTools.d.ts.map +1 -0
- package/build/modules/tools/definitions/writeTools.js +177 -0
- package/build/modules/tools/definitions/writeTools.js.map +1 -0
- package/build/modules/tools/toolDefinitions.d.ts +26 -0
- package/build/modules/tools/toolDefinitions.d.ts.map +1 -0
- package/build/modules/tools/toolDefinitions.js +450 -0
- package/build/modules/tools/toolDefinitions.js.map +1 -0
- package/build/modules/types/index.d.ts +134 -0
- package/build/modules/types/index.d.ts.map +1 -0
- package/build/modules/types/index.js +2 -0
- package/build/modules/types/index.js.map +1 -0
- package/build/modules/utils/attributes/attributeNameCleaner.d.ts +54 -0
- package/build/modules/utils/attributes/attributeNameCleaner.d.ts.map +1 -0
- package/build/modules/utils/attributes/attributeNameCleaner.js +130 -0
- package/build/modules/utils/attributes/attributeNameCleaner.js.map +1 -0
- package/build/modules/utils/attributes/attributeUtils.d.ts +41 -0
- package/build/modules/utils/attributes/attributeUtils.d.ts.map +1 -0
- package/build/modules/utils/attributes/attributeUtils.js +116 -0
- package/build/modules/utils/attributes/attributeUtils.js.map +1 -0
- package/build/modules/utils/attributes/index.d.ts +7 -0
- package/build/modules/utils/attributes/index.d.ts.map +1 -0
- package/build/modules/utils/attributes/index.js +9 -0
- package/build/modules/utils/attributes/index.js.map +1 -0
- package/build/modules/utils/content/contentProcessor.d.ts +20 -0
- package/build/modules/utils/content/contentProcessor.d.ts.map +1 -0
- package/build/modules/utils/content/contentProcessor.js +186 -0
- package/build/modules/utils/content/contentProcessor.js.map +1 -0
- package/build/modules/utils/content/index.d.ts +7 -0
- package/build/modules/utils/content/index.d.ts.map +1 -0
- package/build/modules/utils/content/index.js +9 -0
- package/build/modules/utils/content/index.js.map +1 -0
- package/build/modules/utils/content/templateMapper.d.ts +63 -0
- package/build/modules/utils/content/templateMapper.d.ts.map +1 -0
- package/build/{utils → modules/utils/content}/templateMapper.js +1 -0
- package/build/modules/utils/content/templateMapper.js.map +1 -0
- package/build/modules/utils/formatting/index.d.ts +7 -0
- package/build/modules/utils/formatting/index.d.ts.map +1 -0
- package/build/modules/utils/formatting/index.js +9 -0
- package/build/modules/utils/formatting/index.js.map +1 -0
- package/build/modules/utils/formatting/noteBuilder.d.ts +12 -0
- package/build/modules/utils/formatting/noteBuilder.d.ts.map +1 -0
- package/build/modules/utils/formatting/noteBuilder.js +18 -0
- package/build/modules/utils/formatting/noteBuilder.js.map +1 -0
- package/build/modules/utils/formatting/noteFormatter.d.ts +30 -0
- package/build/modules/utils/formatting/noteFormatter.d.ts.map +1 -0
- package/build/modules/utils/formatting/noteFormatter.js +59 -0
- package/build/modules/utils/formatting/noteFormatter.js.map +1 -0
- package/build/modules/utils/recovery/index.d.ts +6 -0
- package/build/modules/utils/recovery/index.d.ts.map +1 -0
- package/build/modules/utils/recovery/index.js +7 -0
- package/build/modules/utils/recovery/index.js.map +1 -0
- package/build/modules/utils/recovery/noteRecovery.d.ts +51 -0
- package/build/modules/utils/recovery/noteRecovery.d.ts.map +1 -0
- package/build/modules/utils/recovery/noteRecovery.js +195 -0
- package/build/modules/utils/recovery/noteRecovery.js.map +1 -0
- package/build/modules/utils/system/errorUtils.d.ts +34 -0
- package/build/modules/utils/system/errorUtils.d.ts.map +1 -0
- package/build/modules/utils/system/errorUtils.js +48 -0
- package/build/modules/utils/system/errorUtils.js.map +1 -0
- package/build/modules/utils/system/index.d.ts +8 -0
- package/build/modules/utils/system/index.d.ts.map +1 -0
- package/build/modules/utils/system/index.js +11 -0
- package/build/modules/utils/system/index.js.map +1 -0
- package/build/modules/utils/system/permissionUtils.d.ts +46 -0
- package/build/modules/utils/system/permissionUtils.d.ts.map +1 -0
- package/build/modules/utils/system/permissionUtils.js +56 -0
- package/build/modules/utils/system/permissionUtils.js.map +1 -0
- package/build/modules/utils/system/verboseUtils.d.ts +41 -0
- package/build/modules/utils/system/verboseUtils.d.ts.map +1 -0
- package/build/modules/utils/system/verboseUtils.js +102 -0
- package/build/modules/utils/system/verboseUtils.js.map +1 -0
- package/build/modules/utils/validation/contentIntegrity.d.ts +72 -0
- package/build/modules/utils/validation/contentIntegrity.d.ts.map +1 -0
- package/build/modules/utils/validation/contentIntegrity.js +160 -0
- package/build/modules/utils/validation/contentIntegrity.js.map +1 -0
- package/build/modules/utils/validation/contentRules.d.ts +53 -0
- package/build/modules/utils/validation/contentRules.d.ts.map +1 -0
- package/build/modules/utils/validation/contentRules.js +267 -0
- package/build/modules/utils/validation/contentRules.js.map +1 -0
- package/build/modules/utils/validation/index.d.ts +8 -0
- package/build/modules/utils/validation/index.d.ts.map +1 -0
- package/build/modules/utils/validation/index.js +11 -0
- package/build/modules/utils/validation/index.js.map +1 -0
- package/build/modules/utils/validation/validationUtils.d.ts +310 -0
- package/build/modules/utils/validation/validationUtils.d.ts.map +1 -0
- package/build/modules/utils/validation/validationUtils.js +199 -0
- package/build/modules/utils/validation/validationUtils.js.map +1 -0
- package/build/utils/contentIntegrity.js +8 -2
- package/build/utils/contentRules.js +23 -23
- package/build/utils/fileUtils.js +390 -0
- package/build/utils/validationUtils.js +1 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
# TriliumNext Notes' MCP Server
|
|
2
|
-
|
|
3
|
-
⚠️ **DISCLAIMER: This is a prototype for https://github.com/TriliumNext/Notes/issues/705. Suggested only for developer use. Please backup your Trilium notes before using this tool.** ⚠️
|
|
4
|
-
|
|
5
|
-
A model context protocol server for TriliumNext Notes. This server provides tools to interact with your Trilium Notes instance through MCP.
|
|
6
|
-
|
|
7
|
-
## Quick Start
|
|
8
|
-
|
|
9
|
-
Make sure to set up your environment variables first:
|
|
10
|
-
- `TRILIUM_API_URL` (default: http://localhost:8080/etapi)
|
|
11
|
-
- `TRILIUM_API_TOKEN` (required, get this from your Trilium Notes settings)
|
|
12
|
-
- `PERMISSIONS` (optional, default='READ;WRITE', where READ grants access to `search_notes`, `get_note`, `resolve_note_id`, and `read_attributes`, and WRITE grants access to `create_note`, `update_note`, `delete_note`, and `manage_attributes`)
|
|
13
|
-
- `VERBOSE` (optional, default='false', which if true will print verbose debugging logs)
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
### 1. Using with Claude Desktop
|
|
18
|
-
|
|
19
|
-
Add the server config to your Claude Desktop configuration file:
|
|
20
|
-
|
|
21
|
-
#### For Local Installation (on Windows)
|
|
22
|
-
|
|
23
|
-
```json
|
|
24
|
-
"triliumnext-mcp": {
|
|
25
|
-
"command": "cmd",
|
|
26
|
-
"args": [
|
|
27
|
-
"/k",
|
|
28
|
-
"npx",
|
|
29
|
-
"-y",
|
|
30
|
-
"triliumnext-mcp"
|
|
31
|
-
],
|
|
32
|
-
"env": {
|
|
33
|
-
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
34
|
-
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
35
|
-
"PERMISSIONS": "READ;WRITE"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### For Local installation (on Linux)
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
"triliumnext-mcp": {
|
|
44
|
-
"command": "npx",
|
|
45
|
-
"args": [
|
|
46
|
-
"-y",
|
|
47
|
-
"triliumnext-mcp"
|
|
48
|
-
],
|
|
49
|
-
"env": {
|
|
50
|
-
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
51
|
-
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
52
|
-
"PERMISSIONS": "READ;WRITE"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
#### For Development (on Windows / Linux)
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
cd /path/to/triliumnext-mcp
|
|
61
|
-
npm run build
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
"triliumnext-mcp": {
|
|
66
|
-
"command": "node",
|
|
67
|
-
"args": [
|
|
68
|
-
"/path/to/triliumnext-mcp/build/index.js"
|
|
69
|
-
],
|
|
70
|
-
"env": {
|
|
71
|
-
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
72
|
-
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
73
|
-
"PERMISSIONS": "READ;WRITE",
|
|
74
|
-
"VERBOSE": "true"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Location of the configuration file:
|
|
80
|
-
- Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
81
|
-
- MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
82
|
-
|
|
83
|
-
**Feedback**: Please report issues and test results at [GitHub Issues](https://github.com/TriliumNext/Notes/issues)
|
|
84
|
-
|
|
85
|
-
## Available Tools
|
|
86
|
-
|
|
87
|
-
The server provides the following tools for note management:
|
|
88
|
-
|
|
89
|
-
### Search & Discovery Tools
|
|
90
|
-
|
|
91
|
-
- `search_notes` - Unified search with comprehensive filtering capabilities including keyword search, date ranges, field-specific searches, attribute searches, note properties, template-based searches, note type filtering, MIME type filtering, and hierarchy navigation.
|
|
92
|
-
- `resolve_note_id` - Find a note's ID by its title. Essential for getting a note's ID to use with other tools.
|
|
93
|
-
|
|
94
|
-
### Note Management Tools
|
|
95
|
-
|
|
96
|
-
- `get_note` - Retrieve a note and its content by ID. Can also be used with regex to extract specific patterns from the content.
|
|
97
|
-
- `create_note` - Create a new note. Supports 9 note types and allows creating attributes (labels and relations) in the same step.
|
|
98
|
-
- `update_note` - Updates a note's title or content. Requires a `mode` (`'overwrite'` or `'append'`) to specify the update type and an `expectedHash` to prevent conflicts.
|
|
99
|
-
- `delete_note` - Permanently delete a note (⚠️ cannot be undone).
|
|
100
|
-
|
|
101
|
-
### Attribute Management Tools
|
|
102
|
-
|
|
103
|
-
- `read_attributes` - Read all attributes (labels and relations) for a given note.
|
|
104
|
-
- `manage_attributes` - Create, update, or delete attributes on a note. Supports batch creation.
|
|
105
|
-
|
|
106
|
-
> 📖 **Detailed Usage**: See [Note Management Guide](docs/manage-notes-examples/index.md) for revision control strategy and best practices.
|
|
107
|
-
|
|
108
|
-
## Example Queries
|
|
109
|
-
|
|
110
|
-
### Search & Discovery
|
|
111
|
-
- "Find my most recent 10 notes about 'n8n' since the beginning of 2024"
|
|
112
|
-
- "Show me notes I've edited in the last 7 days"
|
|
113
|
-
- "List all notes under 'n8n Template' folder, including subfolders"
|
|
114
|
-
|
|
115
|
-
### Content Management
|
|
116
|
-
- "Add today's update to my work log" (uses `update_note` with `mode: 'append'`)
|
|
117
|
-
- "Replace this draft with the final version" (uses `update_note` with `mode: 'overwrite'`)
|
|
118
|
-
- "Create a new note called 'Weekly Review' in my journal folder"
|
|
119
|
-
|
|
120
|
-
> 📖 **More Examples**: See [User Query Examples](docs/user-query-examples.md) for comprehensive usage scenarios.
|
|
121
|
-
|
|
122
|
-
## Documentation
|
|
123
|
-
|
|
124
|
-
- [Note Management Guide](docs/manage-notes-examples/index.md) - Safe content editing with revision control
|
|
125
|
-
- [User Query Examples](docs/user-query-examples.md) - Natural language query examples
|
|
126
|
-
- [Search Query Examples](docs/search-examples/) - Advanced search syntax and filters
|
|
127
|
-
|
|
128
|
-
## Development
|
|
129
|
-
|
|
130
|
-
If you want to contribute or modify the server:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
# Clone the repository
|
|
134
|
-
git clone https://github.com/tan-yong-sheng/triliumnext-mcp.git
|
|
135
|
-
|
|
136
|
-
# Install dependencies
|
|
137
|
-
npm install
|
|
138
|
-
|
|
139
|
-
# Build the server
|
|
140
|
-
npm run build
|
|
141
|
-
|
|
142
|
-
# For development with auto-rebuild
|
|
143
|
-
npm run watch
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Contributing
|
|
147
|
-
|
|
148
|
-
Contributions are welcome! If you are looking to improve the server, please familiarize yourself with the official [Trilium Search DSL documentation](https://triliumnext.github.io/Docs/Wiki/search.html) and our internal [Search Query Examples](docs/search-examples/) to understand how search queries are constructed.
|
|
149
|
-
|
|
1
|
+
# TriliumNext Notes' MCP Server
|
|
2
|
+
|
|
3
|
+
⚠️ **DISCLAIMER: This is a prototype for https://github.com/TriliumNext/Notes/issues/705. Suggested only for developer use. Please backup your Trilium notes before using this tool.** ⚠️
|
|
4
|
+
|
|
5
|
+
A model context protocol server for TriliumNext Notes. This server provides tools to interact with your Trilium Notes instance through MCP.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
Make sure to set up your environment variables first:
|
|
10
|
+
- `TRILIUM_API_URL` (default: http://localhost:8080/etapi)
|
|
11
|
+
- `TRILIUM_API_TOKEN` (required, get this from your Trilium Notes settings)
|
|
12
|
+
- `PERMISSIONS` (optional, default='READ;WRITE', where READ grants access to `search_notes`, `get_note`, `resolve_note_id`, and `read_attributes`, and WRITE grants access to `create_note`, `update_note`, `delete_note`, and `manage_attributes`)
|
|
13
|
+
- `VERBOSE` (optional, default='false', which if true will print verbose debugging logs)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### 1. Using with Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add the server config to your Claude Desktop configuration file:
|
|
20
|
+
|
|
21
|
+
#### For Local Installation (on Windows)
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
"triliumnext-mcp": {
|
|
25
|
+
"command": "cmd",
|
|
26
|
+
"args": [
|
|
27
|
+
"/k",
|
|
28
|
+
"npx",
|
|
29
|
+
"-y",
|
|
30
|
+
"triliumnext-mcp"
|
|
31
|
+
],
|
|
32
|
+
"env": {
|
|
33
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
34
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
35
|
+
"PERMISSIONS": "READ;WRITE"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### For Local installation (on Linux)
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"triliumnext-mcp": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": [
|
|
46
|
+
"-y",
|
|
47
|
+
"triliumnext-mcp"
|
|
48
|
+
],
|
|
49
|
+
"env": {
|
|
50
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
51
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
52
|
+
"PERMISSIONS": "READ;WRITE"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### For Development (on Windows / Linux)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd /path/to/triliumnext-mcp
|
|
61
|
+
npm run build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
"triliumnext-mcp": {
|
|
66
|
+
"command": "node",
|
|
67
|
+
"args": [
|
|
68
|
+
"/path/to/triliumnext-mcp/build/index.js"
|
|
69
|
+
],
|
|
70
|
+
"env": {
|
|
71
|
+
"TRILIUM_API_URL": "http://localhost:8080/etapi",
|
|
72
|
+
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>",
|
|
73
|
+
"PERMISSIONS": "READ;WRITE",
|
|
74
|
+
"VERBOSE": "true"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Location of the configuration file:
|
|
80
|
+
- Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
81
|
+
- MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
82
|
+
|
|
83
|
+
**Feedback**: Please report issues and test results at [GitHub Issues](https://github.com/TriliumNext/Notes/issues)
|
|
84
|
+
|
|
85
|
+
## Available Tools
|
|
86
|
+
|
|
87
|
+
The server provides the following tools for note management:
|
|
88
|
+
|
|
89
|
+
### Search & Discovery Tools
|
|
90
|
+
|
|
91
|
+
- `search_notes` - Unified search with comprehensive filtering capabilities including keyword search, date ranges, field-specific searches, attribute searches, note properties, template-based searches, note type filtering, MIME type filtering, and hierarchy navigation.
|
|
92
|
+
- `resolve_note_id` - Find a note's ID by its title. Essential for getting a note's ID to use with other tools.
|
|
93
|
+
|
|
94
|
+
### Note Management Tools
|
|
95
|
+
|
|
96
|
+
- `get_note` - Retrieve a note and its content by ID. Can also be used with regex to extract specific patterns from the content.
|
|
97
|
+
- `create_note` - Create a new note. Supports 9 note types and allows creating attributes (labels and relations) in the same step.
|
|
98
|
+
- `update_note` - Updates a note's title or content. Requires a `mode` (`'overwrite'` or `'append'`) to specify the update type and an `expectedHash` to prevent conflicts.
|
|
99
|
+
- `delete_note` - Permanently delete a note (⚠️ cannot be undone).
|
|
100
|
+
|
|
101
|
+
### Attribute Management Tools
|
|
102
|
+
|
|
103
|
+
- `read_attributes` - Read all attributes (labels and relations) for a given note.
|
|
104
|
+
- `manage_attributes` - Create, update, or delete attributes on a note. Supports batch creation.
|
|
105
|
+
|
|
106
|
+
> 📖 **Detailed Usage**: See [Note Management Guide](docs/manage-notes-examples/index.md) for revision control strategy and best practices.
|
|
107
|
+
|
|
108
|
+
## Example Queries
|
|
109
|
+
|
|
110
|
+
### Search & Discovery
|
|
111
|
+
- "Find my most recent 10 notes about 'n8n' since the beginning of 2024"
|
|
112
|
+
- "Show me notes I've edited in the last 7 days"
|
|
113
|
+
- "List all notes under 'n8n Template' folder, including subfolders"
|
|
114
|
+
|
|
115
|
+
### Content Management
|
|
116
|
+
- "Add today's update to my work log" (uses `update_note` with `mode: 'append'`)
|
|
117
|
+
- "Replace this draft with the final version" (uses `update_note` with `mode: 'overwrite'`)
|
|
118
|
+
- "Create a new note called 'Weekly Review' in my journal folder"
|
|
119
|
+
|
|
120
|
+
> 📖 **More Examples**: See [User Query Examples](docs/user-query-examples.md) for comprehensive usage scenarios.
|
|
121
|
+
|
|
122
|
+
## Documentation
|
|
123
|
+
|
|
124
|
+
- [Note Management Guide](docs/manage-notes-examples/index.md) - Safe content editing with revision control
|
|
125
|
+
- [User Query Examples](docs/user-query-examples.md) - Natural language query examples
|
|
126
|
+
- [Search Query Examples](docs/search-examples/) - Advanced search syntax and filters
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
If you want to contribute or modify the server:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Clone the repository
|
|
134
|
+
git clone https://github.com/tan-yong-sheng/triliumnext-mcp.git
|
|
135
|
+
|
|
136
|
+
# Install dependencies
|
|
137
|
+
npm install
|
|
138
|
+
|
|
139
|
+
# Build the server
|
|
140
|
+
npm run build
|
|
141
|
+
|
|
142
|
+
# For development with auto-rebuild
|
|
143
|
+
npm run watch
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Contributing
|
|
147
|
+
|
|
148
|
+
Contributions are welcome! If you are looking to improve the server, please familiarize yourself with the official [Trilium Search DSL documentation](https://triliumnext.github.io/Docs/Wiki/search.html) and our internal [Search Query Examples](docs/search-examples/) to understand how search queries are constructed.
|
|
149
|
+
|
|
150
150
|
Please feel free to open an issue or submit a pull request.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA0JA,OAAO,EACL,eAAe,EAChB,MAAM,2CAA2C,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import { handleCreateNoteRequest, handleUpdateNoteRequest, handleDeleteNoteReque
|
|
|
9
9
|
import { handleSearchNotesRequest } from "./modules/searchHandler.js";
|
|
10
10
|
import { handleResolveNoteRequest } from "./modules/resolveHandler.js";
|
|
11
11
|
import { handleManageAttributes, handleReadAttributes } from "./modules/attributeHandler.js";
|
|
12
|
-
import { handleListAttributesRequest } from "./modules/attributeListHandler.js";
|
|
13
12
|
const TRILIUM_API_URL = process.env.TRILIUM_API_URL;
|
|
14
13
|
const TRILIUM_API_TOKEN = process.env.TRILIUM_API_TOKEN;
|
|
15
14
|
const PERMISSIONS = process.env.PERMISSIONS || "READ;WRITE";
|
|
@@ -24,7 +23,7 @@ class TriliumServer {
|
|
|
24
23
|
this.allowedPermissions = PERMISSIONS.split(';');
|
|
25
24
|
this.server = new Server({
|
|
26
25
|
name: "triliumnext-mcp",
|
|
27
|
-
version: "0.3.
|
|
26
|
+
version: "0.3.13",
|
|
28
27
|
}, {
|
|
29
28
|
capabilities: {
|
|
30
29
|
tools: {},
|
|
@@ -78,8 +77,6 @@ class TriliumServer {
|
|
|
78
77
|
return await handleReadAttributes(request.params.arguments, this.axiosInstance, this);
|
|
79
78
|
case "manage_attributes":
|
|
80
79
|
return await handleManageAttributes(request.params.arguments, this.axiosInstance, this);
|
|
81
|
-
case "list_attributes":
|
|
82
|
-
return await handleListAttributesRequest(request.params.arguments, this.axiosInstance, this);
|
|
83
80
|
default:
|
|
84
81
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`);
|
|
85
82
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OA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verboseUtils.js";
|
|
7
|
-
import { validateAndTranslateTemplate, createTemplateRelationError } from "../utils/templateMapper.js";
|
|
8
7
|
/**
|
|
9
8
|
* Manage note attributes with write operations (create, update, delete)
|
|
10
9
|
* This function provides write-only access to note attributes
|
|
@@ -50,30 +49,12 @@ async function create_single_attribute(noteId, attribute, axiosInstance) {
|
|
|
50
49
|
errors: validation.errors
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
// Translate template names to note IDs for template relations
|
|
54
|
-
let processedValue = attribute.value || "";
|
|
55
|
-
if (attribute.type === "relation" && attribute.name === "template" && attribute.value) {
|
|
56
|
-
try {
|
|
57
|
-
processedValue = validateAndTranslateTemplate(attribute.value);
|
|
58
|
-
logVerbose("create_single_attribute", `Translated template relation`, {
|
|
59
|
-
from: attribute.value,
|
|
60
|
-
to: processedValue
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
return {
|
|
65
|
-
success: false,
|
|
66
|
-
message: createTemplateRelationError(attribute.value),
|
|
67
|
-
errors: [error instanceof Error ? error.message : 'Template validation failed']
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
52
|
// Prepare attribute data for ETAPI
|
|
72
53
|
const attributeData = {
|
|
73
54
|
noteId: noteId,
|
|
74
55
|
type: attribute.type,
|
|
75
56
|
name: attribute.name,
|
|
76
|
-
value:
|
|
57
|
+
value: attribute.value || "",
|
|
77
58
|
position: attribute.position || 10,
|
|
78
59
|
isInheritable: attribute.isInheritable || false
|
|
79
60
|
};
|
|
@@ -114,26 +95,11 @@ async function create_batch_attributes(noteId, attributes, axiosInstance) {
|
|
|
114
95
|
errors.push(`Validation failed for ${attribute.type} '${attribute.name}': ${validation.errors.join(', ')}`);
|
|
115
96
|
return null;
|
|
116
97
|
}
|
|
117
|
-
// Translate template names to note IDs for template relations
|
|
118
|
-
let processedValue = attribute.value || "";
|
|
119
|
-
if (attribute.type === "relation" && attribute.name === "template" && attribute.value) {
|
|
120
|
-
try {
|
|
121
|
-
processedValue = validateAndTranslateTemplate(attribute.value);
|
|
122
|
-
logVerbose("create_batch_attributes", `Translated template relation`, {
|
|
123
|
-
from: attribute.value,
|
|
124
|
-
to: processedValue
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
errors.push(createTemplateRelationError(attribute.value));
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
98
|
const attributeData = {
|
|
133
99
|
noteId: noteId,
|
|
134
100
|
type: attribute.type,
|
|
135
101
|
name: attribute.name,
|
|
136
|
-
value:
|
|
102
|
+
value: attribute.value || "",
|
|
137
103
|
position: attribute.position || 10,
|
|
138
104
|
isInheritable: attribute.isInheritable || false
|
|
139
105
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute List Handler Module
|
|
3
|
+
* Centralized request handling for attribute listing operations
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Handle list_attributes tool requests
|
|
7
|
+
*/
|
|
8
|
+
export declare function handleListAttributesRequest(args: any, axiosInstance: any, permissionChecker: any): Promise<{
|
|
9
|
+
content: {
|
|
10
|
+
type: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=attributeListHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributeListHandler.d.ts","sourceRoot":"","sources":["../../../src/modules/attributes/attributeListHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG;;;;;GA0BtG"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Centralized request handling for attribute listing operations
|
|
4
4
|
*/
|
|
5
5
|
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
-
import { handleListAttributes } from "./
|
|
6
|
+
import { handleListAttributes } from "./operations/attributeList.js";
|
|
7
7
|
/**
|
|
8
8
|
* Handle list_attributes tool requests
|
|
9
9
|
*/
|
|
@@ -32,3 +32,4 @@ export async function handleListAttributesRequest(args, axiosInstance, permissio
|
|
|
32
32
|
throw new McpError(ErrorCode.InvalidParams, error instanceof Error ? error.message : String(error));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
//# sourceMappingURL=attributeListHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributeListHandler.js","sourceRoot":"","sources":["../../../src/modules/attributes/attributeListHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,IAAS,EAAE,aAAkB,EAAE,iBAAsB;IACrG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,uDAAuD,CAAC,CAAC;IACxG,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,WAAW;YAClD,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;SACxB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAExE,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute Manage Handler Module
|
|
3
|
+
* Processes MCP requests for attribute management operations
|
|
4
|
+
*/
|
|
5
|
+
import { AxiosInstance } from 'axios';
|
|
6
|
+
import { PermissionChecker } from '../shared/index.js';
|
|
7
|
+
import { ManageAttributesRequest } from '../shared/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Handle manage_attributes MCP request
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleManageAttributes(args: ManageAttributesRequest, axiosInstance: AxiosInstance, permissionChecker: PermissionChecker): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Get help text for attribute management
|
|
14
|
+
*/
|
|
15
|
+
export declare function get_manage_attributes_help(): string;
|
|
16
|
+
//# sourceMappingURL=attributeManageHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributeManageHandler.d.ts","sourceRoot":"","sources":["../../../src/modules/attributes/attributeManageHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,uBAAuB,EAC7B,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,GAAG,CAAC,CA6Fd;AA0HD;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAsDnD"}
|