
docx4j Word documents
io.github.plutextPublished by GitHub account plutextv0.2.0Updated Oct 24, 2026
Read, convert and fill Word (.docx) documents: templates, Markdown/HTML in and out, PDF with math.
Overview
Lets an assistant read, convert, and fill Word .docx documents, including templates, Markdown, HTML, and PDF output.
- What you can do
- Wraps the docx4j engine to expose Word document handling to an MCP client. Tools include describe_template and fill_template for OpenDoPE or mail-merge templates, convert_to_pdf, markdown_to_docx, docx_to_markdown, html_to_docx, convert_to_html, and extract_text. Math is supported end to end: TeX and MathML become editable Word equations and render in PDF and HTML output.
- When to use it
- Useful when an assistant needs to work with Word files: filling contract or letter templates, converting between docx, Markdown, HTML, and PDF, or extracting text from documents. It fits desktop workflows where documents live in local folders the server is allowed to touch.
- Requirements
- Runs locally over stdio and needs Java 17+ on the PATH. It can be installed as an .mcpb bundle, a jar, an OCI image, or a Claude Code plugin. At least one --root directory must be given or the server refuses to start; the plugin uses DOCX4J_MCP_JAR and optionally DOCX4J_MCP_ROOTS. No authentication or API keys are declared.
Installation
In SourceWeft
- Open docx4j Word documents in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
docx4j-mcp
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.1.0 (the server versions independently; the bundled docx4j version is in the pom, the server's startup log, and its MCP instructions).
MCP protocol: 2025-11-25 (Java SDK 2.0.1, the newest available). Clients
speaking the 2026-07-28 spec work if they implement its dual-era fallback: the
server/discover probe gets a clean JSON-RPC -32601 and the client falls
back to initialize (verified over stdio). A modern-only client with no
fallback cannot connect until the SDK's 2026-07-28 support (milestone 2.2)
ships, at which point this server will migrate.
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.
Build
Requires JDK 17+. All docx4j dependencies (docx4j 17.1.0, ImportXHTML 17.0.4) come from Maven Central.
Run
Bare directory arguments are also accepted as roots (this is what the .mcpb
bundle's folder picker passes).
Claude Desktop, one click
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.
Docker
(paths in tool calls are then container paths under /data;
packaging/docker/Dockerfile to build locally).
Claude Code plugin
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.
Releasing
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.
Claude Code (.mcp.json in your project)
Claude Desktop (claude_desktop_config.json)
Tools
Mathematics is supported end to end: 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.
Example (Claude Code)
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.
Licence
Apache License 2.0.
Source: README.md at commit 58f53b1
Tools
0Version history
1- v0.2.0LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.