# mcp-document-converter

Converts files between Markdown, HTML, DOCX, PDF, and plain text using the Model Context Protocol. Useful when feeding varied project documentation into coding agents.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 12
- Author: xt765
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/xt765/mcp-document-converter
- Updated: 2026-03-02
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-document-converter

## What it does

The server exposes a `convert_document` tool handling five formats: Markdown, HTML, DOCX, PDF, and plain text. Every supported format converts directly to any other, providing twenty-five distinct conversion routes. Documents pass through a unified `DocumentIR` representation that preserves heading trees, document titles, and metadata tags.

Conversions accept a `source_path`, a `target_format`, and optional `options` such as custom CSS files and templates. HTML and PDF renderers support syntax highlighting on code blocks. PDF creation depends on WeasyPrint under the hood.

Running the tool requires Python 3.10 or newer. Without `uvx` installed or the system libraries needed by WeasyPrint, PDF compilation will fail during execution.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp-document-converter -- uvx mcp-document-converter
```
uvx runs the command named after the package; if the README names another one, use uvx --from mcp-document-converter <command>

### Codex

**Platform CLI**
```bash
codex mcp add mcp-document-converter -- uvx mcp-document-converter
```
uvx runs the command named after the package; if the README names another one, use uvx --from mcp-document-converter <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp-document-converter": {
            "command": "uvx",
            "args": [
                "mcp-document-converter"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from mcp-document-converter <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp-document-converter": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "mcp-document-converter"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from mcp-document-converter <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add mcp-document-converter uvx mcp-document-converter
```
uvx runs the command named after the package; if the README names another one, use uvx --from mcp-document-converter <command>

## When to use it
- turn DOCX or PDF files into clean Markdown for agent context
- render styled PDF pages from Markdown or HTML documents
- transform HTML markup into editable DOCX files
- retain document metadata and heading trees across conversions

## Example prompts
- Convert `notes.docx` to `notes.md` so we can inspect the content
- Transform `report.md` into `report.pdf` using styles from `theme.css`
- Export `page.html` to plain text and save it to `output.txt`

## Similar
- [document-converter-suite](https://affpapa.org/en/nevibecode/skills/document-converter-suite.md) — skill · 483 installs
- [kami-document-design](https://affpapa.org/en/nevibecode/skills/kami-document-design.md) — skill · 387 installs
- [markdown-converter](https://affpapa.org/en/nevibecode/skills/markdown-converter.md) — skill · 1700 installs
- [Skywork Document](https://affpapa.org/en/nevibecode/skills/skywork-document.md) — skill · 371 installs
- [markit-markdown-converter](https://affpapa.org/en/nevibecode/skills/markit-markdown-converter.md) — skill · 855 installs
- [PDF Converter](https://affpapa.org/en/nevibecode/skills/pdf-converter.md) — skill · 5200 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
