TriliumNext MCP工具
一个模型上下文协议服务器,允许与TriliumNext Notes进行交互,提供通过自然语言命令创建、搜索、检索、更新和删除笔记的工具。
服务介绍
TriliumNext Notes 的 MCP 服务器
⚠️ 免责声明:这是为 https://github.com/TriliumNext/Notes/issues/705 准备的原型。仅建议开发者使用。请在使用此工具前备份您的 Trilium 笔记。 ⚠️
这是一个用于 TriliumNext Notes 的模型上下文协议服务器。该服务器提供了通过 MCP 与您的 Trilium Notes 实例交互的工具。
更新:支持最新版本的 TriliumNext v0.92.6
注意:建议与 VSCode 中的 Cline 扩展一起使用,而不是 Claude 桌面版
快速开始
首先确保设置好您的环境变量:
TRILIUM_API_URL(默认值: http://localhost:8080/etapi)TRILIUM_API_TOKEN(必需,从您的 Trilium Notes 设置中获取)
安装
1. 与 Claude 桌面版配合使用
将服务器配置添加到您的 Claude 桌面配置文件中:
在您的 Claude 配置文件中的 mcpServers 对象里添加以下配置:
开发用 (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 类型
- 支持的笔记类型:text, code, file, image, search, book, relationMap, render
-
update_note- 更新现有笔记- 需要:笔记 ID
- 可选:新标题、新内容
-
delete_note- 删除笔记- 需要:笔记 ID
开发
如果您希望贡献或修改服务器:
# Clone the repository
git clone https://github.com/tan-yong-sheng/triliumnext-mcp.git
# Install dependencies
npm install
# Build the server
npm run build
# For development with auto-rebuild
npm run watch