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-llm-wiki-mcp

v0.2.1

Published

MCP server + LLM-wiki skill for Trilium/TriliumNext Notes (Karpathy LLM-wiki methodology).

Readme

trilium-llm-wiki-mcp

npm version npm downloads license: MIT

An MCP server + LLM-wiki skill that turns Trilium / TriliumNext Notes into the single backend for a personal LLM-wiki (the Karpathy methodology): ingest sources, query accumulated knowledge, lint for drift — with Trilium as the typed-graph store and search engine.

MCP = the hands (52 tools). The skill = the brain (when/how to use them). Trilium = the backend (notes = pages, relations = typed graph, labels = queryable metadata, built-in search = the "map").

Clean-room, MIT, ESM TypeScript. 52 MCP tools, a companion CLI, a SKILL, and SessionStart/Stop hooks — all tested against a live Docker Trilium.


Quickstart

You need Docker (or an existing Trilium) and Node ≥ 18.

# 1) Run a local TriliumNext (one-time first-run init in the browser)
docker compose up -d
open http://localhost:8080            # choose "new user", set a password

# 2) Put connection details in .env
cp .env.example .env
# edit .env: TRILIUM_URL=http://localhost:8080, TRILIUM_PASSWORD=<your password>

# 3) Get an ETAPI token into .env
node scripts/get-etapi-token.mjs --write   # reads TRILIUM_PASSWORD, writes TRILIUM_TOKEN

# 4) Register the MCP server in Claude Code + merge the wiki hooks
npx -y -p trilium-llm-wiki-mcp trilium-wiki install

# 5) Seed the LLM Wiki vault in Trilium
npx -y -p trilium-llm-wiki-mcp trilium-wiki init

# 6) Verify
npx -y -p trilium-llm-wiki-mcp trilium-wiki doctor

That's it — start a Claude Code session, ask it to "add this to my wiki", and the trilium-wiki skill takes over.


Two binaries

| Bin | Role | |---|---| | trilium-llm-wiki-mcp / trilium-mcp | stdio MCP server — the agent's hands (52 tools: notes, attributes/relations, graph relevance find_related, retrieval pipeline query_wiki, attachments, export/import, calendar, system, …). | | trilium-wiki | companion CLI — automation outside MCP (hooks fire when MCP isn't connected): init, brief, checkpoint, doctor, install. |

npx note: the package ships multiple bins, so be explicit — MCP server: npx -y trilium-llm-wiki-mcp (default bin); CLI: npx -y -p trilium-llm-wiki-mcp trilium-wiki <cmd> (the -p selects the CLI bin). Or install globally: npm i -g trilium-llm-wiki-mcptrilium-mcp / trilium-wiki on PATH.

Register the MCP server

User scope (works everywhere):

claude mcp add --scope user trilium \
  --env TRILIUM_URL=http://localhost:8080 \
  --env TRILIUM_TOKEN=<etapi-token> \
  -- npx -y trilium-llm-wiki-mcp

Or project scope — a ready .mcp.json is included (env-driven, no absolute paths). Local dev without npx: -- node dist/index.js.

Hooks (SessionStart / Stop)

trilium-wiki install non-destructively merges two hooks into ~/.claude/settings.json:

  • SessionStarttrilium-wiki brief — injects a wiki brief (Index excerpt, recent Log, weak/orphan/query counts) as session context.
  • Stoptrilium-wiki checkpoint — appends a ## [date] session | end marker to the Log.

Idempotent (re-running won't duplicate entries) and preserves any unrelated hooks. Verify: trilium-wiki brief / trilium-wiki doctor.

Multi-PC (one wiki, many machines)

Two supported topologies (spec §6.1):

  1. Local Trilium + sync (recommended, offline-capable). Each PC runs its own docker compose up -d and points TRILIUM_URL at localhost. Designate one always-on machine as the sync server (Trilium UI → Sync → Server hostname); the others sync to it. Every PC works locally and replicates.
  2. Central server. One shared Trilium on a home server/VPS/tunnel; every PC sets TRILIUM_URL to it (no local instance). Simpler, but needs online.

docker-compose.yml, .mcp.json, the skill, and the hook commands use only npx/~ and env vars — no PC-specific paths — so the same setup applies on every machine. Dotfiles-friendly: keep ~/.trilium-wiki.env, the skill, and the hooks block in your config repo and run trilium-wiki install on each PC.


Architecture

                   ┌───────────────────────────┐
   Claude Code ───▶│ trilium-mcp (MCP/stdio)   │──┐  ETAPI
   (the agent)     │ 52 tools over EtapiClient │  │  HTTP
                   └───────────────────────────┘  ▼
   SessionStart ──▶┌───────────────────────────┐  ┌──────────────┐
   Stop ──────────▶│ trilium-wiki (CLI)        │─▶│ TriliumNext  │
                   │ init/brief/checkpoint/... │  │ (Docker 8080)│
                   └───────────────────────────┘  └──────────────┘
   skill: SKILL.md ─ ingest/query/lint/delete procedures (the "brain")
  • src/etapi/client.ts — the single ETAPI client (engine + direct + composite methods). Used by both trilium-mcp and trilium-wiki.
  • src/tools/*.ts — 52 thin MCP tools (handler + register…).
  • src/graph/ — relevance model (find_related, 4-signal) + retrieval pipeline (query_wiki), over graphology.
  • src/cli/ — the trilium-wiki companion CLI.
  • skill/SKILL.md — the wiki methodology (frontmatter + ingest/query/lint/delete).

Development

npm install
npm run build
npm test                  # unit (mocked ETAPI)
npm run test:integration  # vs live Trilium (needs TRILIUM_URL/TRILIUM_TOKEN)
npm run lint

163 tests (127 unit + 36 integration) cover every tool, the graph core, the CLI, and a full ingest→query→lint→delete methodology cycle.

Tool reference (52)

Notes (read/search/write/tree/subtree/path/append/move) · attributes (get/set/ add/delete/upsert + extras) · branches/clone · attachments (7) · export/import · revisions (snapshot) · calendar (day/week/month/year/inbox) · system (login/ logout/backup/metrics) · composite (upsert_note, get_backlinks, find_orphans, search_by_attribute, replace_note_section, bulk_set_attributes) · graph (find_related, query_wiki).

Limitations (ETAPI)

TriliumNext's ETAPI exposes no: revision listing/reading, note undelete, recent- changes history, or protected-note content. The corresponding tools are omitted (documented as non-goals); protected notes surface a clear NOTE_IS_PROTECTED.

License & attribution

MIT © DragonQi. Clean-room implementation of the public LLM-wiki methodology by Andrej Karpathy (no source from the gist is included). ETAPI access targets Trilium/TriliumNext Notes; this project is independent and not affiliated. See NOTICE.