Skip to main content
Glama
@vatsonai/office-mcp

@vatsonai/office-mcp

by clausis-ai

Vatson Office

Word, Excel, PowerPoint and CSV files for AI agents, and reading them back as text.

Licence: Apache-2.0 npm: @vatsonai/eve-office CI

A model writes a typed spec. The engine checks it and builds a real Office file: live formulas, native charts, real heading styles and Word numbering. The model gets back the file path and a short list of findings, so it can fix the spec and try again. Attachments go the other way: an Office file in, plain text out, with hidden content marked.

Add it to your agent in one line

No API key, no account. The server runs on your machine and saves files to ./office-output.

Agent

Run this

Claude Code

claude mcp add office -- npx -y @vatsonai/office-mcp

Codex CLI

codex mcp add office -- npx -y @vatsonai/office-mcp

VS Code

code --add-mcp '{"name":"office","command":"npx","args":["-y","@vatsonai/office-mcp"]}'

Cursor

Add to Cursor

VS Code (button)

Install in VS Code

Claude Desktop and others

add "office": { "command": "npx", "args": ["-y", "@vatsonai/office-mcp"] } under mcpServers (details)

Or paste this to your agent and let it set itself up:

Add the MCP server "office" (command: npx -y @vatsonai/office-mcp) to your MCP settings.
Use it whenever I ask for an Excel, Word, PowerPoint or CSV file, or to read one.

Then ask for a file: "Make me a 12-month cash-flow plan as an Excel workbook with a chart."

How it works: the model writes a spec, office-spec checks it, office-compile builds the file and sends findings back; office-read turns attachments into text

The tools come as an eve extension, an MCP server and AI SDK tools, all running the same code.

Demo: a fresh eve agent adds the extension from the registry, is asked for a workbook, and the .xlsx it made is shown as LibreOffice renders it

The demo is recorded by scripts/demo/record.mjs from a real run: a scripted model stands in for the LLM, and the registry and npm were local stand-ins when it was recorded.

Related MCP server: docx-forge-mcp

What the files look like

Three example specs, compiled and rendered with LibreOffice (pnpm samples; the files are in docs/assets/samples/files).

The other slides of the deck: title, timeline, next steps.

Match an existing file

Give the tools an example file and the new file takes its look. A .pptx template brings its theme, slide master, layouts and slide size; our slides fill the layouts' placeholders. A .docx template brings its styles, list numbering, table style, page setup, header and footer. A .xlsx template brings its theme, default font, header style, cell styles and table style. None of the example's text or data is copied.

The same deck spec, without and with a dark .pptx template. In eve, extract_style reads the example first and returns plain rules for the writing too (sentence length, heading case, bullet form, register); the create tool then checks the new text against them. In code:

const deck = await buildDeck(spec, { template: await readFile("our-template.pptx") });
const rules = describeStyle(extractStyle(await readFile("last-report.docx")));

Not copied: the example's slides, body text, images, comments and document properties; slide transitions; Word content controls and fields other than page numbers; Excel sheets, data, defined names, conditional formats and macros.

Example files

Open real files the tools made, with a preview of every page: workbooks, decks, documents and a CSV, some from hand-written specs and some written by a model from a short brief. See the example files gallery.

Use with eve

@vatsonai/eve-office is an eve extension: eleven tools and one skill.

npm i @vatsonai/eve-office

Mount it in your agent. The file name is the mount prefix, so the tools appear as office__create_workbook and so on.

import office from "@vatsonai/eve-office";

export default office({
  locale: "en-US", // used when a spec names no locale
  recalc: "auto", // fill formula results with LibreOffice or IronCalc
  markHidden: true, // read_text marks hidden sheets, rows, slides and comments
});

Every option is optional; export { default } from "@vatsonai/eve-office"; mounts it with the defaults. All options: eve-office README. No API key, no environment variable, no external service.

Coming soon: let eve write the mount file from this project's registry (eve add @vatsonai/office, see docs/registry.md).

Use with MCP

@vatsonai/office-mcp is an MCP server with the same eleven tools and the guidance as the prompt office-files. It writes files to a folder and returns their paths.

Claude Code:

claude mcp add office -- npx -y @vatsonai/office-mcp

Claude Desktop (claude_desktop_config.json) and Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "office": {
      "command": "npx",
      "args": ["-y", "@vatsonai/office-mcp", "--out", "/Users/you/Documents/office-output"]
    }
  }
}

