Read, convert and fill Word (.docx) documents: templates, Markdown/HTML in and out, PDF with math.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A Model Context Protocol server that exposes docx4j's engine to AI agents: read, convert and fill Word (.docx) documents from Claude Desktop, Claude Code, or any MCP client.
Engine: docx4j 17.0.4 (the server versions independently; the bundled docx4j version is in the pom, the server's startup log, and its MCP instructions).
Status: phase 3 β all tools work over stdio against released docx4j 17.0.4;
packaged as a runnable jar, an .mcpb bundle, an OCI image and a Claude Code
plugin. The plan, tool surface and phasing are in CR-mcp-server.md.
Requires JDK 17+. All docx4j dependencies (17.0.4) come from Maven Central.
Bare directory arguments are also accepted as roots (this is what the .mcpb
bundle's folder picker passes).
Install docx4j-mcp.mcpb from the GitHub release (Settings β Extensions), pick
the folders the server may touch, done. Built locally with
packaging/build-mcpb.sh. Requires Java 17+ on your PATH.
(paths in tool calls are then container paths under /data;
packaging/docker/Dockerfile to build locally).
packaging/claude-plugin/ bundles the server config and a skill for the
template/authoring workflows. Set DOCX4J_MCP_JAR (path to the jar) and
optionally DOCX4J_MCP_ROOTS.
Tag vX.Y.Z: .github/workflows/release.yml builds jar + mcpb, attaches them
to the GitHub release, pushes ghcr.io/plutext/docx4j-mcp, and publishes
server.json (sha filled in) to the official MCP registry via GitHub OIDC.
Every file path an agent passes must resolve inside one of the --root
directories (symlinks are resolved first). There is no default root; the server
refuses to start without one. Logging goes to stderr; stdout is the protocol.
Tools that return text inline cap it at --max-inline-chars (default 200000) and
otherwise write to output_path or truncate with a marker.
.mcp.json in your project)claude_desktop_config.json)| Tool | What it does |
|---|---|
describe_template | What data a template wants: skeleton XML + xpaths/conditions (OpenDoPE, bound content controls) or MERGEFIELD names and format switches (mail merge). Call before fill_template. |
fill_template | Fill a template, preserving its formatting. data is an XML string (OpenDoPE / bound controls; repeats and conditions processed) or a JSON object (mail merge). |
convert_to_pdf | docx β PDF via XSL-FO / Apache FOP; reports font substitutions. Bundles metric-compatible fonts (Carlito, Caladea, Liberation, Tinosβ¦). |
markdown_to_docx | Markdown β properly styled docx (headings, numbering, GFM tables, footnotes, task lists, TeX math). Optional styles_template_path. |
docx_to_markdown | docx β Markdown (structure preserved). Options: tracked_changes accept/markup, image_dir_path. |
html_to_docx | HTML β docx via docx4j-ImportXHTML. Loose HTML accepted (normalised with jsoup); h1βh6 map to heading styles; optional styles_template_path; mode: altchunk embeds the HTML for Word to convert on open. Remote images/stylesheets are never fetched. |
convert_to_html | docx β standalone HTML (visitor exporter; image_dir_path for images). |
extract_text | Plain text, one line per paragraph/table. |
Mathematics is supported end to end (docx4j 17.0.4): TeX math in Markdown
($..$) and MathML in HTML become real, editable Word equations (OMML), and
equations render in PDF (via jeuclid/FOP, no LaTeX toolchain) and HTML (native
MathML, no JavaScript) output. Known limitation: a very long single display
equation is one atomic graphic in PDF and does not line-wrap.
Writers take output_path and refuse to overwrite unless overwrite: true.
Use describe_template on contracts/nda-template.docx, then fill it for Acme Pty Ltd and write contracts/nda-acme.docx, then convert that to PDF.
The agent gets the skeleton XML (or MERGEFIELD names), fills it, and calls
fill_template and convert_to_pdf; the results tell it what was written and which
fonts were substituted.
Apache License 2.0.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/docx4j-word-documents)<a href="https://allmcps.com/mcp/docx4j-word-documents"><img src="https://allmcps.com/api/badge/docx4j-word-documents?style=directory" alt="Docx4j Word documents on AllMCPs" /></a>