MD-DOCX Converter

MD-DOCX Converter

Bidirectional Markdown ↔ Word (.docx) converter. Read Word documents directly into Claude as Markdown, or save Claude's output as a properly formatted .docx with heading styles (Title, Heading 1–9), bold, italic, tables, lists, code blocks, and images. No cloud upload — runs entirely on your machine using python.

Category
访问服务器

README

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.docx with correct heading hierarchy (Title, Heading 1–9)
  • Converts .docx.md as 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

See MarkdownSyntax.md for the full element mapping and notes on what is preserved, approximated, or dropped.

Requirements

  • Windows 10/11
  • Python 3.11+
  • The following Python packages (installed via pip):
pip install markdown-it-py python-docx

Setup

1. Clone the repository

git clone https://github.com/cjwpenner/md-docx-converter.git
cd md-docx-converter

2. Install dependencies

pip install markdown-it-py python-docx

3. Create the desktop shortcut

pip install pywin32
python create_shortcut.py

This 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.py

Conversion 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 **bold**
Highlight **bold**
Small caps **bold**
Font colour Stripped (text kept)

Images

  • DOCX → MD: Embedded images are extracted to a {filename}_images/ folder next to the output .md file.
  • MD → DOCX: Images referenced by relative path are re-embedded. Missing images become [image not found: path].

MCP server (Claude / AI integration)

This tool is also available as an MCP server, letting Claude and other AI assistants read and write Word documents directly.

Install

pip install mcp-md-docx

Configure Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "md-docx": {
      "command": "python",
      "args": ["-m", "mcp_md_docx"]
    }
  }
}

Configure Claude Code

claude mcp add md-docx mcp-md-docx

Tools exposed

Tool What it does
read_docx Read a .docx file — returns full Markdown text to the AI
write_docx Create a .docx from Markdown text the AI has written
convert_md_file_to_docx Convert a .md file on disk to .docx
convert_docx_file_to_md Convert a .docx file on disk to .md

Once configured, you can say things like:

  • "Read report.docx and summarise it"
  • "Turn this into a Word document and save it to my Desktop"
  • "Convert all the bullet points in notes.docx into 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 config

License

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选