“Rename ACME Corp to Globex in this contract” is a three-second job for a person and a trap for an AI agent. The obvious route, read the document and write a new one, throws away the styles, the table borders, the headers and the reviewer’s confidence that nothing else moved. With the GroupDocs.Editor MCP server running locally, Claude, Cursor or Copilot edits the file instead of retyping it: it finds the words, replaces them in place, keeps the formatting, and tells you how many it changed:

Rename ACME Corp to Globex Ltd in contract.docx and keep the formatting.

The step-by-step version with setup, prompts and troubleshooting is in the documentation: How to edit documents with AI agents using MCP.

What goes wrong when the model rewrites the file?

A language model does not hold a .docx. It holds text. When you ask it to “update the contract”, the natural path is to read the words out, change them, and produce a new document from its own copy. Three things are lost on the way.

Formatting. Bold party names, numbered headings, table grid lines, the fee table’s column widths, the footer with the page numbers: none of that is part of the text the model read, so none of it survives the trip unless something rebuilds it.

Everything the model was not asked to touch. Regeneration means every sentence passes through the model again. A clause can be “tidied”, a number reformatted, a sentence dropped because the context window filled up. The reviewer now has to diff the whole document to trust a three-word change.

The audit trail. “I updated the contract” is the same reply whether the model changed one name or seven. There is no count, and no way to tell a careful edit from a confident one.

The DOCX-only editing servers that already exist solved the first problem for Word. The other two, and every format that is not Word, are still open.

What does a targeted edit look like?

Two calls. Captured from GroupDocs.Editor.Mcp 26.10.0 against a synthetic services agreement in which “ACME Corp” appears seven times:

-> get_document_info {"file":{"filePath":"contract.docx"}}
<- { "family": "WordProcessing", "pageCount": 1, "canEdit": true,
     "canSaveTo": [ "docx", "doc", "rtf", "odt", "pdf", "md", ... ] }

-> replace_text {"file":{"filePath":"contract.docx"},
                 "find":"ACME Corp","replace":"Globex Ltd","wholeWord":true}
<- Replaced 6 occurrence(s) of 'ACME Corp' in 'contract.docx'
   Saved to: …/contract_edited.docx

-> replace_text {"file":{"filePath":"contract.docx"},
                 "find":"Initech","replace":"Globex Ltd"}
<- Text replacement found no matches for 'Initech' in 'contract.docx'.
   No file was written.

The edited copy keeps the bold party name, the heading styles and the fee table. The original is untouched; the result is a new file, contract_edited.docx, in the storage folder.

Why six and not seven?

This is the detail worth reading twice. The seventh “ACME Corp” sits in the notices clause, where “ACME” is italic and " Corp" is not. In the file those are two formatting runs, and replace_text matches within one run. It did not guess, and it did not merge the styles to force a match; it reported six, and the seventh is still “ACME Corp”.

That is the behaviour you want from a tool that edits contracts. A count that is lower than you expected is a prompt to look; a silently “complete” rewrite is not. The agent can follow up with the other path the server offers: extract that part as HTML, edit it, and save it back. The round-trip post covers it.

The calls, in order

user              agent                        Editor MCP server
 |  "Rename ACME Corp to Globex Ltd in contract.docx"          |
 |---------------->|                                           |
 |                 |-- get_document_info {"file":...} -------->|
 |                 |<- WordProcessing, 1 page, canEdit --------|
 |                 |-- replace_text {"find":"ACME Corp",       |
 |                 |     "replace":"Globex Ltd",               |
 |                 |     "wholeWord":true} ------------------->|
 |                 |<- "Replaced 6 occurrence(s) ...           |
 |                 |    Saved to: .../contract_edited.docx" ---|
 |<- "6 changed; one more is split across formatting - check  |
 |    the notices clause. The original is kept."               |
      (a find that matches nothing: 'No file was written.')

Why this is more than a Word trick

The same call works on a worksheet, a slide, a PDF or a text file. In our test, "worksheet": 1 renamed the supplier on the budget’s summary sheet and left the other two sheets alone; "slide": 1 did the same on a review deck. "format": "pdf" edits and converts in one call, so “fix the name and send me a PDF” is one step. "regex": true handles patterns such as version strings.

Before editing, get_document_info tells the agent what it is dealing with: the family, the page, worksheet or slide count, whether the file is password-protected, and which formats it can save to. A cautious agent calls it first, and you can ask it to.

Setup

dnx GroupDocs.Editor.Mcp --yes

with GROUPDOCS_MCP_STORAGE_PATH pointing at the folder the agent may edit, or the Docker image ghcr.io/groupdocs-editor/editor-net-mcp. Per-client config is in the documentation hub. What changed in the engine itself is in the GroupDocs.Editor for .NET 26.6 release notes.

Honest limits

  • replace_text matches within one formatting run; a phrase split across styles is not found, and the count shows it.
  • No tracked changes and no comments: the result is an edited copy, not a redline.
  • Evaluation mode: every output starts with an evaluation banner line, saved workbooks gain an extra worksheet, and only the first two worksheets or slides can be edited. The server refuses the third and says why.
  • PDF editing is a conversion to editable HTML or Word and back; it is not in-place PDF editing.

FAQ

Will the agent overwrite my original file? No. Every edit writes a new file, <name>_edited.<ext> by default or the outputName you give, into the storage folder.

What happens if the text is not in the document? Nothing is written. The server replies “found no matches … No file was written.”, so the agent can tell you rather than hand back an unchanged copy.

Does it work without Word installed? Yes. The server runs locally with the GroupDocs.Editor engine; no Office installation and no upload.

Go deeper