MCP TriliumNext
The MCP TriliumNext server enables AI assistants to manage TriliumNext notes through a standardized protocol with full CRUD operations:
• Create Notes: Create new notes with title, content, optional type (text, code, file, image, search, book, relationMap, canvas), and parent note ID
• Search Notes: Perform fulltext or structured searches using TriliumNext's powerful query syntax, including labels and date filters, with customizable result limits (1-100)
• Retrieve Notes: Fetch complete details and content of specific notes by ID
• Update Notes: Modify existing note content using note ID
• Access Recent Notes: Retrieve the 10 most recently modified notes as a resource
• Advanced Features: Structured data preservation for AI consumption, robust error handling, validation, and production-ready logging and monitoring
Provides tools for creating, searching, reading, and updating notes in TriliumNext, with support for different note types, fulltext searching with advanced query syntax, and access to recently modified notes.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP TriliumNext search for my meeting notes about the Q3 project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP TriliumNext
A Model Context Protocol (MCP) server for TriliumNext, providing AI assistants with seamless access to your note-taking workflow.
Overview
This MCP server enables AI assistants like Claude to interact with your TriliumNext notes through a standardized protocol. It provides tools for creating, searching, reading, and updating notes, as well as accessing recent notes as a resource.
Related MCP server: TriliumNext Notes' MCP Server
Features
🛠️ Tools
create_note - Create new notes with title, content, and type
search_notes - Search notes using fulltext or structured queries
get_note - Retrieve complete note details and content
update_note - Update existing note content
📚 Resources
trilium://recent-notes - Access to 10 most recently modified notes
✨ Key Capabilities
Full CRUD operations for notes
Advanced search with TriliumNext query syntax
Structured data preservation for AI consumption
Comprehensive error handling and validation
Production-ready logging and monitoring
Installation
Prerequisites
Node.js 18.0.0 or higher
TriliumNext server running and accessible
ETAPI token from your TriliumNext instance
Setup
Clone and install
git clone git@github.com:RadonX/mcp-trilium.git cd mcp-trilium npm installConfigure environment Create a
.envfile with your settings:TRILIUM_URL=http://localhost:8080 TRILIUM_AUTH_TOKEN=your_etapi_token_here REQUEST_TIMEOUT=30000 LOG_LEVEL=infoGet your ETAPI token
Open TriliumNext web interface
Go to Options → ETAPI
Create a new token or use existing one
Copy the token to your
.envfile
Test connectivity
npm run test-connectivity
Usage
With Claude Code
Add the MCP server directly using Claude Code:
claude mcp add trilium-mcp node /path/to/mcp-trilium/src/index.js --env TRILIUM_URL=http://localhost:8080 --env TRILIUM_AUTH_TOKEN=your_etapi_token_here --env REQUEST_TIMEOUT=30000 --env LOG_LEVEL=infoWith Claude Desktop
Add to your Claude Desktop configuration (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"trilium": {
"command": "node",
"args": ["/path/to/mcp-trilium/src/index.js"],
"env": {
"TRILIUM_URL": "http://localhost:8080",
"TRILIUM_AUTH_TOKEN": "your_token_here"
}
}
}
}With MCP Inspector
npx @modelcontextprotocol/inspector src/index.jsStandalone Usage
npm startExamples
Creating a Note
// Ask Claude: "Create a note about TypeScript basics"
{
"tool": "create_note",
"arguments": {
"title": "TypeScript Basics",
"content": "# TypeScript Fundamentals\n\nTypeScript is a typed superset of JavaScript...",
"type": "text",
"parentNoteId": "root"
}
}Searching Notes
// Ask Claude: "Find all notes about JavaScript"
{
"tool": "search_notes",
"arguments": {
"query": "javascript #programming",
"limit": 10
}
}Updating Content
// Ask Claude: "Update my JavaScript notes with new ES6 features"
{
"tool": "update_note",
"arguments": {
"noteId": "note123abc",
"content": "Updated content with ES6 features..."
}
}Search Query Syntax
TriliumNext supports powerful search queries:
Fulltext:
machine learning algorithmsExact match:
"neural networks"Labels:
#programming #javascriptCombined:
"react hooks" #programming type:codeDate filters:
dateCreated:>2024-01-01
Development
Running Tests
# Run all tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverageProject Structure
src/
├── index.js # Main MCP server
├── tools/ # MCP tool implementations
│ ├── create-note.js
│ ├── search-notes.js
│ ├── get-note.js
│ └── update-note.js
├── resources/ # MCP resource implementations
│ └── recent-notes.js
└── utils/ # Shared utilities
├── trilium-client.js
├── validation.js
└── logger.jsAPI Reference
TriliumNext ETAPI
This server uses TriliumNext's External API (ETAPI). Key endpoints:
GET /notes- Search notesPOST /create-note- Create noteGET /notes/{id}- Get note detailsPUT /notes/{id}/content- Update note content
See docs/trilium-etapi-specification.md for complete API documentation.
Configuration
Environment Variables
TRILIUM_URL- TriliumNext server URL (default:http://localhost:8080)TRILIUM_AUTH_TOKEN- ETAPI authentication token (required)REQUEST_TIMEOUT- API request timeout in ms (default:30000)LOG_LEVEL- Logging level:error,warn,info,debug(default:info)
Note Types
Supported note types:
text- Rich text notes (default)code- Code snippets with syntax highlightingfile- File attachmentsimage- Image notessearch- Saved searchesbook- Book/chapter organizationrelationMap- Visual relation mapscanvas- Freeform canvas notes
Troubleshooting
Common Issues
Authentication Failed
# Check your token
curl -H "Authorization: Bearer your_token" http://localhost:8080/etapi/app-infoConnection Refused
Verify TriliumNext is running
Check
TRILIUM_URLin.envEnsure ETAPI is enabled in TriliumNext settings
Content Stored as [Object]
Fixed in v0.1.0 - content now properly sent as text/plain
Update to latest version if experiencing this issue
Debug Mode
LOG_LEVEL=debug npm startContributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameMake your changes with tests
Run the test suite:
npm testSubmit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
TriliumNext - The note-taking application
Model Context Protocol - MCP specification
Claude Desktop - AI assistant with MCP support
Future Enhancements
The following features may be added in future versions:
🚀 Planned Features
Enhanced note types support - Full support for all TriliumNext note types (relationMap, canvas, etc.)
Advanced search features - Attribute-based queries, date range filters, and complex search operators
Performance optimizations - Caching, batch operations, and streaming for large note collections
Note relationship management - Tools for managing note relationships and hierarchies
Bulk operations - Create, update, or delete multiple notes in a single operation
Attachment handling - Support for file uploads and downloads
Real-time updates - WebSocket integration for live note synchronization
💡 Potential Integrations
Export capabilities - Export notes to various formats (Markdown, PDF, etc.)
Template system - Predefined note templates for common use cases
Backup and restore - Automated backup functionality through MCP
Analytics and insights - Note usage statistics and content analysis
Changelog
v0.1.0
Initial release with full CRUD operations
MCP resource for recent notes
Comprehensive test coverage (94 tests)
Production-ready error handling and validation
Made with ❤️ for the TriliumNext and MCP communities
Available Tools
4 toolscreate_noteC
Create a new note in TriliumNext
Inputs: title (required), content (required), type, parentNoteId.
get_noteC
Get details of a specific note
Inputs: noteId (required).
search_notesC
Search for notes in TriliumNext
Inputs: query (required), limit.
update_noteC
Update the content of an existing note
Inputs: noteId (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose targeting specific CRUD operations for notes: create_note for creation, get_note for retrieval, search_notes for searching, and update_note for updates. There is no overlap in functionality, making tool selection straightforward.
All tool names follow a consistent verb_noun pattern with snake_case, using clear action verbs (create, get, search, update) paired with the noun 'note' or 'notes'. This uniformity enhances readability and predictability.
With 4 tools, the server is well-scoped for managing notes in TriliumNext, covering essential operations without being overly simplistic or bloated. Each tool serves a distinct and necessary function in the note lifecycle.
The tool set provides strong coverage for core note operations, including create, read, search, and update. A minor gap exists with no delete_note tool, which could limit full lifecycle management, but agents can still handle most workflows effectively.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
Related MCP Servers
- AlicenseBqualityFmaintenanceA Model Context Protocol server that enables AI assistants to read, write, and manipulate notes in your Obsidian vault through a standardized interface.54ISC
- FlicenseAqualityCmaintenanceA model context protocol server that allows interaction with TriliumNext Notes, providing tools to create, search, retrieve, update, and delete notes through natural language commands.969-
- AlicenseAqualityBmaintenanceA Model Context Protocol (MCP) server for interacting with TriliumNext via its ETAPI. Enables LLMs to create, read, update, and organize notes, including embedding images and files directly into note content.2071MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI clients to manage Trilium Notes with full CRUD operations, search, calendar integration, and system administration through the Model Context Protocol.2MIT