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

mdchat

v1.0.11

Published

Collaborate with LLMs directly in your terminal. Ask, edit, summarize, and generate content inline in Markdown.

Downloads

102

Readme

Markdown Chat (mdchat) ✨

Collaborate with LLMs directly in your terminal.
Ask, edit, summarize, and generate content inline in Markdown.


🚀 Features

  • 📝 Ask questions and insert AI answers directly into .md files.
  • ✍️ Edit sections with AI-powered rewrites (simplify, clarify, shorten, etc.).
  • 📚 Summarize long notes or papers into concise takeaways.
  • 📄 Generate blog posts and documentation in Markdown.
  • 💬 Interactive chat mode with an LLM inside your terminal.

All AI-generated content is wrapped in <!-- AI: ... --> blocks, so you always know what’s machine-written.


📦 Installation

# install globally
npm install -g mdchat

# or run once via npx
npx mdchat --help

Requirements: Node.js 20+


⚡ Quick Start

# 1) 30‑second interactive setup
mdchat config setup

# 2) Ask your first question
mdchat ask "What is machine learning?"

🎯 Commands

Ask Question

# Ask a question (streaming by default for better UX)
mdchat ask "What is the capital of France?"

# Disable streaming if you prefer to see the complete response at once
mdchat ask "Explain quantum computing" --no-stream

# Save the answer to a file
mdchat ask "How does photosynthesis work?" -o biology.md

Insert Context-Aware Content

# Insert AI-generated content into marked blocks based on surrounding context
mdchat insert document.md

# Preview what will be generated without making changes
mdchat insert document.md --preview

# Save to a different file instead of modifying the original
mdchat insert document.md -o enhanced-document.md

To use the insert command, add HTML comment markers in your markdown file:

# My Document

Existing paragraph about topic A.

<!-- AI insert here -->
<!-- AI insert end -->

Existing paragraph about topic B.

The AI will analyze the surrounding context and generate connecting content that flows naturally between the paragraphs.

Summarize Content

# Summarize a single file
mdchat summarize document.md

# Summarize multiple files with glob patterns
mdchat summarize "docs/*.md"

# Summarize an entire directory
mdchat summarize ./research/

# Save summary to a file
mdchat summarize notes.md -o summary.md

Edit Content

# Simplify a section
mdchat edit document.md --section "Complex Topic" --action simplify

# Expand on a topic
mdchat edit article.md --section "Introduction" --action expand

# Clarify technical content
mdchat edit guide.md --section "Setup" --action clarify

Configuration

# Interactive setup (recommended for first-time users)
mdchat config setup

# Manual configuration
mdchat config set provider openai
mdchat config set model gpt-4o
mdchat config set apiKey your-api-key

# View current configuration
mdchat config list

Sections (list headings in a file)

# Show all headings with line numbers
mdchat sections README.md

⚙️ Global Options

  • --provider <provider>: AI provider (openai, anthropic, ollama)
  • --model <model>: Model to use (gpt-4o, claude-3-5-sonnet-20241022, llama3.2, etc.)
  • --api-key <key>: API key for the provider
  • --base-url <url>: Custom API base URL (for ollama or custom endpoints)

🎨 Examples

Ask a question (streaming by default):

mdchat ask "Write a comprehensive guide to Node.js best practices"

Summarize multiple research papers:

mdchat summarize "research/papers/*.md" -o research-summary.md

Edit and improve a blog post:

mdchat edit blog-post.md --section "Conclusion" --action expand

🔧 Environment Setup

Set your API key as an environment variable:

export OPENAI_API_KEY="your-api-key-here"
# or  
export ANTHROPIC_API_KEY="your-anthropic-key"

Or configure it via the CLI:

mdchat config --api-key your-api-key

📝 Output Format

All AI responses are wrapped in HTML comments for easy identification:

Your AI-generated content appears here.

This makes it clear what content was generated by AI vs. human-written.


🔌 Providers & Models

  • OpenAI: default provider. Common model: gpt-4o.
    • Env: set OPENAI_API_KEY or run mdchat config setup and paste your key.
  • Anthropic (Claude): set --provider anthropic --model claude-3-5-sonnet-20241022.
    • Env: set ANTHROPIC_API_KEY.
  • Ollama (local): run ollama serve, install a model (e.g., ollama pull llama3.2).
    • Use --provider ollama --model llama3.2 and optionally --base-url http://localhost:11434.

You can also persist these choices using:

mdchat config set provider openai
mdchat config set model gpt-4o
mdchat config set apiKey YOUR_KEY

🖥️ OS-specific env examples

  • macOS/Linux (bash/zsh):
export OPENAI_API_KEY="sk-..."
  • Windows PowerShell:
$env:OPENAI_API_KEY = "sk-..."
  • Windows CMD:
set OPENAI_API_KEY=sk-...

❓ Troubleshooting / FAQ

  • "No provider/model configured"

    • Run mdchat config setup or pass --provider/--model on the command.
  • "401/Forbidden or invalid API key"

    • Verify your key is set (mdchat config list) or env var is exported in the current shell.
  • Ollama errors like "connection refused" or "model not found"

    • Start server: ollama serve
    • Install model: ollama pull llama3.2
    • Then run with --provider ollama --model llama3.2.
  • Streaming looks odd in files

    • Use --no-stream to print a complete response at once.
  • Save outputs to a file

    • Use -o notes.md to append AI blocks to a markdown file.