stdio by default; --http serves Streamable HTTP on 127.0.0.1 with an optional bearer token. Options, file hand-over and security: office-mcp README.

Use with the AI SDK

@vatsonai/ai-sdk-office gives the eleven tools to generateText, streamText and agents (ai 6 or 7). Your onFile callback gets the bytes and returns where the file went; the model sees only that location, a summary and the findings.

npm i @vatsonai/ai-sdk-office ai

A Next.js route handler:

import { officeSystemPrompt, officeTools } from "@vatsonai/ai-sdk-office";
import { convertToModelMessages, stepCountIs, streamText, type UIMessage } from "ai";

import { model } from "@/lib/model"; // the language model your app uses
import { saveFile } from "@/lib/storage"; // your upload code; returns a URL

export async function POST(req: Request) {
  const { messages }: { messages: UIMessage[] } = await req.json();
  const result = streamText({
    model,
    system: `You help with office work.\n\n${officeSystemPrompt}`,
    messages: await convertToModelMessages(messages),
    tools: officeTools({
      locale: "en-US",
      onFile: async (file) => ({ location: await saveFile(file.filename, file.bytes, file.mediaType) }),
    }),
    stopWhen: stepCountIs(8),
  });
  return result.toUIMessageStreamResponse();
}

All options: ai-sdk-office README.

Use the engines directly

The engines are plain TypeScript libraries. They do not need eve.

npm i @vatsonai/office-compile @vatsonai/office-spec
import { writeFile } from "node:fs/promises";
import { buildWorkbook } from "@vatsonai/office-compile";
import type { WorkbookSpecInput } from "@vatsonai/office-spec";

const spec: WorkbookSpecInput = {
  locale: "en-US",
  sheets: [
    {
      name: "Plan",
      cells: [
        { ref: "A1", value: "Unit price" }, { ref: "B1", value: 120, role: "input" },
        { ref: "A2", value: "Units" }, { ref: "B2", value: 40, role: "input" },
        { ref: "A3", value: "Revenue" }, { ref: "B3", formula: "=B1*B2" },
      ],
    },
  ],
};

const result = await buildWorkbook(spec);
if (result.ok) await writeFile("plan.xlsx", result.bytes);
else console.error(result.feedback); // what to fix, one line per issue

buildDeck and buildDocument work the same way with a DeckSpec and a DocumentSpec; writeCsv takes rows. Read a file back as text:

import { readFile } from "node:fs/promises";
import { readText } from "@vatsonai/office-read";

const { kind, text, truncated, hiddenFlags } = await readText(await readFile("plan.xlsx"), { maxChars: 50_000 });
console.log(kind, truncated, hiddenFlags);
console.log(text); // [Sheet: Plan] then one line per row, cells joined by " | "

CI type-checks these snippets from examples/readme.

Packages

Package map: eve-office, office-mcp and ai-sdk-office depend on office-tools; office-tools depends on office-edit, office-compile, office-spec, office-style, office-read and office-render; office-edit depends on office-compile; office-compile depends on office-spec, office-read, office-style and office-render; office-render uses LibreOffice and Poppler when installed

Package

What it does

@vatsonai/office-spec

zod schemas for WorkbookSpec, DeckSpec and DocumentSpec; parse, normalise, spec checks, design rules, locale conventions

@vatsonai/office-compile

spec to .xlsx, .pptx and .docx, rows to .csv, review findings

@vatsonai/office-render

render, recalculate and validate Office files with headless LibreOffice and Poppler, when they are installed

@vatsonai/office-read

.docx, .xlsx, .pptx and .csv to text, with size caps and a mark on hidden content

@vatsonai/office-tools

the framework-free core of the eleven tools, shared by the three wrappers below

@vatsonai/eve-office

the eve extension: eleven tools and the office-files skill

@vatsonai/office-mcp

MCP server (stdio and Streamable HTTP): eleven tools, the office-files prompt, files as resources

@vatsonai/ai-sdk-office

AI SDK tools: officeTools() and officeSystemPrompt

@vatsonai/office-style

the style of a .docx, .pptx or .xlsx as a profile, plain rules and a writing check

@vatsonai/office-edit

edit existing .xlsx, .docx and .pptx files with a validated plan; the parts you do not touch stay byte-identical

Tools

Tool (mounted as office__*)

Input

Result

create_workbook

filename?, spec: a WorkbookSpec (sheets, cells with live formulas, tables, named ranges, number formats, native charts)

.xlsx in the sandbox, a summary, the computed values, findings

create_deck

