# md-to-word [Health: Active]

**Category:** 🏢 Workplace & Productivity  
**Repository:** https://github.com/ls-open/md-to-word  
**GitHub Stars:** 18  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/md-to-word

## Description
Deterministic Markdown-to-Word (.docx) compiler & MCP Server for academic papers, theses & AI agents | 确定性 Markdown 转出版级 Word 与 MCP 服务

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "md-to-word": {
    "command": "uvx",
    "args": ["md-to-word-docx"]
  }
}
```

## Documentation

## What md-to-word does

md-to-word converts Markdown into Word documents using a declarative formatting contract. The compiler is designed for manuscripts that need controlled pagination, typography, headings, tables, equations, references, captions, and page structure. Output is intended for academic papers, theses, technical reports, white papers, and other documents with explicit presentation requirements.

The same Python implementation can be used as an MCP server, command-line program, or Python library. The MCP form lets an AI client invoke document-generation and validation operations without embedding Word-generation logic in each prompt or script. The compiler runs locally and does not require an Office, WPS, Pandoc, or model API process.

Formatting can come from a plain-text `format.txt` contract, an included preset, or a specification inferred from a `.docx` template. Presets include options for Chinese academic documents, white papers, and Nature-style English papers. A supplied format contract takes precedence when a school, journal, or organization has its own rules.

## How it works

An agent can first request the workflow guide, then choose a preset or prepare a format contract. If a reference Word template exists, the template extraction command analyzes properties such as page dimensions, margins, header and footer boundaries, page numbering, paragraph styles, fonts, spacing, indentation, and table borders. Items that need human confirmation are placed in a review list.

The manuscript uses Markdown plus project-specific markers. These markers can represent table-of-contents fields, section breaks, page-number resets, forced page breaks, captions, equation identifiers, and citation data. Standard Markdown tables and image references are also supported. Equations become editable OMML objects rather than raster images or literal source text.

Before export, validation checks the formatting contract, styles, citation syntax, and structural issues such as unclosed mathematical expressions or incomplete table rules. Errors include source line numbers to help an agent correct the manuscript and retry. Post-export checks compare expected content and styles against the generated document.

## Setup and configuration

For MCP use, configure a client to launch `uvx` with the `md-to-word-docx[mcp]` package and the `md-to-word-mcp` entry point:

```json
{
  "mcpServers": {
    "md-to-word": {
      "command": "uvx",
      "args": ["--from", "md-to-word-docx[mcp]", "md-to-word-mcp"]
    }
  }
}
```

`uvx` downloads dependencies into an isolated environment on first use. A local Python installation is another option: install the package with its MCP extra and start the module through Python. The local compiler requires Python 3.10 or newer.

For direct command-line use, install `md-to-word-docx`, initialize an example project if needed, and run the compiler with an explicit Markdown input, output path, and format file. A preset can be selected for preview when no format contract is available. Python applications can call the `export` function and inspect its success status and error collection.

## Tools and capabilities

The MCP interface exposes these operations:

- `compile_markdown` compiles Markdown text or a file path into `.docx`, with optional PDF conversion.
- `validate_manuscript` performs preflight checks before generation.
- `get_guide` returns the workflow guidance embedded with the package.
- `get_manual` returns the full formatting vocabulary and usage reference.
- `extract_format_from_docx` creates a draft `format.txt` from a Word template.
- `list_presets` lists available formatting presets.
- `inspect_preset` shows the detailed rules for a selected preset.

Document features include editable OMML equations with numbering and cross-references, repeated table headers across pages, multiple table-border styles, captions, image sizing, footnotes, hyperlinks, inline formatting, bibliography files with CSL styles, section-specific page numbering, and generated table-of-contents fields.

## Limitations and notes

A preset is suitable for previewing output when no formal specification exists; final delivery should follow the applicable template or formatting rules. Template extraction can produce entries that require confirmation. The compiler depends on the manuscript following its formatting contract, so malformed markers or incomplete syntax should be corrected through validation before export.

_Full upstream README: https://allmcps.com/mcp/md-to-word/readme_

