Labsco
zicez logo

MCP-PDF2MD

โ˜… 1

from zicez

A high-performance service to convert PDFs from local files or URLs into Markdown using the Mistral AI OCR API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

MCP-PDF2MD

MCP-PDF2MD Service

An MCP-based high-performance PDF to Markdown conversion service powered by the Mistral AI OCR API, supporting batch processing for local files and URL links with structured output.

Key Features

  • Format Conversion: Convert PDF files to structured Markdown format.
  • Multi-source Support: Process both local PDF files and remote PDF URLs.
  • MCP Integration: Seamlessly integrates with LLM clients like Claude Desktop.
  • Structure Preservation: Aims to maintain the original document structure, including headings, paragraphs, and lists.
  • Image Extraction: Automatically extracts images from the PDF and saves them locally.
  • High-Quality Extraction: Leverages Mistral AI's state-of-the-art OCR for high-quality text and layout information extraction.

Command Line Arguments

The server supports the following command line arguments:

  • --output-dir: Specify the directory to save converted Markdown files and images. Defaults to ./downloads.

Example:

uv run pdf2md --output-dir /path/to/my/output

MCP Tools

The server provides the following MCP tools:

  • convert_pdf_url(url: str): Converts a PDF from a URL to Markdown. Supports single URLs or multiple URLs separated by spaces, commas, or newlines.
  • convert_pdf_file(file_path: str): Converts a local PDF file to Markdown. Supports single or multiple file paths separated by spaces, commas, or newlines.

Getting a Mistral AI API Key

This project relies on the Mistral AI API for PDF content extraction. To obtain an API key:

  1. Visit the Mistral AI Platform and create an account.
  2. Navigate to the "API Keys" section in your workspace.
  3. Create a new secret key.
  4. Copy the generated API key.
  5. Use this key as the value for MISTRAL_API_KEY.