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

@toi500/mcp-server-pdfconverter

v1.3.4

Published

Text/Markdown to PDF Converter MCP Server

Readme

Text/Markdown to PDF Converter API

This project is a REST API that converts text or Markdown content into downloadable PDF files. The service provides both direct file downloads and shareable download links. Markdown input is automatically formatted in the PDF output with appropriate headings, text styles, and structure.

Quick Start with NPX

Run the server instantly without installation:

npx pdf-converter-cli

Options:

  • --port or -p: Specify custom port (default: 3000)
  • --host or -h: Specify host (default: localhost)

Example with custom port:

npx pdf-converter-cli --port 4000

Features

  • Convert text and Markdown to downloadable PDF files
  • Support for Markdown features:
    • Headers (H1, H2, H3)
    • Bold and italic text
    • Code blocks with proper formatting
    • Lists and blockquotes
  • Simple REST API with two convenient endpoints
  • Get either direct PDF download or a shareable download link
  • Built using TypeScript and Express

Getting Started

Prerequisites

  • Node.js (version 14 or higher)
  • npm (Node package manager)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/pdfConverter.git
  2. Navigate to the project directory:

    cd pdfConverter
  3. Install the dependencies:

    npm install

Usage

  1. Start the server:

    npm start
  2. The API will be available at http://localhost:3000

PDF Storage and Retention

Generated PDFs are stored in:

  • Local development: /public/pdfs directory
  • Docker deployment: Volume mounted at /app/public/pdfs

Important Notes:

  • PDFs are kept for 24 hours after generation
  • Files are automatically cleaned up after this period
  • Download links expire after 24 hours
  • For permanent storage, download the PDF immediately or store it in your own system

API Endpoints

  1. Direct PDF Download - /api/convert

    Converts your text/Markdown and returns the PDF file immediately for download.

    POST http://localhost:3000/api/convert
    Content-Type: application/json
       
    {
      "text": "# Your Markdown Title\n\nThis is a **bold** text and *italic* text.\n\n## Subtitle\n\nRegular paragraph text."
    }

    or

    {
      "textInput": "# Your Markdown Title\n\nThis is a **bold** text and *italic* text."
    }

    Returns: PDF file directly for download

  2. Get Download Link - /api/convert-link

    Converts your text/Markdown and returns a shareable download link for the PDF.

    POST http://localhost:3000/api/convert-link
    Content-Type: application/json
       
    {
      "text": "# Your Markdown Title\n\nThis is a **bold** text and *italic* text."
    }

    Returns:

    {
      "downloadLink": "http://localhost:3000/downloads/[unique-id].pdf"
    }

Example Usage

Using fetch in JavaScript:

// Direct PDF download
async function convertToPdf(text) {
  try {
    const response = await fetch('http://localhost:3000/api/convert', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ text })
    });

    if (!response.ok) throw new Error('Failed to convert');
    
    const blob = await response.blob();
    // Use the blob as needed (download, display, etc.)
    return blob;
  } catch (error) {
    console.error('Error:', error);
  }
}

// Get download link
async function getDownloadLink(text) {
  try {
    const response = await fetch('http://localhost:3000/api/convert-link', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ text })
    });

    if (!response.ok) throw new Error('Failed to get download link');
    
    const data = await response.json();
    return data.downloadLink;
  } catch (error) {
    console.error('Error:', error);
  }
}

Docker Deployment

You can deploy this application using Docker in two ways:

Using Docker Compose (Recommended)

  1. Make sure you have Docker and Docker Compose installed
  2. Clone the repository
  3. Run the following command:
docker-compose up -d

The API will be available at http://localhost:3000

Using Docker Directly

  1. Build the Docker image:
docker build -t pdf-converter .
  1. Run the container:
docker run -d -p 3000:3000 pdf-converter

The API will be available at http://localhost:3000

License

This project is licensed under the MIT License. See the LICENSE file for more details.