npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

trilium-mcp

v1.0.2

Published

MCP server for Trilium Notes with comprehensive ETAPI support

Readme

Trilium MCP Server

MCP (Model Context Protocol) 服务,用于操作 Trilium 笔记内容,涵盖 Trilium ETAPI 的绝大部分功能。

功能特性

  • 完整的笔记管理:创建、读取、更新、删除笔记
  • 高级搜索:支持 Trilium 搜索语法
  • 属性管理:标签和关系的管理
  • 日历集成:日/周/月/年笔记
  • 笔记导出:支持 HTML、Markdown、OPML 格式
  • 备份功能:创建数据库备份
  • 权限控制:可配置读写权限

提供的工具(29个)

笔记操作

| 工具名称 | 描述 | |---------|------| | get_note | 获取笔记详情 | | get_note_content | 获取笔记内容 | | create_note | 创建笔记 | | update_note | 更新笔记元数据 | | update_note_content | 更新笔记内容 | | delete_note | 删除笔记 | | move_note | 移动笔记 | | clone_note | 克隆笔记 |

搜索功能

| 工具名称 | 描述 | |---------|------| | search_notes | 搜索笔记 | | resolve_note_id | 通过标题查找笔记ID |

属性管理

| 工具名称 | 描述 | |---------|------| | get_attributes | 获取笔记属性 | | create_attribute | 创建属性 | | update_attribute | 更新属性 | | delete_attribute | 删除属性 |

日历功能

| 工具名称 | 描述 | |---------|------| | get_day_note | 获取/创建日笔记 | | get_week_note | 获取/创建周笔记 | | get_month_note | 获取/创建月笔记 | | get_year_note | 获取/创建年笔记 | | get_inbox_note | 获取收件箱笔记 |

其他功能

| 工具名称 | 描述 | |---------|------| | get_root_note | 获取根笔记 | | get_note_path | 获取笔记路径 | | get_branches | 获取分支信息 | | get_note_revisions | 获取笔记历史版本 | | export_note | 导出笔记 | | get_app_info | 获取应用信息 | | backup | 创建备份 |


安装与使用

方式一:本地运行

1. 安装依赖

cd trilium_tools
npm install

2. 构建项目

npm run build

3. 配置环境变量

创建 .env 文件:

TRILIUM_API_URL=https://your-trilium-server/etapi
TRILIUM_API_TOKEN=your_api_token_here
PERMISSIONS=READ;WRITE
VERBOSE=false

4. 运行服务

npm start

方式二:Docker 部署

1. 构建 Docker 镜像

docker build -t trilium-mcp:latest .

2. 使用 docker-compose(推荐)

创建 .env 文件后运行:

docker-compose up -d

3. 直接使用 docker run

docker run -d \
  --name trilium-mcp \
  -p 3000:3000 \
  -e TRILIUM_API_URL=https://your-trilium-server/etapi \
  -e TRILIUM_API_TOKEN=your_api_token_here \
  -e PERMISSIONS=READ;WRITE \
  trilium-mcp:latest

MCP 客户端配置

方式一:使用 node 命令

{
  "mcpServers": {
    "trilium-mcp": {
      "command": "node",
      "args": ["/path/to/trilium_tools/dist/index.js"],
      "env": {
        "TRILIUM_API_URL": "https://your-trilium-server/etapi",
        "TRILIUM_API_TOKEN": "your_api_token_here",
        "PERMISSIONS": "READ;WRITE"
      }
    }
  }
}

方式二:使用 npx(发布到 npm 后)

{
  "mcpServers": {
    "trilium-mcp": {
      "command": "npx",
      "args": ["-y", "trilium-mcp"],
      "env": {
        "TRILIUM_API_URL": "https://your-trilium-server/etapi",
        "TRILIUM_API_TOKEN": "your_api_token_here",
        "PERMISSIONS": "READ;WRITE"
      }
    }
  }
}

方式三:使用 npm link

# 在项目目录下执行
npm link

然后配置:

{
  "mcpServers": {
    "trilium-mcp": {
      "command": "trilium-mcp",
      "env": {
        "TRILIUM_API_URL": "https://your-trilium-server/etapi",
        "TRILIUM_API_TOKEN": "your_api_token_here",
        "PERMISSIONS": "READ;WRITE"
      }
    }
  }
}

环境变量说明

| 变量 | 说明 | 必填 | |------|------|------| | TRILIUM_API_URL | Trilium ETAPI 地址 | 是 | | TRILIUM_API_TOKEN | API 认证令牌 | 是 | | PERMISSIONS | 权限(READ;WRITE) | 否,默认 READ;WRITE | | VERBOSE | 详细日志 | 否,默认 false |


获取 API Token

  1. 登录 Trilium Notes
  2. 进入 选项ETAPI
  3. 创建新的 API Token 或复制现有 Token

项目结构

trilium_tools/
├── src/
│   ├── index.ts           # stdio 模式入口
│   ├── http-server.ts     # HTTP 模式入口
│   ├── trilium-client.ts  # Trilium ETAPI 客户端
│   ├── tools.ts           # MCP 工具定义
│   ├── types.ts           # TypeScript 类型定义
│   └── config.ts          # 配置管理
├── dist/                  # 编译输出
├── Dockerfile
├── docker-compose.yml
├── package.json
└── tsconfig.json

许可证

MIT