HT

h30190/trilium_mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

8 stars 6 forks 质量 66 趋势 20

This tool (MCP Server) has permissions to your Trilium notes. The author is not responsible for any data loss, corruption, or unexpected consequences resulting from the use of this tool.

概览

This tool (MCP Server) has permissions to your Trilium notes. The author is not responsible for any data loss, corruption, or unexpected consequences resulting from the use of this tool. Use at your own risk. This is a Model Context Protocol (MCP) Server designed for Trilium Notes. It allows AI agents (such as Claude Desktop, Gemini CLI, etc.) to interact directly with your Trilium notes library to search, read, write, and organize notes. - : Search notes by keywords. - : Read note content and basic metadata (optimized for large notes). - : Get full note metadata including attributes, labels, and relations. - : Create new notes (supports text, code, etc.). - : Modify existing note content or attributes. - : Move notes to a new parent. - : List all direct child notes of a parent note. - : Delete a note and all its children (). - : Add, modify, or delete note attributes. Ensure you have Node.js installed (v16+ recommended). Create a .env file in the project root (see .env.

README

以下为原文 README 节选,完整内容请查看原文。

Trilium MCP Server v1.1.0

English | 繁體中文

English

[!WARNING] Disclaimer & Backup Warning

This tool (MCP Server) has permissions to write, modify your Trilium notes. Please ensure you backup your Trilium library before performing any operations with this tool.

The author is not responsible for any data loss, corruption, or unexpected consequences resulting from the use of this tool. Use at your own risk.

This is a Model Context Protocol (MCP) Server designed for Trilium Notes. It allows AI agents (such as Claude Desktop, Gemini CLI, etc.) to interact directly with your Trilium notes library to search, read, write, and organize notes.

Features

  • Search Notes (search_notes): Search notes by keywords.
  • Read Note (read_note): Read note content and basic metadata (optimized for large notes).
  • Get Note Metadata (get_note_metadata): Get full note metadata including attributes, labels, and relations.
  • Create Note (create_note): Create new notes (supports text, code, etc.).
  • Update Note (update_note): Modify existing note content or attributes.
  • Move Note (move_note): Move notes to a new parent.
  • List Children (list_children): List all direct child notes of a parent note.
  • Delete Note (delete_note): Delete a note and all its children (irreversible).
  • Manage Attributes (manage_attributes): Add, modify, or delete note attributes.

Installation & Setup

1. Install Dependencies

Ensure you have Node.js installed (v16+ recommended).

npm install

2. Configure Environment Variables

Create a .env file in the project root (see .env.example):

TRILIUM_ETAPI_URL=http://localhost:8080/etapi
TRILIUM_ETAPI_TOKEN=your_token_here
  • TRILIUM_ETAPI_URL: Your Trilium ETAPI URL. Usually your Trilium URL appended with /etapi.
  • TRILIUM_ETAPI_TOKEN: The token created in Trilium’s Options -> ETAPI.

3. Build Project

npm run build

Usage

Configuration for MCP Client

For Claude Desktop or Gemini CLI, add the following to your configuration file (e.g., claude_desktop_config.json or settings.json):

{
  "mcpServers": {
    "trilium": {
      "command": "node",
      "args": ["/path/to/your/Trilium_MCP/dist/index.js"]
    }
  }
}

Note:

  • Replace /path/to/your/Trilium_MCP/dist/index.js with the actual absolute path on your machine.
  • The program automatically reads the .env file from the project directory, so you don’t need to repeat environment variables in the config file.

Development

  • Build: npm run build
  • Test Connection: npx ts-node test-trilium.ts (Requires .env setup)

License

MIT

About the Author

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "trilium": { "command": "node", "args": ["/path/to/your/Trilium_MCP/dist/index.js"] } } }