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

md-2-pdf-mcp

v1.0.4

Published

MCP server exposing pdf_from_markdown/md_to_pdf tools to render Markdown (inline or file) to PDF with output path, paper format and orientation options.

Readme

MCP PDF Server

An MCP (Model Context Protocol) server exposing tools to render Markdown into PDF.

What’s included

  • MCP tools: pdf_from_markdown (primary) and md_to_pdf (alias).
  • Accepts inline Markdown or a file path.
  • Options for paper format and orientation; sensible output/ defaults.

Prerequisites

  • Node.js 18+ recommended.

Install

npm install
# Download browsers for Playwright (Chromium only is enough):
npx playwright install chromium

Build

npm run build

Run (stdio)

npm start

Configure in your MCP-compatible client by pointing to the compiled binary or npm start command.

MCP Tools

  • Tool ids: pdf_from_markdown (primary) and md_to_pdf (alias for discoverability)
    • Purpose: Generate a PDF from Markdown.
    • Inputs:
      • markdown (string, optional): Inline Markdown content. If set, path is ignored.
      • path (string, optional): Absolute or relative path to a .md file. Ignored if markdown is provided.
      • outputPath (string, optional): Desired output PDF path. Defaults to output/<timestamp>.pdf and creates missing directories.
      • paperFormat (string, optional): A4 | Letter | Legal (default: A4).
      • paperOrientation (string, optional): portrait | landscape (default: portrait).
      • Provide exactly one of markdown or path. If both are set, markdown takes precedence.
    • Output:
      • Returns a text message containing the absolute path to the created PDF.
    • Example (inline):
      {
        "tool": "md_to_pdf",
        "arguments": {
          "markdown": "# Hello\nThis will render to PDF.",
          "paperFormat": "A4"
        }
      }
    • Example (file path):
      {
        "tool": "pdf_from_markdown",
        "arguments": {
          "path": "examples/sample.md",
          "outputPath": "output/sample.pdf",
          "paperOrientation": "landscape"
        }
      }

Tool Schema (compact)

tools:
  - id: pdf_from_markdown
    alias: md_to_pdf
    params:
      markdown?: string                # Inline Markdown (preferred if both set)
      path?: string                    # Path to a .md file
      outputPath?: string              # Output PDF path (default: output/<timestamp>.pdf)
      paperFormat?: 'A4'|'Letter'|'Legal'      # default: 'A4'
      paperOrientation?: 'portrait'|'landscape' # default: 'portrait'
    constraints:
      - Provide exactly one of markdown or path (if both provided, markdown is used)
    result:
      - type: text
        text: "PDF created at: <absolute path>"

Client configuration (example) If your MCP client supports JSON configuration for a stdio server, a minimal entry might look like:

{
  "servers": {
    "mcp-pdf": {
      "command": "node",
      "args": ["dist/index.js"]
    }
  }
}

Notes

  • Uses Playwright (Chromium) to render HTML from Markdown and print to PDF.
  • On first install, Playwright may download a browser. You can also point it to an existing Chrome/Chromium.

One‑liner with npx

  • After this package is published to npm, you can run the server directly:
    • npx -y md-2-pdf-mcp (runs the md-2-pdf-mcp bin)
    • Or explicitly: npx -y -p md-2-pdf-mcp mcp-pdf
    • The package defines bin entries and a postinstall that installs Chromium.
  • From the local repo (without publishing):
    • npx --yes .
    • This uses the bin in package.json and the prepare script to build.