MCP-PDF2MD
A high-performance service to convert PDFs from local files or URLs into Markdown using the Mistral AI OCR API.
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.
System Requirements
- Python 3.10+
uv
for environment and package management (recommended)
Quick Start
-
Clone the repository and enter the directory:
git clone https://github.com/zicez/mcp-pdf2md.git cd mcp-pdf2md
-
Install dependencies with uv:
uv sync
-
Configure environment variables:
Create a
.env
file in the project root directory and set your Mistral AI API key:MISTRAL_API_KEY=your_mistral_api_key_here
-
Start the service:
uv run pdf2md
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
Claude Desktop Configuration
Add the following configuration in Claude Desktop:
Windows:
{
"mcpServers": {
"pdf2md": {
"command": "uv",
"args": [
"--directory",
"C:\\path\\to\\mcp-pdf2md",
"run",
"pdf2md",
"--output-dir",
"C:\\path\\to\\output"
],
"env": {
"MISTRAL_API_KEY": "your_mistral_api_key_here"
}
}
}
}
Linux/macOS:
{
"mcpServers": {
"pdf2md": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-pdf2md",
"run",
"pdf2md",
"--output-dir",
"/path/to/output"
],
"env": {
"MISTRAL_API_KEY": "your_mistral_api_key_here"
}
}
}
}
Note about API Key Configuration: You can set the API key in two ways:
- In the
.env
file within the project directory (recommended for development). - In the Claude Desktop configuration as shown above (recommended for regular use).
If you set the API key in both places, the one in the Claude Desktop configuration will take precedence.
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:
- Visit the Mistral AI Platform and create an account.
- Navigate to the "API Keys" section in your workspace.
- Create a new secret key.
- Copy the generated API key.
- Use this key as the value for
MISTRAL_API_KEY
.
License
MIT License - see the LICENSE
file for details.
Credits
This project uses the Mistral AI OCR API.
Related Servers
PromptX
An AI capability enhancement system providing professional roles, memory management, and knowledge systems for applications like Claude and Cursor.
Redmine
An MCP server for interacting with the Redmine project management system.
VisiData MCP Server
Interact with VisiData, a terminal spreadsheet multitool for discovering and arranging tabular data in various formats like CSV, JSON, and Excel.
DAISYS
Generate high-quality text-to-speech and text-to-voice outputs using the DAISYS platform.
Spire.XLS MCP Server
Create, read, edit, and convert Excel files without requiring Microsoft Office.
salary-Web
An AI-powered payroll management tool for enterprises, integrated with DingTalk.
Harvest MCP Server
Manage time tracking, projects, clients, and tasks using the Harvest API.
AppleScript BB MCP Server
Enables LLM clients to interact with macOS applications through AppleScript. Built using the @beyondbetter/bb-mcp-server library, this server provides safe, controlled execution of predefined scripts with optional support for arbitrary script execution.
Intugle MCP
Generate automated semantic models using data engineering agents and built data products on demand
Huuh MCP Server
Integrates with the huuh.me platform to enable collaborative AI knowledge bases and personas.