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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tscodex/mcp-pdf

v0.1.1

Published

MCP server for generating PDF documents from Markdown, HTML, and URLs using Playwright

Readme

@tscodex/mcp-pdf

MCP server for generating PDF documents from Markdown, HTML, and URLs using Playwright.

Official website: http://tscodex.com/

Built on @tscodex/mcp-sdk - This project uses the official TSCodex MCP SDK for server infrastructure, authentication, configuration management, and protocol handling.

Managed by MCP Manager - Use the MCP Manager desktop application for workspace isolation, visual configuration, and seamless integration with Cursor. The MCP Manager Bridge VS Code extension provides a bridge to manage MCP servers directly from your IDE.

Features

  • PDF from Markdown - Convert .md files or content to styled PDF with themes
  • PDF from HTML - Convert .html files or content to PDF
  • PDF from URL - Generate PDF from web pages
  • Custom Styling - CSS themes, syntax highlighting
  • Page Formatting - Sizes, margins, headers, footers, page numbers
  • RTL Support - Hebrew, Russian, English with auto-direction
  • Table of Contents - Auto-generated TOC from headings
  • Multiple Files - Concatenate multiple markdown files into one PDF

Installation

npm install @tscodex/mcp-pdf

After installation, Playwright will automatically install Chromium.

Tools

pdf_from_markdown

Convert Markdown to PDF with styling and syntax highlighting.

{
  "content": "# Hello World\n\nThis is **markdown**.",
  "outputPath": "docs/hello.pdf"
}

Or from file:

{
  "filePath": "README.md",
  "outputPath": "docs/readme.pdf",
  "theme": "github",
  "toc": true
}

Or multiple files (comma-separated, keeps your order):

{
  "files": "docs/intro.md, docs/api.md, docs/examples.md",
  "outputPath": "docs/full-documentation.pdf",
  "theme": "docs",
  "toc": true,
  "title": "API Documentation"
}

Or with glob pattern (auto-sorted by numeric prefix):

{
  "glob": "docs/*.md",
  "outputPath": "docs/full-documentation.pdf",
  "theme": "docs",
  "toc": true
}

Glob sorting: Files matched by glob are automatically sorted by numeric prefix:

  • 1.intro.md2.api.md10.appendix.mdreadme.md
  • Files without prefix are sorted alphabetically at the end

Using baseUrl for dynamic image URLs:

In your markdown, use {{BASE_URL}} placeholder:

![Logo]({{BASE_URL}}/images/logo.png)

Then provide baseUrl in the tool call:

{
  "filePath": "docs/readme.md",
  "baseUrl": "https://prod.example.com",
  "outputPath": "docs/output.pdf"
}

Parameters:

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | content | string | * | Markdown content | | filePath | string | * | Path to .md file | | files | string | * | Comma-separated .md file paths (keeps order) | | glob | string | * | Glob pattern for .md files (auto-sorted by numeric prefix) | | outputPath | string | ✓ | Output PDF path | | title | string | | Document title | | coverImage | string | | Cover image URL (HTTPS only) | | baseUrl | string | | Base URL for {{BASE_URL}} substitution (http/https) | | theme | enum | | github, minimal, docs | | css | string | | Custom CSS | | codeHighlight | boolean | | Syntax highlighting (default: true) | | toc | boolean | | Generate table of contents | | tocDepth | number | | TOC depth 1-6 (default: 3) | | author | string | | PDF metadata | | subject | string | | PDF metadata | | keywords | string[] | | PDF metadata | | pageSize | enum | | A4, Letter, Legal | | landscape | boolean | | Landscape orientation | | margins | object | | {top, right, bottom, left} | | displayHeaderFooter | boolean | | Show header/footer | | headerTemplate | string | | HTML header template | | footerTemplate | string | | HTML footer template |

*One of content, filePath, or files is required.

pdf_from_html

Convert HTML content or file to PDF.

{
  "content": "<html><body><h1>Report</h1></body></html>",
  "outputPath": "reports/report.pdf"
}

Parameters:

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | content | string | * | HTML content | | filePath | string | * | Path to .html file | | outputPath | string | ✓ | Output PDF path | | pageSize | enum | | Page size | | landscape | boolean | | Landscape orientation | | margins | object | | Page margins | | printBackground | boolean | | Include backgrounds (default: true) | | scale | number | | Scale factor 0.1-2.0 | | displayHeaderFooter | boolean | | Show header/footer | | headerTemplate | string | | HTML header | | footerTemplate | string | | HTML footer |

*One of content or filePath is required.

pdf_from_url

Generate PDF from a web page.

{
  "url": "https://example.com/article",
  "outputPath": "saved/article.pdf"
}

With wait options:

{
  "url": "https://app.example.com/dashboard",
  "outputPath": "reports/dashboard.pdf",
  "waitForSelector": ".charts-loaded",
  "waitFor": 1000,
  "printBackground": true
}

Parameters:

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | url | string | ✓ | Web page URL | | outputPath | string | ✓ | Output PDF path | | pageSize | enum | | Page size | | landscape | boolean | | Landscape orientation | | margins | object | | Page margins | | printBackground | boolean | | Include backgrounds | | waitFor | number | | Wait ms after load | | waitForSelector | string | | Wait for element | | timeout | number | | Page load timeout | | displayHeaderFooter | boolean | | Show header/footer | | headerTemplate | string | | HTML header | | footerTemplate | string | | HTML footer |

Themes

github (default)

GitHub-flavored markdown styling:

  • Clean sans-serif typography
  • Styled code blocks with syntax highlighting
  • Tables with borders
  • Blockquotes with left border

minimal

Print-optimized minimal styling:

  • Serif font for readability
  • Simple black & white
  • Good for printing

docs

Professional documentation style:

  • Modern sans-serif typography
  • Beautiful light design
  • RTL support for Hebrew, Russian, English
  • Professional look with subtle colors

Header/Footer Templates

Playwright supports special CSS classes:

<!-- Footer with page numbers -->
<div style="font-size: 10px; text-align: center; width: 100%;">
  Page <span class="pageNumber"></span> of <span class="totalPages"></span>
</div>

Available classes:

  • pageNumber - current page
  • totalPages - total pages
  • date - formatted date
  • title - document title

Configuration

Create .mcp-pdf.json in your project:

{
  "defaultPageSize": "A4",
  "defaultTheme": "github",
  "codeHighlight": true,
  "defaultMargins": {
    "top": "20mm",
    "right": "20mm",
    "bottom": "20mm",
    "left": "20mm"
  }
}

License

MIT