Skip to main content
Connect your agent to read and edit Word documents in less than 5 minutes.
1

Get your API key

Create a key on the API keys page - the secret is shown only once, so copy it right away.
2

Set API keys

Create the project directory and a .env file:
Put the API keys inside .env. This guide uses GPT 5.5 to edit the document, but you can use another model provider:
.env
3

Download the sample document

The examples edit a local Word file. Download it into vespper-quickstart.Download sample.docx
4

Integrate

Every example uses the Vespper SDK to open and close its document session. Auto-patching also injects MCP metadata and retains the latest DOCX for you.
Your framework runs the agent loop. Open one document session, wire in the read_document, search_document, and edit_document tools, then close the session when the run finishes.
1. Install - add the packages for this stack:
Requirement: Mastra requires Node.js 22.13.0 or newer.
2. Add the code - move your sample.docx into the folder, create main.ts, and paste:
Use the tool descriptions returned by the Vespper MCP. Don’t replace them with your own; they carry the editing rules the model needs to do well.
3. Run - this writes sample-redlined.docx with the edit as a tracked change: