MD-DOCX Converter
MD-DOCX Converter allows bidirectional conversion between Markdown and Word (.docx) documents, and direct reading/writing of .docx content as Markdown. It provides four tools for AI assistants:
read_docx: Read a .docx file and return its content as Markdown.
write_docx: Create a .docx file from Markdown text and save it to a specified path.
convert_md_file_to_docx: Convert a Markdown file to a .docx file saved alongside the input.
convert_docx_file_to_md: Convert a .docx file to a Markdown file saved alongside the input, and return the Markdown content.
These capabilities enable reading, editing, creating, and converting documents programmatically, useful for tasks like summarization, reformatting, or content generation.
Enables the transfer of content between Microsoft Word documents and GitHub Copilot via bidirectional Markdown conversion.
Facilitates bidirectional conversion between Microsoft Word documents and GitHub Flavored Markdown, preserving document structure and formatting elements like headings, tables, and images.
MD-DOCX Converter
A Python tool for bidirectional conversion between Markdown (.md) and Microsoft Word (.docx). Designed to make it easy to move content between Word documents and AI tools like Claude, ChatGPT, and GitHub Copilot.
What it does
Converts
.md→.docxwith correct heading hierarchy (Title, Heading 1–9)Converts
.docx→.mdas clean GitHub Flavored Markdown (GFM)Runs from a simple desktop shortcut — no command line knowledge needed
Handles headings, bold/italic/strikethrough, lists, task lists, tables, blockquotes, code blocks, images, and hyperlinks
Exports Mermaid diagrams (fenced code blocks) to high-quality, centered PNG images (rendered locally and offline)
See MarkdownSyntax.md for the full element mapping and notes on what is preserved, approximated, or dropped.
Related MCP server: MarkltDown MCP Server
Requirements
Windows 10/11
Python 3.11+
The following Python packages (installed via pip):
pip install markdown-it-py python-docxOptional (for offline Mermaid diagram rendering)
To enable local, offline rendering of Mermaid diagrams inside the generated Word documents without sending any diagram code to the internet, install:
pip install mermaidx(Alternatively, if mmdc (Mermaid CLI) is on your system path, it will be used. If neither is available, diagrams are kept as plain monospaced code blocks with a warning).
Setup
1. Clone the repository
git clone https://github.com/cjwpenner/md-docx-converter.git
cd md-docx-converter2. Install dependencies
pip install markdown-it-py python-docx
# Optional: for offline Mermaid diagram rendering support
pip install mermaidx3. Create the desktop shortcut
pip install pywin32
python create_shortcut.pyThis creates an MD-DOCX Converter shortcut on your Windows desktop. pywin32 is only needed to create the shortcut — it is not required to run the converter itself.
4. Run the converter
Double-click MD-DOCX Converter on your desktop. A console window opens and prompts:
MD ↔ DOCX Converter
--------------------
Enter file path:Paste or type the full path to your .md or .docx file and press Enter. The converted file is saved in the same directory with the extension swapped.
You can also run directly from the command line:
python md_docx_converter/converter.pyConversion notes
Heading hierarchy
The heading level mapping is context-dependent:
MD → DOCX: If there is exactly one
#in the document, it becomes a Word Title. All other headings shift down by one level. If there are multiple#headings, they all become Heading 1 with no Title.DOCX → MD: If the document has a Title style, it becomes
#. All headings shift up accordingly. If there is no Title, Heading 1 becomes#.
Lossy elements
Word formatting that has no Markdown equivalent is approximated as bold:
Word formatting | Markdown output |
Underline |
|
Highlight |
|
Small caps |
|
Font colour | Stripped (text kept) |
Images
DOCX → MD: Embedded images are extracted to a
{filename}_images/folder next to the output.mdfile.MD → DOCX: Images referenced by relative path are re-embedded. Missing images become
[image not found: path].
Mermaid Diagrams
MD → DOCX: Code fences with language
mermaidare converted to centered PNG diagrams locally and embedded in the document. This is 100% local and offline, keeping your sensitive data private.
Claude Code integration
This tool integrates with Claude Code as either a plugin (recommended — gets everything in two commands) or a standalone MCP server (for manual setup or Claude Desktop).
Option A: Claude Code plugin (recommended)
The plugin bundles the MCP server configuration and a /md-docx-converter:convert skill. Run these two commands inside Claude Code:
/plugin marketplace add cjwpenner/md-docx-converter
/plugin install md-docx-converter@md-docx-converterThat is it — no further configuration needed. After running /reload-plugins, Claude gains the conversion tools and you can invoke the skill directly:
/md-docx-converter:convert path/to/file.md
/md-docx-converter:convert path/to/report.docxOr just ask naturally: "Convert this to a Word document" and Claude will use the tools automatically.
Option B: MCP server only (manual setup)
Use this if you want just the MCP tools without the plugin, or if you are configuring Claude Desktop rather than Claude Code.
Install the package:
pip install mcp-md-docxClaude Code — register the MCP server:
claude mcp add md-docx-converter --transport stdio -- uvx mcp-md-docxClaude Desktop — add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"md-docx-converter": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-md-docx"]
}
}
}Tools exposed
Tool | What it does |
| Read a |
| Create a |
| Convert a |
| Convert a |
Once configured, you can say things like:
"Read
report.docxand summarise it""Turn this into a Word document and save it to my Desktop"
"Convert all the bullet points in
notes.docxinto a table"
Project structure
md_docx_converter/
├── converter.py # CLI entry point
├── md_to_docx.py # Markdown → Word conversion
├── docx_to_md.py # Word → Markdown conversion
├── heading_mapper.py # Heading hierarchy pre-scan logic
├── image_handler.py # Image extraction and embedding
└── launch.pyw # Desktop shortcut launcher
mcp_md_docx/
├── server.py # MCP server (four tools)
└── __main__.py # Entry point for python -m mcp_md_docx
create_shortcut.py # One-time shortcut setup script
pyproject.toml # PyPI packaging configLicense
This project is licensed under the GNU General Public License v3.0 (GPLv3). You are free to use, modify, and distribute this software, provided that any derivative works are also distributed under the same licence.
See LICENSE for the full licence text.
Third-party libraries
This project depends on the following open source libraries, all MIT-licensed:
Library | Purpose | Licence |
Model Context Protocol server framework | MIT | |
GitHub Flavored Markdown parser | MIT | |
Read and write Word | MIT |
Full licence texts are reproduced in THIRD_PARTY_NOTICES.md.
Available Tools
4 toolsconvert_docx_file_to_mdA
Convert a Word (.docx) file to a Markdown (.md) file. The output is saved alongside the input file. Returns the Markdown content.
Inputs: path (required). Returns: result
convert_md_file_to_docxA
Convert a Markdown (.md) file to a Word (.docx) file. The output is saved alongside the input file with the same name and .docx extension.
Inputs: path (required). Returns: result
read_docxA
Read a Word (.docx) document and return its full content as Markdown text. Use this when the user asks you to read, summarise, edit, or work with a Word document.
Inputs: path (required). Returns: result
write_docxA
Convert Markdown text to a Word (.docx) document and save it to disk. Use this when the user asks you to create or save a Word document from text or Markdown content. The output_path should be an absolute path ending in .docx.
Inputs: markdown (required), output_path (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The tools have significant overlap in purpose, particularly between convert_docx_file_to_md and read_docx (both convert DOCX to Markdown), and between convert_md_file_to_docx and write_docx (both convert Markdown to DOCX). The descriptions attempt to differentiate use cases (file conversion vs. content reading/writing), but an agent could easily misselect between these pairs due to unclear functional boundaries.
The tool names follow a consistent verb_noun pattern with snake_case throughout (e.g., convert_docx_file_to_md, read_docx). The only minor deviation is that some names include 'file' while others do not, but overall the naming is predictable and readable.
With 4 tools, the count is reasonable for a conversion-focused server, but it feels borderline thin given the overlapping functionality. A more streamlined set might have 2-3 tools instead, as the current count includes redundancy that doesn't add clear value to the surface.
For a DOCX-Markdown conversion domain, the tools cover the core bidirectional conversion operations and basic file handling. However, there are minor gaps, such as no tool for editing or manipulating the content in between conversions, which agents might need to work around by combining tools or external processing.
Maintenance
Related MCP Connectors
Convert PDF, Word, Excel, PowerPoint, e-mails and web pages to clean Markdown for LLMs.
Convert PDF, DOCX, XLSX and 25 other formats to clean Markdown for LLMs and RAG. No key or account.
Document to Markdown: convert Word, Excel, PowerPoint and PDF files to Markdown for an LLM.
Turn Markdown and AI answers into Word (.docx) with native equations, or into PDF.
Related MCP Servers
- AlicenseAqualityDmaintenanceConverts Markdown documents to professional Word documents with advanced formatting capabilities including mathematical formulas, custom styling, tables, images, headers/footers, and watermarks.486 npm14MIT
- FlicenseNot gradedqualityDmaintenanceConverts files (PDF, Word, images, etc.) to Markdown within Claude Desktop to reduce token usage.-
- AlicenseAqualityCmaintenanceConverts documents between Markdown, PDF, DOCX, and HTML locally with AI-friendly Markdown output and secure file access.613 npmMIT
- AlicenseAqualityBmaintenanceEnables Claude to create, edit, mail-merge, convert and preview documents by driving a locally installed WordCraft engine headless, covering DOCX, PDF, ODT, RTF, HTML, Markdown and LaTeX. Supports templates, tables, images, comments, tracked changes, merge fields from CSV/XLSX/ODS, page rendering and folder-wide batch processing.11Apache 2.0