MF

maitreyam/file-converter-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 7 forks 质量 43 趋势 15

A Python-based MCP (Model Context Protocol) server powered by FastMCP that leverages Pandoc for flexible document conversion between various formats (Markdown, DOCX, PDF, HTML, etc.

概览

A Python-based MCP (Model Context Protocol) server that provides powerful document conversion capabilities via Pandoc. This server allows AI agents (like Claude via LangChain/LangGraph) to request file conversions between various formats such as Markdown, DOCX, HTML, PDF, EPUB, and many more. * A Python library for easily creating MCP servers. * A Python wrapper around the Pandoc command-line tool. * The universal document converter. * For containerized deployment, bundling all dependencies (Python, Pandoc, LaTeX). * Exposes a single MCP tool: convert_document. * Supports a wide range of input and output formats handled by Pandoc. * Allows specifying input format (if auto-detection fails) and output format. * Supports passing extra command-line arguments to Pandoc for advanced control (e.g., Table of Contents, PDF margins, standalone files).

README

以下为原文 README 节选,完整内容请查看原文。

Pandoc MCP Server

A Python-based MCP (Model Context Protocol) server that provides powerful document conversion capabilities via Pandoc. This server allows AI agents (like Claude via LangChain/LangGraph) to request file conversions between various formats such as Markdown, DOCX, HTML, PDF, EPUB, and many more.

This project uses:

  • FastMCP: A Python library for easily creating MCP servers.
  • pypandoc: A Python wrapper around the Pandoc command-line tool.
  • Pandoc: The universal document converter.
  • (Optional) Docker: For containerized deployment, bundling all dependencies (Python, Pandoc, LaTeX).

Features

  • Exposes a single MCP tool: convert_document.
  • Supports a wide range of input and output formats handled by Pandoc.
  • Allows specifying input format (if auto-detection fails) and output format.
  • Supports passing extra command-line arguments to Pandoc for advanced control (e.g., Table of Contents, PDF margins, standalone files).
  • Includes Docker configuration (Dockerfile) for creating a self-contained server environment including Pandoc and necessary LaTeX components for PDF generation.
  • Designed for integration with MCP clients, particularly LangChain/LangGraph agents.

Exposed MCP Tool

convert_document

Converts a document from one format to another using Pandoc.

Arguments:

  • input_file_path (str, required): The path accessible by the server to the input document file. If running in Docker with a volume mount, this should be the path inside the container (e.g., /data/my_doc.docx).
  • output_file_path (str, required): The path accessible by the server where the converted output file should be saved. If running in Docker, this should be the path inside the container (e.g., /data/my_output.pdf). The directory will be created if it doesn’t exist within the server’s accessible filesystem.
  • to_format (str, required): The target format for the conversion (e.g., ‘markdown’, ‘docx’, ‘pdf’, ‘html’, ‘rst’, ‘epub’). See Pandoc documentation for a full list (--list-output-formats).
  • from_format (str, optional): The format of the input file. If None, pandoc will try to guess from the file extension. Specify if the extension is ambiguous or missing (e.g., ‘md’, ‘docx’, ‘html’). Defaults to None.
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @MaitreyaM/file-converter-mcp --client claude
新手?先看 mcpskill.org 教程 →