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

markdown-lsp

v0.2.2

Published

Language Server Protocol implementation for Markdown with optional AI-canonicalized glossary that resolves synonyms across docs

Readme

markdown-lsp

npm version npm downloads CI license node

Language Server Protocol implementation for Markdown documentation. Optional AI-powered semantic layer on top.

Status: M1 complete, M2 (AI layer) opt-in.

Two layers

Structural (default, no AI)

Out of the box — like Marksman, but persisted in Postgres and addressable from a service.

  • textDocument/documentSymbol — heading outline
  • workspace/symbol — fuzzy subsequence search across all headings (e.g. oaf matches OAuth flow)
  • textDocument/definition — jump from a link to its target document
  • textDocument/references — find every page linking to the current document
  • textDocument/completion — wiki-link completion [[...]]
  • textDocument/publishDiagnostics — warnings for unresolved link targets
  • workspace.executeCommand("markdownLsp/reindex") — force re-index of the workspace
  • Incremental indexing via content-hash diff; watched-files cleanup

This layer is fully deterministic, free, and runs offline against your Postgres.

Semantic (optional, AI-powered)

Off by default. When enabled, an extract pass identifies canonical concepts per section so that references survive synonym variation (authauthenticationOAuthlogin).

Enable with:

export MARKDOWN_LSP_AI_ENABLED=1
export AI_GATEWAY_API_KEY=...   # Vercel AI Gateway

If the flag is not set, no AI calls are ever made. The server starts and behaves as a pure-structural LSP — no key required.

Architecture

  • LSP over stdio (vscode-languageserver/node) — works in any editor
  • pgvector (Neon serverless) for cosine search on canonical-term embeddings (only when AI layer is enabled)
  • Drizzle ORM; all tables prefixed mdlsp_
  • Vercel AI Gateway (text-embedding-3-small for embeddings, gpt-4o-mini for extraction) — when AI on
  • An optional MCP HTTP facade (M3) over the same handlers — for AI agents like Claude Code

Setup

pnpm install
cp .env.example .env.local        # fill DATABASE_URL; AI_GATEWAY_API_KEY only if you want the AI layer
pnpm migrate                       # runs scripts/apply-migration.ts against DATABASE_URL
pnpm build

Run

LSP via stdio (for editor integration):

node dist/server.js --stdio

bin/markdown-lsp wraps the same entry point as a CLI.

Use from Docsbook

The structural layer is what Docsbook's "Source of Truth" feature wants. Wire it in like this:

import { ensureWorkspace, indexWorkspace } from "@docsbook/markdown-lsp/indexer"
import { getDocumentSymbols, getWorkspaceSymbols } from "@docsbook/markdown-lsp/core"

// after cloning a workspace repo into ./tmp/<workspace-id>/
const ws = await ensureWorkspace("./tmp/42")
await indexWorkspace(ws)

// MCP tools then call:
await getWorkspaceSymbols(ws, "auth")
await findReferencesToDocument(ws, authDocId)

No AI required.

Tests

pnpm test

27 tests cover the parser, indexer, and core handlers (plus a small suite for the AI feature flag).

Milestones

  • M0 — Scaffold
  • M1 — Structural layer
  • M2 — Semantic extract (opt-in, code present, awaiting live AI Gateway credit)
  • M3 — MCP HTTP facade
  • M4 — User overrides for the glossary (merge / split / rename / add_synonym)
  • M5 — Docsbook integration

License

MIT