triliumnext-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | Log level: silent, error, warn, info, debug | info |
| LOG_FORMAT | No | Log format: text or json | text |
| TRILIUM_URL | No | Trilium ETAPI URL | http://localhost:37740/etapi |
| TRILIUM_TOKEN | No | Trilium ETAPI token (required in single-tenant mode) | |
| TRILIUM_METRICS | No | Enable Prometheus metrics endpoint | false |
| TRILIUM_HTTP_PORT | No | HTTP server port when using http transport | 3000 |
| TRILIUM_TRANSPORT | No | Transport type: stdio or http | stdio |
| TRILIUM_JWT_ISSUER | No | Expected JWT issuer | |
| TRILIUM_JWT_SECRETS | No | Comma-separated JWT shared secrets (HS256) | |
| TRILIUM_CORS_ORIGINS | No | Comma-separated allowed CORS origins | |
| TRILIUM_GATEWAY_AUTH | No | Gateway auth mode: none, bearer, or jwt | bearer |
| TRILIUM_JWT_AUDIENCE | No | Expected JWT audience | |
| TRILIUM_JWT_JWKS_URL | No | JWKS URL for RS256/ES256/EdDSA | |
| TRILIUM_METRICS_AUTH | No | Metrics auth mode: gateway, bearer, or none | gateway |
| TRILIUM_MULTI_TENANT | No | Enable multi-tenant mode | false |
| TRILIUM_URL_ALLOWLIST | No | Comma-separated allowed hostnames for client URLs | |
| TRILIUM_GATEWAY_TOKENS | No | Comma-separated list of accepted bearer tokens | |
| TRILIUM_MAX_POST_BYTES | No | Max size of a single MCP JSON-RPC POST body on the SSE transport | 500mb |
| TRILIUM_METRICS_TOKENS | No | Comma-separated tokens for metrics bearer auth | |
| TRILIUM_RATE_LIMIT_RPS | No | Rate limit requests per second | |
| TRILIUM_RATE_LIMIT_BURST | No | Rate limit burst size | |
| TRILIUM_ALLOW_PRIVATE_URLS | No | Skip private/loopback IP SSRF block | false |
| TRILIUM_JWT_PRINCIPAL_CLAIM | No | JWT claim to use as principal (default: sub) |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server manages a TriliumNext notes tree.
Searching
search_notes defaults to strategy "auto": a plain-word query first matches titles and labels (fast) and searches note bodies only when that finds too few notes. A body search can take a long time on a large Trilium and blocks it meanwhile, so use strategy "full" only when the words may appear only inside note text. If a call fails with TRILIUM_BUSY, wait the suggested time instead of retrying at once.
Working with notes
Get note, branch and attribute IDs from search_notes, get_note_tree or get_note; never guess them.
Explore with search_notes and get_note_tree before creating or moving notes, and confirm the parent with the user when unsure.
Read content through these tools (get_note, get_attachment, get_revisions), not raw ETAPI/HTTP calls.
write_note edits (changes/patch) match the stored HTML, not rendered text: read with get_note format="html" first and copy exact substrings.
manage_system export returns a ZIP for the user to save; you cannot read its contents. Use get_note to read notes.
Before rewriting a note wholesale, call create_revision (restore_revision also snapshots automatically) so the change can be undone.
When a tool returns a
url, give it to the user so they can open the note directly.
Note types that need extra setup
Choose type (and mime) on create_note. These types do nothing until you also add attributes with set_attribute (name without the leading # or ~):
code: set
mime, e.g. "text/x-python". For scripts use "application/javascript;env=frontend" (runs in the UI) or "application/javascript;env=backend" (runs on the server). A script runs only when triggered: add labelrun= "frontendStartup", "backendStartup", "hourly", "daily", …; a backend script can serve HTTP via labelcustomRequestHandler.render:
mimeempty. Create a frontend code note that builds the HTML, then add relation renderNote → that code note on the render note.Custom widget: a frontend code note that returns a widget, plus label
widgetwith value "".canvas and mindMap:
mime= "application/json". mermaid:contentis the diagram source. geoMap: coordinates live in child-note labels.
Linking notes
Link to another note with text (markdown: text) in create_note/write_note content; the server builds the Trilium reference link. Use get_note include_path=true to tell the user where a note lives, and include_backlinks=true to find what links to it.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| search_notesA | Find notes by full-text and/or attribute filters (Trilium search syntax). Returns metadata only (noteId, title, type, mime, dateModified, parentNoteIds, attributes); read bodies with get_note, or set content_preview_chars for short previews. Syntax:
Scope a subtree with ancestorNoteId + ancestorDepth. If a plain multi-word query finds nothing, it is retried as a ranked OR (see fuzzy); the response then has searchMode:"fuzzy" and termsMatchedInTitleOrAttributes. partial:true means part of the search did not finish; read the note field. |
| get_note_treeA | Explore the note hierarchy from a note, expanding children "depth" levels (default 1). Each node has noteId, title, type, childCount and childBranchIds; expanded children also carry their own branchId (what organize_note reorder/unlink need). Nodes at the depth boundary list childNoteIds for a follow-up call. System notes (IDs starting with "_") are skipped unless you start from one. At most 200 notes per call; the response is marked truncated when the cap is hit. |
| get_noteA | Read a note. Returns a metadata JSON block (title, type, attributes, parent/child IDs, and contentInfo with the total size and returned character range), then the body (stored HTML by default), then any images embedded in the body. Bodies over 50000 characters are paged via content_start/content_max_chars. Pass include_content=false for metadata only, include_path=true for breadcrumbs of where the note lives, include_backlinks=true for notes linking to it (a slow scan of all note bodies). |
| get_note_historyA | Get recent changes across the note tree — creations, modifications, and deletions. Optionally filter by subtree via ancestorNoteId. Returns {changes, total, returned, truncated}; pass limit (default 100) to see more. Distinct from revisions: this is a change log across notes; revisions are content snapshots of a single note. |
| create_noteA | Create a note under an existing parent and return the note, its branch and a url. Pick the parent with search_notes/get_note_tree; use "root" only for genuinely top-level notes. Text content is HTML or markdown (format="markdown"). Images/files can be uploaded and embedded in the same call (see the images/files fields). Give the user the returned url. |
| write_noteA | Change an existing note. mode="metadata" updates title/type/mime/dates; "replace" overwrites the content; "append" adds to the end; "edit" applies search/replace "changes" (preferred) or a unified diff "patch" to the stored HTML — read it with get_note format="html" first. replace/append can also upload and embed images/files. Give the user the returned url. |
| delete_noteA | Delete (soft) or restore a note. Deleting removes the note and every child that has no other parent; clones elsewhere survive. Restore with action="undelete". |
| get_revisionsA | Read note revisions (content snapshots of one note). Pass noteId to list its revisions (metadata: revisionId, title, type, dates, content length), or revisionId to read one revision's body (file/image revisions return metadata only). For a change log across many notes use get_note_history instead. |
| restore_revisionA | Restore a note to one of its revisions: writes the revision's content (and, by default, title) back onto the live note. By default the current state is snapshotted first with create_revision, so the restore is reversible. Find revision IDs with get_revisions {noteId}; preview one with get_revisions {revisionId}. Protected notes cannot be restored through ETAPI. |
| get_attributesA | Read attributes. Pass noteId for the note's own labels and relations (inherited attributes are not included), or attributeId for one attribute. Exactly one is required. |
| set_attributeA | Add or update a label or relation on a note. Upsert (default) edits the first own attribute with the same type+name in place when only a label's value or the position changes. Trilium cannot edit a relation's target or isInheritable in place, so those changes delete and recreate the attribute; the response then has replaced:true, oldAttributeId and the new attributeId. |
| delete_attributeB | Remove an attribute from a note by its attribute ID. |
| get_attachmentA | Read one attachment (attachmentId) or list a note's attachments (noteId, metadata only). Bodies come back by type: images as image blocks, text as a string (long text is truncated), other binaries as a base64 embedded resource. Images and binaries over 5 MB return metadata only. |
| create_attachmentA | Attach content to a note and return the attachment metadata. mime and title are auto-detected from the source (a path or URL basename becomes the title); inline base64/text needs a title. Example: {ownerId, role: "image", title: "dot.png", content: "data:image/png;base64,iVBORw0..."}. |
| write_attachmentA | Update an attachment: mode="metadata" changes role/mime/title/position; "replace" overwrites the body (path, URL, data URL, base64 or text; the stored mime is kept); "edit" applies "changes" or a "patch" to a text attachment (binary attachments must use "replace"). |
| delete_attachmentB | Permanently delete an attachment and its content. |
| get_special_noteA | Get (creating if missing) a day/week/month/year journal note, the inbox note, or the first day of a week. Returns the note metadata; read its body with get_note. |
| organize_noteA | Reorganize the note tree. Actions:
|
| create_revisionA | Snapshot a note's current content as a revision so later edits can be undone. List and read revisions with get_revisions; roll back with restore_revision. |
| manage_systemA | Trilium system operations, selected by "action":
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 20 tools
Each tool has a clearly stated resource+action, and the descriptions explicitly disambiguate the riskiest pairs (get_note_history vs get_revisions, create_note vs write_note, delete_note vs delete_attribute). The only blur comes from multi-action tools (manage_system's five actions, organize_note's move/clone/reorder/unlink) and the dual read/list role of get_attachment, which an agent must resolve via parameters rather than tool choice.
Nearly all names follow a clean snake_case verb_noun pattern (search_notes, get_note_tree, create_attachment, delete_attribute). The minor deviation is the mix of create_/write_/set_ for mutation operations plus the vague verb in manage_system, but these distinctions are semantically meaningful and documented rather than arbitrary.
At 20 tools it sits at the heavy end, but the domain genuinely spans notes, tree branches, attributes, attachments, revisions, journal/inbox notes, and system operations, so each tool maps to a real capability. It would be slightly cleaner if some read-mode tools were split or consolidated, but nothing is obviously redundant.
Full lifecycle coverage across every entity: notes (search/read/create/write/soft-delete/restore), tree organization (move/clone/reorder/unlink), attributes CRUD, attachments CRUD, revisions (create/list/read/restore), a cross-note change log, special notes, and system export/import/backup/metrics. Remaining gaps (no hard delete, no revision deletion, ZIP contents unreadable) reflect underlying Trilium API limits and are explicitly documented so agents don't dead-end.