How to annotate documents with AI agents using MCP
Leave feedback
On this page
Annotating with an AI agent works because the two halves do what each is good at: the agent understands “flag anything that shifts risk to us”, and the engine writes a real annotation into a real document, locally.
Note
The commands and config snippets on this page are for the .NET build of the server — the only platform available today. Installation and client setup: MCP server for .NET. Other platforms will expose the same tools with their own launch command; everything else on this page applies unchanged.
The pattern
Put the document in the storage folder the server can see, and point GROUPDOCS_MCP_OUTPUT_PATH at a different folder for the results.
Ask in plain language: “Highlight the payment clause on page 2 and add a note asking legal to confirm.”
The agent calls add_annotation with the type, text, page, and position.
The engine writes contract_annotated.pdf to your output folder — the original is never modified.
Optionally the agent calls generate_pages_preview and looks at the result (not for PDF files on Linux or in Docker — see Look first below).
The one thing that trips people up
Every writing tool saves a new file named <name>_annotated.<ext>. So a second annotation must be applied to that file, not to the original — otherwise the first annotation is silently left behind in a file nobody opens again.
A well-instructed agent chains them:
Highlight the payment clause, then on the resulting file strike out the old delivery date, then show me page 2.
If you are scripting the calls yourself, pass the file name returned by the previous call. If an annotation “disappears”, this is almost always why.
Placement, honestly
x/y are document coordinates. An agent asked to “highlight the payment clause” has to guess where that clause is unless something tells it. Three ways to get placement right:
Read first — get_annotations returns bounding boxes of existing annotations to anchor against.
Look first — render the page with generate_pages_preview and let a vision-capable model locate the text. generate_pages_preview currently fails for PDF files on Linux, including the Docker image, with a TypeInitializationException for Gdip (System.Drawing.Common is not supported on non-Windows platforms); Word and other Office documents render, and on Windows with dnx every format renders. The other 10 tools are unaffected.
Check after — annotate, render, and let the agent adjust with update_annotation if the box landed badly.
Use get_document_info for the page box before placing anything near an edge.
Set GROUPDOCS_MCP_OUTPUT_PATH to a folder other than the storage folder before chaining edits on a produced file (configuration). With the default — outputs land in the storage folder — the second write fails with being used by another process; with a separate output folder add_reply, update_annotation and remove_annotations on the produced file all succeed.