Trilium MCP Server

Trilium MCP Server

Enables AI clients to manage Trilium Notes with full CRUD operations, search, calendar integration, and system administration through the Model Context Protocol.

Category
Visit Server

README

Trilium MCP Server

A comprehensive Model Context Protocol (MCP) server for Trilium Notes integration, providing complete note management functionality through MCP-compatible AI clients.

šŸš€ Production Ready • šŸ”§ 15 API Endpoints • šŸ“Š 208 Tests • šŸ„ Health Monitoring • šŸ“š Interactive API Docs

Live Server: https://your-trilium-server.example.com/mcp

Features

  • Complete Note Management: Create, read, update, delete, and search notes
  • Rich Content Support: HTML content with formatting and attachments
  • Calendar Integration: Day, week, and month notes with automatic organization
  • Advanced Search: Full-text search with filtering and structured results
  • File Attachments: Base64-encoded file attachment support
  • System Operations: Backup creation, export functionality, and system info
  • Interactive API Documentation: Beautiful HTML docs with examples and OpenAPI JSON export
  • Verbose Logging: Comprehensive request tracking and health monitoring
  • Production Deployment: HTTPS endpoint with authentication and error handling

API Documentation

For complete API documentation, see API Reference.

Interactive Documentation: Visit /docs for complete API documentation with:

  • All 15 endpoints organized by category
  • Request/response examples
  • Parameter descriptions with types and constraints
  • Known issues and workarounds
  • OpenAPI 3.0 JSON export at /docs/json
  • MCP Manifest at /mcp.json (JSON-RPC tools/list format)

Quick Start

For AI Clients (Recommended)

  1. Copy configuration from mcp-server-config.json:
{
  "mcpServers": {
    "trilium": {
      "command": "curl",
      "args": [
        "-X",
        "POST",
        "https://your-trilium-server.example.com/mcp",
        "-H",
        "Content-Type: application/json",
        "-H",
        "Accept: application/json, text/event-stream",
        "--data-binary",
        "@-"
      ]
    }
  }
}
  1. Import into your AI client:

    • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
    • Other MCP clients: Use the universal configuration
  2. Start using - All 15 tools will be available immediately!

Direct HTTP Testing

# Test note creation
curl -X POST https://your-trilium-server.example.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "create_note",
      "arguments": {
        "parentId": "root",
        "title": "API Test Note",
        "content": "<h1>Hello from MCP!</h1><p>This note was created via the API.</p>"
      }
    }
  }'

# Test search functionality
curl -X POST https://your-trilium-server.example.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "search_notes",
      "arguments": {
        "query": "API Test",
        "limit": 5,
        "format": "structured"
      }
    }
  }'

# Get system information
curl -X POST https://your-trilium-server.example.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "get_app_info",
      "arguments": {}
    }
  }'

Local Development

Prerequisites

  • Node.js 18+
  • pnpm package manager
  • Trilium Notes instance with ETAPI enabled

Setup

  1. Clone and install:
git clone <repository-url>
cd trilium-mcp
pnpm install
  1. Configure environment:
cp .env.example .env
# Edit .env with your Trilium URL and token
  1. Start development server:
pnpm dev  # Auto-reload enabled
# or
pnpm start  # Production mode
  1. Health check:
curl http://localhost:3000/health

Environment Variables

Variable Description Required Default
TRILIUM_URL Trilium ETAPI URL (include /etapi path) āœ… -
TRILIUM_TOKEN ETAPI authentication token āœ… -
PORT HTTP server port āŒ 3000
NODE_ENV Environment mode āŒ development

Production Features

Comprehensive Logging

  • Request tracking: Unique IDs for every MCP request with timing
  • ETAPI monitoring: All Trilium API calls logged with request/response details
  • Health monitoring: System stats every 30 seconds (memory, connections, uptime)
  • Error handling: Full stack traces and detailed error messages
  • Connection tracking: Active/total connection counts with lifecycle logging

Health Monitoring

# View server health
curl https://my-own-trilium-mcp.fly.dev/health

# View API documentation
curl https://my-own-trilium-mcp.fly.dev/docs

# Get OpenAPI JSON spec
curl https://my-own-trilium-mcp.fly.dev/docs/json

# Get MCP Manifest (tools/list format)
curl https://my-own-trilium-mcp.fly.dev/mcp.json

# Monitor deployment logs
fly logs -a your-app-name

Security

  • HTTPS deployment with proper TLS
  • ETAPI authentication with Basic Auth
  • CORS enabled for cross-origin requests
  • Request validation with MCP protocol compliance
  • Error sanitization without sensitive data leakage

Performance Metrics

Based on comprehensive testing:

  • Response Times: 100-300ms average for most operations
  • Memory Usage: ~99MB RSS, stable memory footprint
  • Connection Handling: Proper cleanup and resource management
  • Uptime: Production-stable with comprehensive error handling
  • Success Rate: 13/15 endpoints (87%) fully working

Testing Results

The server has been comprehensively tested with real-world scenarios:

āœ… Created nested folder structure with rich HTML content āœ… All CRUD operations tested with actual data āœ… Calendar integration verified with daily/monthly notes āœ… File attachments tested with base64 encoding āœ… Search functionality confirmed with structured results āœ… System operations validated including backups and info retrieval

See Final Test Results for complete testing documentation.

Additional Resources

License

MIT License - see LICENSE file for details.


Ready to use! šŸŽ‰ Import the configuration files into your favorite MCP-compatible AI client and start managing your Trilium notes with AI assistance.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured