MD-PDF MCP Server
Provides tools for converting Markdown content and files into PDF documents with customizable formatting, as well as converting PDF files back into Markdown format.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MD-PDF MCP Server Convert report.md to a PDF named report.pdf using medium size settings"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MD-PDF MCP Server
A Model Context Protocol (MCP) server for converting between Markdown and PDF formats.
System Requirements
Tested on:
macOS 14.3.0 (Darwin 23.3.0, ARM64)
Python 3.13.0
uv 0.7.13
pandoc 3.6.2
Related MCP server: PDF2MD MCP Server
Features
Convert Markdown content/files to PDF with size options (small, medium, large)
Convert PDF files to Markdown format
Extract text from specific PDF pages
Retrieve PDF metadata
MCP Tools
convert_markdown_to_pdf(markdown_content, output_filename, size, pdf_engine)convert_markdown_file_to_pdf(markdown_file_path, output_filename, size, pdf_engine)convert_pdf_to_markdown(pdf_file_path, output_filename)extract_text_from_pdf(pdf_file_path, page_numbers)get_pdf_info(pdf_file_path)
Installation
# Install dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
brew install pandoc weasyprint
# Setup project
uv syncRunning the Server
uv run python main.pyMCP Integration
Claude Desktop
{
"mcpServers": {
"md-pdf": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/md-pdf",
"run",
"main.py"
]
}
}
}Cursor
Configure MCP in Cursor settings
{
"servers": {
"md-pdf": {
"command": "uv",
"args": ["run", "main.py"],
"cwd": "/absolute/path/to/md-pdf"
}
}
}Size Options
s: 8pt font, 0.35in margins (compact)m: 9pt font, 0.5in margins (standard)l: 11pt font, 1in margins (detailed)
Project Structure
md-pdf/
├── data/ # Test files
├── tools/ # MCP tool definitions
├── utils/ # Conversion utilities
├── main.py # Server entry point
└── server.py # MCP server instanceAvailable Tools
5 toolsconvert_markdown_file_to_pdfA
Convert a Markdown file to PDF with customizable formatting options.
Args: working_dir: Absolute path to the working directory for file operations markdown_file_path: Path to the markdown file relative to working_dir output_filename: Name of the output PDF file relative to working_dir (if not provided, uses same name as input with .pdf extension) size: Output size - 's' (small/compact), 'm' (medium), 'l' (large/detailed) (default: l) pdf_engine: PDF engine to use - weasyprint or pdflatex (default: weasyprint)
Returns: A message indicating success or failure of the conversion
Inputs: working_dir (required), markdown_file_path (required), output_filename, size, +1 more.
convert_markdown_to_pdfA
Convert Markdown content to PDF with customizable formatting options.
Args: working_dir: Absolute path to the working directory for file operations markdown_content: The markdown content to convert to PDF output_filename: Name of the output PDF file relative to working_dir (default: output.pdf) size: Output size - 's' (small/compact), 'm' (medium), 'l' (large/detailed) (default: l) pdf_engine: PDF engine to use - weasyprint or pdflatex (default: weasyprint)
Returns: A message indicating success or failure of the conversion
Inputs: working_dir (required), markdown_content (required), output_filename, size, +1 more.
convert_pdf_to_markdownB
Convert a PDF file to Markdown format.
Args: pdf_file_path: Path to the PDF file to convert output_filename: Name of the output Markdown file (if not provided, uses same name as input with .md extension)
Returns: A message indicating success or failure of the conversion
Inputs: pdf_file_path (required), output_filename.
extract_text_from_pdfA
Extract text content from a PDF file without conversion to Markdown.
Args: working_dir: Absolute path to the working directory for file operations pdf_file_path: Path to the PDF file relative to working_dir page_numbers: Page numbers to extract - "all" for all pages, or comma-separated numbers like "1,3,5" or "1-5"
Returns: The extracted text content from the PDF
Inputs: working_dir (required), pdf_file_path (required), page_numbers.
get_pdf_infoC
Get information about a PDF file (number of pages, metadata, etc.).
Args: working_dir: Absolute path to the working directory for file operations pdf_file_path: Path to the PDF file relative to working_dir
Returns: Information about the PDF file
Inputs: working_dir (required), pdf_file_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
There is significant overlap between convert_markdown_file_to_pdf and convert_markdown_to_pdf, which differ only in input type (file vs. content) and could easily be confused. The other three tools have distinct purposes (PDF to Markdown conversion, text extraction, and metadata retrieval), but the two Markdown-to-PDF tools create ambiguity.
All tool names follow a consistent verb_noun pattern with clear, descriptive actions (convert, extract, get) and objects (markdown_file_to_pdf, pdf_to_markdown, text_from_pdf, pdf_info). The naming is uniform and predictable throughout the set.
With 5 tools, this server is well-scoped for its PDF/Markdown conversion domain. The count is appropriate, covering key operations without being overly sparse or bloated, and each tool appears to serve a distinct functional role in the workflow.
The toolset provides solid coverage for PDF and Markdown interactions, including conversion in both directions, text extraction, and metadata retrieval. A minor gap exists in lacking tools for editing or manipulating PDFs/Markdown files beyond conversion, but core workflows are well-supported.
Maintenance
Related MCP Connectors
Hosted MCP server: convert PDFs to clean, LLM-ready Markdown with tables, formulas and OCR.
Document conversion MCP server: PDF to Markdown, image OCR, spreadsheet parsing.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Convert PDF documents to Markdown for AI agents through an authenticated remote MCP server.
Related MCP Servers
- AlicenseAqualityFmaintenanceAn MCP server that exports PDF documents to markdown format optimized for LLM processing.11BSD 3-Clause
- AlicenseAqualityDmaintenanceAn MCP server that converts PDF files to Markdown format using AI sampling capabilities, supporting both local files and URLs with incremental conversion features.11MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that converts Markdown text to DOCX format using an external conversion service. It supports custom templates, multi-language output, and provides flexible file handling for both local and cloud-based deployments.8MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for reading, writing, and manipulating PDF files, including text extraction, metadata retrieval, and merging or splitting documents. It also enables users to create PDFs from plain text and convert specific pages or entire documents into images.1-