Skip to main content
A local ONLYOFFICE Docs editor with a Vespper chat plugin, connecting a Mastra agent to Vespper through the Vespper TypeScript SDK. It offers the same chat experience as the Word add-in example.

What the example includes

  • Streamed edits
  • Suggestion cards to review edits before applying them
  • Tracked changes
  • Selected-text context
  • Pasted image context
  • Multi-model selection

Demo

Prerequisites

  • Node.js 22.13 or newer
  • Docker Desktop, running. The ONLYOFFICE Document Server runs in a container.
  • Port 80 free on your machine. The Document Server must be reachable at the same address from the browser and from inside its container.
  • A Vespper account
  • A model-provider API key for OpenAI, Anthropic, or Google

Set up the add-in

1

Get a Vespper API key

Sign up for Vespper, then create a key on the API keys page. Copy the sk_live_... secret immediately; it is shown only once.
2

Install the example

Clone the repository, then install the dependencies:
Edit .env and add your Vespper key plus the key for the model provider you want to use:
.env
Only one model-provider key is required:OpenAI GPT 5.6 Sol is the default. To start with another model, set ONLYOFFICE_AGENT_MODEL in .env, for example:
.env
By default, the agent proposes edits as suggestion cards that you accept or reject. To have it apply edits to the document as it writes them, set:
.env
3

Run it

This starts the ONLYOFFICE Document Server in Docker, builds the plugin, and starts the local server at http://localhost:3101. The first run pulls the Document Server image, so it can take a few minutes before the editor loads.Open http://localhost:3101. The Vespper plugin starts automatically; click the V icon on the left if its panel is collapsed. Drag the panel’s edge to widen it (up to 600 px).To verify configuration, open http://localhost:3101/health. Both vespperConfigured and agentConfigured should be true.Stop the Document Server with:

Try an edit

  1. Open http://localhost:3101. A welcome document is loaded the first time. To edit your own file, use Open .docx above the editor.
  2. Open the Vespper panel.
  3. Ask for an edit.
  4. Optionally select document text or paste images into the prompt.
That’s it. You should see the document being changed. The plugin follows the editor’s Track Changes setting. When it is on, new edits are recorded as tracked changes. When it is off, they are applied directly. The settings button lets you change the tracked-change author used in tracked mode from the default Vespper Agent. The open document is stored at data/document.docx. Opening a file replaces it and starts a fresh editing session. To get the welcome document back, stop the app and delete that file.

Development commands

Project layout

Security

.env is ignored by Git. Vespper and model-provider keys are read only by the local Node.js server and are never bundled into the plugin. This example is intentionally local and disables ONLYOFFICE JWT validation. Do not expose it directly to a network. A production deployment should enable JWT, authenticate the app routes, restrict the download proxy, and define a multi-user document versioning strategy.

View the complete example on GitHub

Browse the source code, plugin manifest, and standalone README.