filename?, spec: a DeckSpec (title, bullets, two columns, chart, table, stat, timeline and other slide kinds; a theme)

.pptx in the sandbox, a summary, findings

create_document

filename?, spec: a DocumentSpec (headings, paragraphs, bullet and numbered lists, tables, page breaks, header and footer)

.docx in the sandbox, a summary, findings

write_csv

filename?, header?, rows, delimiter?, bom?, locale?, decimals?

.csv in the sandbox, a summary

edit_workbook, edit_document, edit_deck

path of a file in the sandbox, plan (ops such as set_cell, insert_rows, replace_text, fill_placeholders, insert_blocks, add_slide, update_chart), filename?, inPlace?, dryRun?

the edited file, a list of changes, the parts that changed; everything else byte-identical

read_text

path of a file in the sandbox, kind?

the text, with cut and hidden-content marks

preview_file

path of a .pptx, .xlsx or .docx, pages?, images?

an outline per slide, sheet or page and layout findings; LibreOffice in the sandbox optional (levels)

extract_style

path of a .docx, .pptx or .xlsx

rules for its look and writing, and the full style profile

export_pdf

path of a .pptx, .xlsx or .docx, pages?, pdfA?

a .pdf next to the made files: rendered by LibreOffice, or for a deck without LibreOffice, slides drawn as images

The three create tools also take template?: the sandbox path of a file of the same kind whose look to copy. Their result then includes writing-style findings.

A spec that fails its checks makes no file. The tool returns what to fix, and the model calls again. Findings name the spec path and, where one applies, a rule from the design rules.

How files reach the person

With MCP the file goes to a folder and the result gives its path (plus a resource_link for clients that know it); with the AI SDK your onFile callback gets the bytes. The rest of this section is about eve.

Inside an eve agent: the agent calls office__create_*, the file lands in /workspace/office/, the channel posts it; attachments in .eve/attachments/ go through office__read_text

Each create tool writes the file into the session sandbox under office/<filename> (on the built-in providers /workspace/office/...) and returns its path. The model sees only text: the path, a summary and the findings. The tool result that channels and hooks receive also carries file: { path, filename, mediaType, size }, so a channel can read the bytes from the sandbox and post them.

Why not a file part: eve sends file-part bytes to the model only for images and PDFs, so an Office file part gives the model nothing more than a path. It would also put the bytes in the durable session history, and a provider that cannot read the media type could fail the turn. Details: eve-office README.

Security

  • No network. No tool makes a network request. Deck images come only from data: URIs in the spec; any other source becomes a labelled empty frame.

  • Caps. A created file is at most 25 MiB. Specs have limits (sheets, cells, slides, blocks, CSV rows). read_text reads at most 50 MiB.

  • Zip-bomb guard. Reading checks the entry count and the unpacked size of each entry and of the whole file before it unpacks, inflates with an output cap, and refuses encrypted entries and ZIP64.

  • CSV formula injection. Text that starts with =, +, -, @, tab or carriage return gets a leading ', so a spreadsheet shows it as text. Numbers are never changed.

  • Hidden content. read_text marks hidden sheets, rows, columns, slides, text and comments, and labels the result as file content, not instructions. This lowers the risk of prompt injection through a file; it does not remove it.

  • No telemetry. The packages send nothing anywhere. They need no key and read only OFFICE_SOFFICE_PATH and OFFICE_PDFTOPPM_PATH to find LibreOffice.

Report a vulnerability: SECURITY.md.

Scorecard

pnpm scorecard (and the scorecard CI job) takes nine hand-written specs in scripts/scorecard/briefs.ts, six in English and three in Czech, Polish and Hungarian, through the same build the tools use. LibreOffice recalculates and renders each file, and Poppler reads the PDF. No model is called, so the scorecard measures the compilers, not a model's writing. A brief passes when every gate below holds.

Column

What it measures

Gate

Valid file

The package passes the structure check of @vatsonai/office-render

yes

Formulas (errors)

