Skip to main content
Get an API key from the developer dashboard, then connect the hosted vespper-docx-mcp server.
The MCP tool descriptions carry the editing rules: complete HTML-block anchors, lazy classes, batching, and Word tracked-change semantics. Use tools/list descriptions instead of copying those rules into your own prompt.

1. Get a key

Create a key in the developer dashboard. Keys start with sk_live_; keep them secret and use them only from server-side code, local tools, or agent config.

2. Connect MCP

Put a local Word file named sample.docx beside the example script or in the folder opened by your agent, then try:
Read sample.docx, then add the word hello to the end of the document.

3. Pick your stack

SDKs and frameworks own the agent loop. The important part is to expose the MCP-discovered read_document and edit_document tools to the model and preserve their descriptions.

OpenAI Agents SDK

Save as main.py beside sample.docx, then run it with VESPPER_API_KEY set.

Mastra

Vercel AI SDK

Tool workflow

There is no server-side document session. Pass the current document bytes on every call. After edit_document, continue with the returned base64 or decode it to save a .docx.

Editing rules

  • Call read_document first and copy old anchors from its exact HTML.
  • Prefer one complete block (<p>, <li>, heading, row) per edit.
  • Use class="..." in old and new to keep existing classes unless changing the class is the edit.
  • Batch independent edits in one edit_document call; they reconcile in parallel.
  • If an edit fails, nothing is applied. Fix the listed edit and resend the whole batch.
  • Successful edits remain visible as tracked changes until a human accepts or rejects them in Word.

Next steps

MCP server

Endpoint, tools, and connection details.

Authentication

API key handling and security notes.