README
🚀 TriliumNext 笔记 MCP 服务器
TriliumNext 笔记 MCP 服务器是一个模型上下文协议服务器,用于与 TriliumNext Notes 实例交互。它提供了通过 MCP 操作 Trilium 笔记的工具,方便开发者对笔记进行管理。
⚠️ 重要提示
这是 https://github.com/TriliumNext/Notes/issues/705 的原型,仅建议开发者使用。请在使用此工具前备份您的 Trilium 笔记。
💡 使用建议
建议使用 VSCode 中的 Cline 扩展,而不是 Claude Desktop。
更新:支持最新的 TriliumNext v0.92.6 版本
🚀 快速开始
确保先设置好环境变量:
TRILIUM_API_URL(默认:http://localhost:8080/etapi)TRILIUM_API_TOKEN(必需,从您的 Trilium Notes 设置中获取)
📦 安装指南
1. 使用 Claude Desktop
将服务器配置添加到您的 Claude Desktop 配置文件中:
在 mcpServers 对象中添加以下配置到您的 Claude 配置文件中:
开发环境(适用于 Windows/Linux)
cd /path/to/triliumnext-mcp
npm run build
"triliumnext-mcp": {
"command": "node",
"args": [
"/path/to/triliumnext-mcp/build/index.js"
],
"env": {
"TRILIUM_API_URL": "http://localhost:8080/etapi",
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>"
}
}
本地安装(适用于 Linux)
"triliumnext-mcp": {
"command": "npx",
"args": [
"-y",
"triliumnext-mcp"
],
"env": {
"TRILIUM_API_URL": "http://localhost:8080/etapi",
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>"
}
}
本地安装(适用于 Windows)
"triliumnext-mcp": {
"command": "cmd",
"args": [
"/k",
"npx",
"-y",
"triliumnext-mcp"
],
"env": {
"TRILIUM_API_URL": "http://localhost:8080/etapi",
"TRILIUM_API_TOKEN": "<YOUR_TRILIUM_API_TOKEN>"
}
}
配置文件的位置:
- Windows:%APPDATA%/Claude/claude_desktop_config.json
- MacOS:~/Library/Application Support/Claude/claude_desktop_config.json
✨ 主要特性
该服务器提供以下笔记管理工具:
| 工具名称 | 功能 | 必需参数 | 可选参数 |
| ---- | ---- | ---- | ---- |
| search_notes | 搜索笔记内容 | 搜索查询 | fastSearch(全文搜索开关),includeArchivedNotes |
| get_note | 通过 ID 获取笔记内容 | 笔记 ID | 无 |
| create_note | 创建新笔记 | 父笔记 ID,标题,类型,内容 | MIME 类型(用于代码/文件/图片笔记) |
| update_note | 更新现有笔记 | 笔记 ID | 新标题,新内容 |
| delete_note | 删除笔记 | 笔记 ID | 无 |
支持的笔记类型:text, code, file, image, search, book, relationMap, render
🔧 技术细节
如果您想贡献或修改服务器,可按以下步骤操作:
# 克隆仓库
git clone https://github.com/tan-yong-sheng/triliumnext-mcp.git
# 安装依赖项
npm install
# 构建服务器
npm run build
# 开发时自动重建
npm run watch
注意:请根据 Claude Desktop 的配置文件位置进行相应调整。
Scan to contact