Getting started
Add the tools to an MCP client in one line, to an AI SDK app, or to an eve agent.
No API key, no account. The tools run where your agent runs and make no network requests.
MCP
@vatsonai/office-mcp is an MCP server with the eleven tools and the office-files prompt. It writes files to a folder (./office-output by default) and returns their paths. Node 22 or newer.
claude mcp add office -- npx -y @vatsonai/office-mcpLoad the guidance in a session with /mcp__office__office-files. The tools show as mcp__office__create_workbook and so on.
Any other MCP client takes the same "office": { "command": "npx", "args": ["-y", "@vatsonai/office-mcp"] } entry under mcpServers. 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."
Server options
| Flag | Default | What it does |
|---|---|---|
--out <dir> | ./office-output | Folder for created files; made when needed |
--allow-dir <dir> | working directory | Folder the tools may read files from; repeat for more. The out folder is always allowed |
--embed-max-bytes <n> | 0 (never) | Also embed created files up to n bytes (at most 5 MiB) in the tool result |
--locale <tag> | en-US | BCP 47 tag used when a spec names none |
--max-read-chars <n> | 100000 | Longest text read_text returns (1000 to 1000000) |
--no-mark-hidden | off | Leave hidden content out of read_text |
--recalc <auto|never> | auto | Fill formula results with LibreOffice or IronCalc, or leave them for Excel |
--http | off | Serve Streamable HTTP instead of stdio |
--host <addr> | 127.0.0.1 | HTTP address |
--port <n> | 8765 | HTTP port |
--token-env <NAME> | none | Require Authorization: Bearer <token>, read from the environment variable NAME |
Over HTTP, a non-loopback address needs --token-env; the server refuses to start without it. See Security and limits.
export OFFICE_MCP_TOKEN="$(openssl rand -hex 32)"
npx -y @vatsonai/office-mcp --http --token-env OFFICE_MCP_TOKEN --out ./office-outputClients that show MCP Apps get a preview of each made file in the chat: the first pages as images, with buttons to see more, export a PDF and save the file. Other clients get exactly the same tools and results.
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 aiimport { 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();
}The tools run on the server: they need Node for file building, zip and an IronCalc child process. Use them in a route handler, a server action or a script.
| Option | Default | What it does |
|---|---|---|
onFile(file, { toolCallId, abortSignal }) | Gets every made file: { kind, filename, mediaType, size, bytes, path? }. Return { location } to tell the model where it is | |
outDir | Folder to write made files to. Also the only folder the tools may read by path when readFile is not given | |
readFile(path) | Reads a file by path for every tool that takes one; you decide what a path means | |
locale | "en-US" | BCP 47 tag used when a spec names none |
maxReadChars | 100000 | Longest text read_text returns |
markHidden | true | Include hidden content in read_text, marked |
recalc | "auto" | Fill formula results with LibreOffice or IronCalc; "never" leaves them for Excel |
onFile or outDir is required. officeSystemPrompt is the guidance text (about 1 500 tokens): which tool to pick and how to write a good spec.
eve
@vatsonai/eve-office is an eve extension: eleven tools and the office-files skill. Add this project's registry once, then add the extension:
eve registry add '@vatsonai=https://office.vatson.ai/r/{name}.json'
eve add @vatsonai/officeeve add installs @vatsonai/eve-office from npm and writes agent/extensions/office.ts. To do it by hand:
npm i @vatsonai/eve-officeimport 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
});The file name is the mount prefix, so the tools appear as office__create_workbook and so on. Every option is optional; export { default } from "@vatsonai/eve-office"; mounts it with the defaults. Needs eve 1.x and Node 24 or newer.
| Option | Default | What it does |
|---|---|---|
locale | "en-US" | BCP 47 tag used when a spec names none |
maxReadChars | 100000 | Longest text read_text returns |
markHidden | true | Include hidden content in read_text, marked |
recalc | "auto" | Fill formula results with LibreOffice (when installed) or IronCalc; "never" leaves them for Excel |
provenance | false | true or { generator: "..." }: write machine-readable provenance as custom document properties. A mount option, not a tool input |
Each create tool writes the file into the session sandbox under office/<filename> and returns its path. The tool result that channels and hooks receive also carries file: { path, filename, mediaType, size }, so a channel can post the file.
Use the engines directly
The engines are plain TypeScript libraries and need no agent framework.
npm i @vatsonai/office-compile @vatsonai/office-specimport { 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 issuebuildDeck and buildDocument work the same way with a DeckSpec and a DocumentSpec; writeCsv takes rows.
LibreOffice (optional)
Without LibreOffice everything still works: IronCalc fills formula results, previews measure the file itself (decks also get slide images), and a deck exports to PDF as images. With LibreOffice and Poppler installed where the tools run, you also get formula-error reports, real page renders and PDF export.
# Debian or Ubuntu
sudo apt-get install -y --no-install-recommends libreoffice-calc libreoffice-impress libreoffice-writer poppler-utils fonts-crosextra-carlito
# macOS
brew install --cask libreoffice && brew install popplerCarlito sets Calibri, the default font of the files, with the same widths, so line breaks in the renders match Office. Set OFFICE_SOFFICE_PATH and OFFICE_PDFTOPPM_PATH when the programs are not on the usual paths.