{
  "markdown": "# mcp-docx\n\n<!-- mirror-seo:start -->\n\n**MCP server for Word documents: creating docx files, and create a Word document from a chat.** Real Word documents from chat: proposals, contracts, quotes.\n\nWorks with Claude Desktop, Claude Code, Cursor and any Model Context Protocol client. Runs on your own machine, or hosted with no install.\n\n## Install\n\n**Hosted, nothing to install.** Get a token from <https://mcp.zovo.one/mcp/connect> (the connect page) or <https://mcp.zovo.one/mcp/token> (the same token as JSON); a free anonymous one is issued on the spot and a Pro key works the same way. Then point an MCP client at `https://mcp.zovo.one/mcp/docx` over streamable-http and send the token as `Authorization: Bearer <token>`.\n\nIf your client cannot set headers, put the token in the path instead: `https://mcp.zovo.one/mcp/docx/t/<token>`. Both forms work. The bare URL with no token answers 401 on `tools/call`, so the token is not optional.\n\n**Claude Desktop, one click.** Download `docx.mcpb` from the [latest release](https://github.com/theluckystrike/mcp-servers/releases/latest) and double-click it.\n\n**From source.** The mirror is self-contained: every `@theluckystrike/*` dependency is vendored, so a fresh clone builds with no extra setup.\n\n```sh\ngit clone https://github.com/theluckystrike/mcp-docx.git\ncd mcp-docx\nnpm install && npm run build\n```\n\nThen point your client at the built entry point:\n\n```json\n{\n  \"mcpServers\": {\n    \"docx\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/mcp-docx/dist/index.js\"]\n    }\n  }\n}\n```\n\n> `@theluckystrike/mcp-docx` is **not published on npm yet**, so an `npx -y @theluckystrike/mcp-docx` command will fail. The three paths above are the working ones and each is exercised by CI.\n\n![docx demo](https://raw.githubusercontent.com/theluckystrike/mcp-servers/main/assets/demo-docx.gif)\n\nRead-only mirror of [mcp-servers/servers/docx](https://github.com/theluckystrike/mcp-servers/tree/main/servers/docx). See [MIRROR.md](MIRROR.md).\n\n<!-- mirror-seo:end -->\n\nSay \"write a proposal for Beta Corp, checkout rebuild, 4,500 EUR, three phases\" and get a real `.docx` you can send. This MCP server writes Word documents from chat -- proposals, quotes, service agreements, statements of work and letters -- with your letterhead, headings, bullet and numbered lists and tables. It also turns markdown into `.docx`, reads an existing `.docx` back as text and outline, and fills `{{placeholders}}` in a template you already use, keeping every style, table, header and image of the original. Everything runs locally: no upload, no account, no native dependency.\n\n\n**Real Word documents from chat -- proposals, contracts and letters, without a template site or an office subscription.**\n\n## 60-second install\n\nnpm publish for `@theluckystrike/mcp-docx` is pending. Until then, the `.mcpb` one-click bundle or a clone+build\nis the working path -- both are verified below.\n\n**One-click (.mcpb):** download `docx.mcpb` from the latest release and double-click it in Claude Desktop:\nhttps://github.com/theluckystrike/mcp-servers/releases/latest\n\n**Claude Desktop** (`claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"docx\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@theluckystrike/mcp-docx\"]\n    }\n  }\n}\n```\n\n**Claude Code:**\n\n```sh\nclaude mcp add docx -- npx -y @theluckystrike/mcp-docx\n```\n\n**Cursor** (`.cursor/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"docx\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@theluckystrike/mcp-docx\"]\n    }\n  }\n}\n```\n\nThe `npx` form above starts working the moment the package is published. Until then, use the .mcpb bundle above, or\nbuild from source with exactly these three commands:\n\n```sh\ngit clone https://github.com/theluckystrike/mcp-servers.git && cd mcp-servers\nnpm install\nnpm run build -w packages/mcp-license -w servers/docx\n```\n\nThen point your client's `command` at `node` with one arg: the absolute path to `servers/docx/dist/index.js`.\n\nTo run in Pro mode set `MCP_LICENSE_KEY` in the same config block, or call `license_activate` once with your key.\n\n## Tools\n\n| Tool | What it does |\n| --- | --- |\n| `business_set` | Store the sender profile printed on every document: name, address, email, VAT id, IBAN, bank, logo, letterhead colour, default currency, tax rate, payment terms. Same field set as [mcp-invoice](../invoice), so one profile serves both |\n| `doc_create` | Write a `.docx` from sections: headings, paragraphs, bullet lists, numbered lists and tables. Layouts: `plain`, `letter` (sender block, date, addressee) and `proposal` (letterhead band, cover title) |\n| `doc_from_markdown` | Markdown to `.docx`: ATX headings, paragraphs, bullet and numbered lists (indentation kept, up to Word's nine levels), GFM pipe tables, fenced code blocks as monospace, and `**bold**` / `*italic*` / `` `code` `` inline |\n| `doc_read` | Extract text, headings with levels, list items and tables from any existing `.docx`, in document order. `format: \"json\"` returns the block structure |\n| `doc_to_html` | Convert a `.docx` to semantic HTML with a print stylesheet. This is the PDF route -- see the note below |\n| `doc_fill_template` | Replace `{{placeholders}}` in a `.docx` and write a new file, keeping every style, table, header, footer and image. Called with no `values`, it lists the placeholders the template contains |\n| `proposal_create` | A client-ready proposal: summary, scope, deliverables, timeline table, price, terms, validity and signature block, with a reference number that is never reused |\n| `proposal_update` | Rewrite an existing proposal in place from its reference: only the fields you pass change, the rest comes from the structured data stored with the document, and the file and reference number stay the same |\n| `contract_create` | A plain freelance service agreement skeleton: parties, services, term, fee, IP, confidentiality, contractor status, termination, liability, governing law. A template with labelled placeholders for a lawyer, not legal advice |\n| `license_status` | Show free or Pro mode |\n| `license_activate` | Activate a Pro key (verified offline) |\n\nResource: `docs://recent` returns the last 25 documents written, newest first, with kind, client, reference and path.\nPrompt: `write_proposal_from_hours` turns tracked hours (or an `invoice_summary` from [mcp-time-tracker](../time-tracker)) into a priced proposal.\n\n## There is no `doc_to_pdf`, and that is deliberate\n\nEvery pure-JavaScript path from Word to PDF needs either a native dependency (LibreOffice, a Chromium binary, a C++ rendering library) or a cloud API. This collection ships neither, so `npx` works on any machine with Node and nothing else. `doc_to_html` writes semantic HTML with a print stylesheet instead: open it, print to PDF, and the result is what you would have got. The tool description and the tool's own answer say the same thing, so the model does not promise a PDF it cannot produce.\n\n## What you can say\n\n| You say | Tool |\n| --- | --- |\n| \"Set up my letterhead: Acme Consulting, 1 Road Warsaw, VAT PL1234567890.\" | `business_set` |\n| \"Write a proposal for Beta Corp: checkout rebuild, 4,500 EUR, 50/50, three phases.\" | `proposal_create` |\n| \"Draft a service agreement with Beta Corp, 3,000 EUR monthly, starting October.\" | `contract_create` |\n| \"Turn these meeting notes into a Word document.\" | `doc_from_markdown` |\n| \"Write a letter to Beta Corp with an agenda for Tuesday.\" | `doc_create` with `style: \"letter\"` |\n| \"What does this proposal.docx actually say?\" | `doc_read` |\n| \"Fill my NDA template with this client's details.\" | `doc_fill_template` |\n| \"Give me a printable version of that document.\" | `doc_to_html` |\n\n## Worked example\n\n```\nYou: Write a proposal for Beta Corp. Checkout rebuild, 4,500 EUR, 50% on\nsignature 50% on delivery, three phases: discovery 1 week, build 3 weeks,\nlaunch 1 week. Valid until the end of the year.\n\n  proposal_create {\n    client: \"Beta Corp\", project_title: \"Checkout rebuild\",\n    summary: \"Beta Corp loses orders at checkout. This project rebuilds it.\",\n    scope: [\"Audit the current funnel\", \"Rebuild the checkout\", \"Ship and measure\"],\n    deliverables: [\"New checkout in production\", \"A one-page handover\"],\n    timeline: [{phase: \"Discovery\", duration: \"1 week\"},\n               {phase: \"Build\", duration: \"3 weeks\"},\n               {phase: \"Launch\", duration: \"1 week\"}],\n    price: {amount: 4500, currency: \"EUR\", terms: \"50% on signature, 50% on delivery\"},\n    valid_until: \"2026-12-31\"\n  }\n  -> PROP-2026-0001, EUR 4,500.00\n  -> ~/.local/share/mcp-servers/docx/documents/checkout-rebuild.docx\n```\n\nThe file opens in Word, Pages, LibreOffice and Google Docs: letterhead, cover title, \"Prepared for Beta Corp\",\nSummary, Scope of work, Deliverables, a Timeline table, an Investment table with `EUR 4,500.00`, the payment\nterms, and a signature block for both parties. Every amount carries its currency code -- no bare numbers.\n\n## Free vs Pro\n\n| | Free | Pro |\n| --- | --- | --- |\n| `doc_create`, `doc_from_markdown`, `doc_read`, `doc_to_html` | Unlimited | Unlimited |\n| `proposal_create`, `contract_create` | 3 per calendar month, combined | Unlimited |\n| `doc_fill_template` | Templates with up to 10 placeholders | Any template |\n| Footer | Carries \"Generated with mcp-docx by theluckystrike\" | No branding |\n| Letterhead logo and colour | Default colour, no logo | Your `logo_path` and `brand_color` |\n| Tables, lists, letter and proposal layouts, reference numbering | Yes | Yes |\n\nPro is a one-time $19, or $39 for every server in the collection, lifetime.\n\n**Get Pro: https://mcp.zovo.one/buy/docx**\n\n## How the .docx is produced and read\n\nDocuments are written with [`docx`](https://www.npmjs.com/package/docx), a pure-JavaScript OOXML writer -- no native module, no headless browser, no office install.\n\nReading and template filling use no dependency at all. A `.docx` is a ZIP, so `node:zlib` opens it and a small WordprocessingML walk pulls out paragraphs, heading levels (from `w:pStyle`), list items and tables in document order. Numbered lists are told apart from bullets by resolving each paragraph's `w:numId` against `word/numbering.xml`, which is the only place that distinction is recorded -- without it every numbered list reads back as bullets.\n\nTemplate filling substitutes on the **joined text of each paragraph**, not per run. Word routinely breaks a placeholder you typed as `{{client}}` into three runs (`{{cli`, `ent}}`, ...) after an edit or a spell-check pass, and per-run replacement silently misses those -- the document comes back with the placeholder still in it. The replaced text goes into the first run, keeping its formatting, and the remaining runs of that paragraph are blanked. Every other part of the package is copied byte-for-byte, so styles, images, headers, footers and section setup survive. A placeholder with no value is left in place and reported, never blanked.\n\n## Existing files are never overwritten\n\nEvery tool that writes a file (`doc_create`, `doc_from_markdown`, `doc_to_html`, `doc_fill_template`,\n`proposal_create`, `contract_create`) refuses an `out_path` that already exists and tells you so:\n\n```\nError: /path/acme-proposal.docx already exists and nothing was written.\nPass overwrite: true to replace it, or give a different out_path.\n```\n\nThe path is reserved with an exclusive create, not an existence check, so two processes writing the same\n`out_path` at the same time cannot clobber each other: one wins, the other is refused and writes nothing.\n\nWhen you do not pass an `out_path`, the file name is derived from the title, and a derived path never\nlands on an earlier document: a second proposal with the same title is written as `...-2.docx`. To change\na proposal you already sent, use `proposal_update {reference}` instead: it rewrites the same file from the\nstored structured data and keeps the reference number.\n\nThe check runs before anything is built or written, so a refused call leaves the disk untouched and burns\nno reference number. Pass `overwrite: true` when replacing the file is what you want.\n\n## Characters Word cannot carry\n\nXML 1.0 allows TAB, LF and CR but no other control code. Every string that reaches `word/document.xml`\nis cleaned first: control codes and unpaired surrogates are removed, literal `\\n` escapes become real\nparagraph breaks, and stray whitespace collapses. When something was removed the tool says so in its\nanswer instead of handing you a file Word would offer to repair.\n\n## How it stores data\n\nThe business profile, the document register and the reference counter live under\n`${XDG_DATA_HOME:-~/.local/share}/mcp-servers/docx/` as plain JSON, plus a `documents/` subfolder holding the\ngenerated files when you do not pass `out_path`. Every mutating call runs inside an advisory lock on\n`.../docx/.lock`, so two clients on one data directory cannot allocate the same reference number or lose a\nrecord. Saves go to a temporary file and are renamed into place.\n\nIf one of those JSON files is unreadable or not valid JSON, it is never treated as \"empty\". The file is moved\naside byte-for-byte as `<name>.json.corrupt-<timestamp>`, a `<name>.json.corrupt` marker is written, and every\ntool returns `data file is corrupt; moved to ...; nothing was written` until you restore a good copy and delete\nthe marker.\n\nReference numbers are `PROP-YYYY-NNNN` for proposals and `AGR-YYYY-NNNN` for agreements. The counter is written\nbefore the record is stored, so a crash burns a number rather than reusing one, and existing numbers are scanned\nso a restored register can never hand back a reference that is already on a sent document.\n\n## Limits and honest caveats\n\n- No PDF output. Use `doc_to_html` and print. See the section above for why.\n- `doc_read` reads `.docx` only. Legacy `.doc`, `.rtf` and Pages files are refused with a message that says so.\n- `doc_read` extracts text structure: headings, paragraphs, lists and tables. It does not report fonts, colours,\n  comments, tracked changes, footnotes or embedded images.\n- `doc_fill_template` keeps the first run's formatting for the whole paragraph it rewrites. A paragraph that mixes\n  bold and regular text around a placeholder comes back in the first run's formatting.\n- `contract_create` writes a drafting skeleton with `[BRACKETED PLACEHOLDERS]` and says on the document itself that\n  it is a template and not legal advice. Nothing here has been reviewed by a lawyer in any jurisdiction.\n- The free-tier limit of 3 counts proposals and contracts together, per calendar month, and resets on the 1st.\n  Everything else stays unlimited when it closes.\n\n## Privacy\n\nAll data stays local. The server reads and writes files on your machine, stores its register under your data\ndirectory, and makes no network request of any kind -- not for licensing (keys are verified offline), not for\nfonts, not for telemetry.\n\n## Pairs with\n\n- [mcp-invoice](../invoice/README.md) -- same `business_set` profile shape; the proposal you accepted becomes the invoice you send.\n- [mcp-time-tracker](../time-tracker/README.md) -- the `write_proposal_from_hours` prompt turns `invoice_summary` hours into a priced proposal.\n- [mcp-expense-tracker](../expense-tracker/README.md) -- quote a project with its pass-through costs already counted.\n- [office-suite](../office-suite/README.md) -- several servers behind one install, one config entry.\n\n## Troubleshooting\n\n- **`npx` hangs or fails to find the package**: npm publish for this package is pending. Use the `.mcpb` bundle or\n  the clone-and-build path above until it lands.\n- **\"Wrote ... .docx\" but Word will not open it**: check the path is not inside a synced folder that was still\n  uploading. The file is complete when the tool returns; nothing is written incrementally.\n- **A placeholder did not get replaced**: call `doc_fill_template` with no `values` to list what the template\n  actually contains. Names are matched exactly, whitespace inside `{{ }}` is ignored, and the response names every\n  key you passed that the template does not have.\n- **The letterhead shows \"Your business\"**: run `business_set` once. Documents are never blocked by a missing\n  profile; the response says the sender block is a placeholder.\n- **No logo on the document**: the logo is a Pro feature, and `logo_path` must exist and be a PNG, JPG or GIF.\n- **Node version**: requires Node >= 18. Check with `node -v`.\n\nMIT licensed. Support: support@zovo.one\n\nBuilt by [theluckystrike](https://github.com/theluckystrike).\n\n## One business profile for the whole suite\n\nYour identity is stored once, at `${XDG_DATA_HOME:-~/.local/share}/mcp-servers/profile/business.json`,\nand every server in the suite reads it: the invoice issuer, the docx letterhead, the recurring\nissuer, expense-tracker's default VAT rate, time-tracker's and timezone's home zone, and the\nresume and contract letterheads. Set it once with `business_set` (invoice or docx) - you never\nrepeat it anywhere else. An email address is only ever taken from that profile or from an explicit\nargument; when none is stored, documents show `[add: email]` and the tool says so rather than\nletting anyone improvise an address.\n",
  "bytes": 17164,
  "sha": "dfa54e4d2c929fdeb4c53bd8ab94f5fb103ab93c52850b4cc1f7d0ef7d3424dc",
  "repo_slug": "theluckystrike/mcp-docx",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_theluckystrike_mcp_docx_3c6a6fad/readme"
}