markdown-to-pdf-mcp
v1.0.0
Published
A FastMCP tool for converting Markdown files to PDF format
Maintainers
Readme
Markdown to PDF MCP Tool
A FastMCP-based tool for converting Markdown files to PDF format. This tool can be easily integrated into AI agents that support the Model Context Protocol (MCP).
Features
- Convert Markdown files to PDF documents
- Convert Markdown text content to PDF documents
- Clean and professional PDF output
- Easy integration with MCP-compatible AI agents
Prerequisites
Before installing this tool, make sure you have:
- Node.js (v14 or higher)
- Python (v3.7 or higher)
- Pip (Python package installer)
Installation
npm install markdown-to-pdf-mcpDuring installation, the required Python dependencies will be automatically installed:
- fastmcp
- reportlab
Usage
As a standalone tool
npx markdown-to-pdf-mcpIn MCP-compatible applications
The tool exposes two functions:
convert_markdown_to_pdf(file_path, output_path)- Converts a Markdown file to PDFfile_path: Path to the markdown file to convertoutput_path: Path where the PDF should be saved (optional, defaults to same location with .pdf extension)
convert_markdown_text_to_pdf(content, output_path)- Converts Markdown text content to PDFcontent: Markdown text content to convertoutput_path: Path where the PDF should be saved
Integration with MCP Servers
To use this tool with other MCP-compatible applications, you can reference the provided mcpServers.json configuration:
{
"servers": [
{
"name": "Markdown to PDF Converter",
"description": "A FastMCP tool for converting Markdown files to PDF format",
"command": "npx",
"args": ["markdown-to-pdf-mcp"],
"env": {
"PYTHONIOENCODING": "utf-8"
}
}
]
}Example Usage
With Claude Desktop
- Add the server configuration to your Claude Desktop configuration
- Use prompts like:
- "Convert my README.md file to PDF"
- "Turn this markdown content into a PDF document"
Programmatic Usage
If you're building an MCP-compatible application:
// Example MCP client usage
const result = await client.callTool({
name: "convert_markdown_to_pdf",
arguments: {
file_path: "/path/to/document.md",
output_path: "/path/to/document.pdf"
}
});Troubleshooting
If you encounter issues:
- Make sure Python is installed and available in your PATH
- Check that the required Python packages are installed:
pip install fastmcp reportlab - Ensure you have proper file permissions for reading input files and writing output files
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