Workbooks: formula cells, and cells LibreOffice computes to an error (#DIV/0!, #REF!, ...)

0 errors

Native charts

Chart parts in the file against the charts the brief asks for

all present

Text that does not fit

Compiler findings that a text is too long for its box

0

Broken words / off box

Decks and documents: words of 5+ letters that the PDF never shows whole (split across lines or cut); decks: words drawn outside their shape

0

Clipped / ###

Workbooks: words of a text cell cut at the cell edge, and numbers printed as ###

0

Language tags

Language tags in the package that differ from the brief's locale

none

Flat lines / pie gaps / off-centre

Line charts whose data uses under 40% of the value axis; pie legends over 1 in from the pie; stat and timeline groups whose rendered gaps above and below differ by over 1 in

0

Headings / numbering

Documents: headings with a real heading style, list items with Word numbering (and no typed "1." or "-")

all

Weak prose per 1,000 words

Filler phrases (English list only), em dashes, headline case in Czech, Polish and Hungarian titles, list items over 30 words

not a gate

Pages

Rendered pages (decks: one per slide)

at least 1

Latest run; macOS (LibreOffice 26.2, Poppler 26.06) and the CI container (Ubuntu 24.04 packages) give the same table:

Brief

Format

Locale

Valid file

Formulas (errors)

Native charts

Text that does not fit

Broken words / off box

Clipped / ###

Language tags

Flat lines / pie gaps / off-centre

Headings / numbering

Weak prose per 1,000 words

Pages

Gate

en-cash-plan

workbook

en-US

yes

60 (0)

1/1

0

-

0 / 0

all match

0 / - / -

-

0 (56 words)

2

pass

en-budget

workbook

en-GB

yes

18 (0)

1/1

0

-

0 / 0

all match

0 / - / -

-

0 (33 words)

1

pass

en-sales-deck

deck

en-US

yes

-

1/1

0

0 / 0

-

all match

0 / 0 / 0

-

0 (98 words)

6

pass

en-board-deck

deck

en-GB

yes

-

1/1

0

0 / 0

-

all match

0 / 0 / 0

-

0 (70 words)

5

pass

en-policy

document

en-GB

yes

-

0/0

0

0 / -

-

all match

0 / - / -

4/4 / 7/7

0 (97 words)

1

pass

en-minutes

document

en-US

yes

-

0/0

0

0 / -

-

all match

0 / - / -

3/3 / 3/3

0 (66 words)

1

pass

cs-sales-deck

deck

cs-CZ

yes

-

1/1

0

0 / 0

-

all match

0 / 0 / 0

-

0 (63 words)

5

pass

pl-receivables

workbook

pl-PL

yes

9 (0)

1/1

0

-

0 / 0

all match

0 / - / -

-

0 (41 words)

1

pass

hu-policy

document

hu-HU

yes

-

0/0

0

0 / -

-

all match

0 / - / -

4/4 / 7/7

0 (75 words)

1

pass

node scripts/scorecard/run.ts --seeded scores five specs with a planted defect (a formula error, a clipped label, a broken word, a missing chart, a typed list) and must fail; CI checks that it does.

Limits and not in scope

  • The model writes the content. The checks catch structural problems (a typed number where a formula belongs, text that does not fit, broken references), not invented facts. The skill and the tool descriptions tell the model to add no facts, and a local eval lane counts the ones it adds (skill rounds), but nothing stops them at run time. Review figures before you send a file on.

  • Formula errors are reported only when LibreOffice is installed where the code runs. Without it, IronCalc fills the results; where IronCalc cannot load (for example Alpine Linux), Excel computes them on open.

  • Not in v0.1: charts in Word, PDF reading, .doc/.xls/.ppt and ODF, images from URLs.

Known defects

  • Excel's own waterfall chart type is not written: a waterfall is a stacked column chart over hidden helper columns, which looks the same but is not the native type.

  • A PDF of a deck made without LibreOffice draws each slide as an image: no selectable text, and no PDF/A.

  • The page numbers in a Word table of contents are estimated when the file is made; Word puts the real ones in when the reader updates the field.

  • Workbook edits insert and delete rows, not columns.

  • Decks are checked with LibreOffice and the package validator; they have not been opened in PowerPoint itself in CI.

Compatibility

Version

Node

22 or newer for the engines; 24 or newer for @vatsonai/eve-office

eve

>=1.0.0 <2 (peer dependency of @vatsonai/eve-office)

AI SDK (ai)

6 or 7 (peer dependency of @vatsonai/ai-sdk-office; ai 7 needs Node 22 or newer)

MCP

@modelcontextprotocol/server 2.x; protocol 2026-07-28 and the 2025-era versions 2024-11-05 to 2025-11-25

LibreOffice + Poppler

optional; used for recalculation, formula-error checks and rendering

Contributing

See CONTRIBUTING.md for the dev setup, the checks and changesets. Please follow the code of conduct.

Licence

Apache-2.0. See LICENSE and NOTICE. Third-party licences: THIRD_PARTY_NOTICES.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers