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

@markdownai/mcp

v1.4.0

Published

MCP server for MarkdownAI - bridges AI assistants and live documents through phase-aware content tools

Readme

@markdownai/mcp

Model Context Protocol server for MarkdownAI. JSON-RPC over stdio. 11 tools that let an MCP client (Claude Code, etc.) read, render, and walk MarkdownAI documents.

Root README · Engine · GitHub

Install

npm install -g @markdownai/core    # installs both the CLI and mai-serve

Then point your MCP client at mai-serve. With Claude Code, run mai init to write the config, or add it manually:

{
  "mcpServers": {
    "markdownai": { "command": "mai-serve", "args": [] }
  }
}

The 11 tools

| Tool | What it does | |---|---| | read_file | Render a document, optionally scoped to one phase. Returns ai-format by default. | | render | Alias of read_file with the parameter renamed path -> file (consistent with the other tools). | | list_phases | Inventory of @phase blocks. | | resolve_phase | Render one phase. Returns { content, nextPhase } - nextPhase reflects the @on-complete that fired (honors @if / @switch). | | next_phase | Get the next phase after a given one. Renders the phase with skill context so conditional transitions resolve correctly. | | call_macro | Invoke a @define-d macro by name with args. | | execute_directive | Run a single directive. Allowlist: @env, @date, @count, @list, @read, @read-frontmatter, @hash, @if, @markdownai-detect, @plugin-data. | | get_constraints | Extract @constraint declarations from a document. | | get_env | Read an env var through the security gate (credential-pattern keys are blocked). | | invalidate_cache | Drop cached directive output. | | available_directives | Catalog every registered directive. As of 1.3.0 this includes @template and @data (for reusable partials with bound data). They are deliberately NOT on the execute_directive allowlist - both can transitively invoke other directives, so they remain available only through the full document-rendering tools (read_file, render, resolve_phase, next_phase). |

Session state (v2)

The server keys per-(session × document) state by skill_session_id. @set values written in one phase persist into later resolve_phase calls on the same document. Required for multi-phase flows (mdd2 build, audit, etc.) where phase 5 needs values bound back in phase 1.

Thread skill_args + skill_session_id on every resolve_phase / next_phase call in a multi-phase flow. Also useful: skill_named_args, skill_effort, skill_dir. They bind to $ARGUMENTS, argsList, arg0..argN, CLAUDE_EFFORT, and CLAUDE_SKILL_DIR inside the document.

Multi-phase walk

1. list_phases  { file: "flow.md" }
   -> ["setup", "build", "verify"]

2. resolve_phase  { file: "flow.md", phase: "setup",
                   skill_args: "auth", skill_session_id: "<uuid>" }
   -> { content: "...", nextPhase: "build" }

3. next_phase    { file: "flow.md", current_phase: "build",
                   skill_session_id: "<uuid>" }
   -> "verify"

4. resolve_phase { file: "flow.md", phase: "verify",
                   skill_session_id: "<uuid>" }   # @set values from setup still bound
   -> { content: "...", nextPhase: null }

Companion hooks

mai init installs two Claude Code hooks:

  • PreToolUse - intercepts Read on any MarkdownAI document and redirects the AI back to the MCP tool catalog. Raw directive source never reaches the model.
  • SessionStart - if CLAUDE-MarkdownAI.md exists at the project root, the hook renders it on every session start and injects the output into session context with the same authority as CLAUDE.md. Your CLAUDE.md is not modified.

Public surface

The MCP server is the product. Library entry points exist if you're embedding it:

import { startServer } from '@markdownai/mcp'
import type { ServerOptions } from '@markdownai/mcp'

startServer({ cwd: process.cwd(), passthrough: false })

License

MIT.