MCP PDF Server

MCP PDF Server

Enables conversion of Markdown content into PDF documents with customizable paper formats and orientations. Supports both inline Markdown text and file path inputs, automatically generating PDFs using Playwright and Chromium.

Category
Visit Server

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured