Skip to main content
Glama
office-preview
by el0808

Office Document Preview for Antigravity

Native Antigravity MCP Apps file & aux_pane plugin for previewing local Microsoft Office documents (.docx, .xlsx, .xls, .pptx) directly in the side panel — 100% offline, zero external CDNs, with native Word OMML-to-MathML equation rendering.

English · 简体中文


English

Features

  • Native File Viewer (file entrypoint): Click any .docx, .xlsx, .xls, or .pptx file in Antigravity to preview it directly in the side panel.

  • Side-Panel & Chat Tool (aux_pane entrypoint): Open Office Preview from the side panel + menu (drag-and-drop / file picker) or ask your agent to preview a local Office file via preview_office_document.

  • Word (.docx):

    • High-fidelity page layout, styled tables, callouts, borders, and CSP-safe inlined embedded images (data:image/*).

    • Built-in OMML-to-MathML converter for native Microsoft Word equations (m:oMath / m:oMathPara — fractions, roots, limits, accents, sub/superscripts, matrices).

    • Clickable Heading Outline, Zoom (- / + / Fit), and Dark Paper reading mode.

    • Chunked content-visibility: auto rendering and a fixed 40px single-row toolbar with narrow-pane ⋯ overflow menu for smooth dragging and scrolling on large multi-image documents.

  • Excel (.xlsx, .xls): Multi-sheet tab bar, sticky headers/column letters/row numbers, Freeze Row 1 toggle, merged cells, formula tooltips, error cell badges, and live row search with match highlighting.

  • PowerPoint (.pptx): Native aspect-ratio slide deck with theme colors (tint/shade/lumMod), positioned text/bullets, tables, embedded images, collapsible speaker notes, and keyboard navigation.

  • 100% Offline & Privacy-First: All rendering libraries (docx-preview, jszip, xlsx, and the OMML converter) are bundled inside the local ui://office-preview/viewer.html resource (~877 KiB) with zero external network calls.

Requirements

  • Antigravity App v2.34.0+ (supports MCP Apps file entrypoint)

  • Node.js v20+ available in PATH (node)

Installation

Copy and paste the prompt below directly into Antigravity chat:

Install the Antigravity native plugin `office-preview` from https://github.com/el0808/antigravity-office-preview into `~/.gemini/config/plugins/office-preview`.

Execute in order:
1. Verify `node -v` is v20+ and `git --version` is available; stop and report if either is missing.
2. Check `~/.gemini/config/plugins/office-preview`:
   - Missing: `git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git ~/.gemini/config/plugins/office-preview`
   - Existing git repo pointing to this repository: `git -C ~/.gemini/config/plugins/office-preview pull --ff-only`
   - Existing unrelated directory: stop and ask before overwriting.
3. Verify all required runtime files exist in `~/.gemini/config/plugins/office-preview`: `plugin.json`, `mcp_config.json`, `assets/logo.svg`, `dist/mcp-server.mjs`, `dist/viewer.html`.
4. Smoke-test the MCP server by piping a JSON-RPC `initialize` request to `node ~/.gemini/config/plugins/office-preview/dist/mcp-server.mjs` and confirming a valid `result.serverInfo` response on stdout with zero stderr errors.
5. Refresh or discover the plugin via Antigravity's plugin/MCP inspection flow if available, then report completion with the clickable link `[Office Document Preview](customization://office-preview)` and tell the user they can click any `.docx`, `.xlsx`, `.xls`, or `.pptx` file to preview it immediately (reopening any previously cached file tab).

Option 2: One-Line Zero-Build Install (No npm install Needed)

Prebuilt dist/ bundles are included in this repository.

macOS / Linux:

git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git ~/.gemini/config/plugins/office-preview

Windows (PowerShell):

git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git "$HOME\.gemini\config\plugins\office-preview"

Antigravity automatically discovers global plugins under ~/.gemini/config/plugins/. Manage or toggle it anytime from Customizations → Plugins → Office Document Preview.

Option 3: Build from Source

git clone https://github.com/el0808/antigravity-office-preview.git
cd antigravity-office-preview
npm install
npm run build
npm run install-plugin

Usage & File Size Notes

  • Direct file preview: Click any .docx, .xlsx, .xls, or .pptx file in Antigravity's file viewer.

  • Large files (> 10 MiB): Antigravity's antigravity-file:// host bridge enforces a 10 MiB transfer cap; files larger than 10 MiB can still be opened directly inside the viewer using the Open button or drag-and-drop.

  • Uninstall: Delete ~/.gemini/config/plugins/office-preview or uninstall it from Antigravity's Customizations page.

Repository Layout

.
├── plugin.json            # Antigravity plugin manifest
├── mcp_config.json        # MCP server registration (${PLUGIN_ROOT}/dist/mcp-server.mjs)
├── assets/logo.svg        # Plugin icon
├── dist/
│   ├── mcp-server.mjs     # Prebuilt self-contained ESM MCP server
│   └── viewer.html        # Prebuilt single-file offline MCP App viewer
├── src/
│   ├── server/            # MCP server source (stdio transport, safe chunked reader)
│   └── app/               # Frontend renderers (DOCX + OMML MathML, XLSX, PPTX)
├── scripts/
│   ├── build.mjs          # esbuild single-file bundler
│   └── install-plugin.mjs # Installs built bundle into ~/.gemini/config/plugins/office-preview
└── package.json

Related MCP server: Antigravity File Viewer

简体中文

核心特性

  • 原生文件接管(file entrypoint):在 Antigravity 中直接点击任意 .docx、.xlsx、.xls、.pptx 文件,自动在侧边栏排版预览。

  • 侧边栏面板 & 对话调用(aux_pane entrypoint):支持从侧边栏 + 菜单打开 Office Preview 拖放/浏览本地文件,也可直接在对话中让 Agent 调用 preview_office_document 预览指定文档。

  • Word(.docx)高保真预览:

    • 完整渲染页面排版、表格、引用卡片、边框以及内嵌图片(自动转为 CSP 安全的 data:image/*)。

    • 内置 OMML → MathML 公式转换器,原生渲染 Word 数学公式(m:oMath / m:oMathPara:分式、根号、求和上下限、上标下标、顶标 $\hat{f}/\bar{z}$、矩阵等)。

    • 支持标题大纲跳转、**缩放(- / + / Fit)**与 Dark Paper 夜间纸张模式。

    • 长文档按块自动启用 content-visibility: auto,搭配恒定 40px 单行工具栏与窄栏 ⋯ 浮动溢出菜单,拖动侧边栏与滚屏流畅无重叠。

  • Excel(.xlsx / .xls):多工作表切换、固定行列号、冻结首行开关、合并单元格、公式悬浮提示、错误格标注及实时行搜索高亮。

  • PowerPoint(.pptx):按原始比例纵向幻灯片预览,支持主题色修饰(tint/shade/lumMod)、文本框、项目符号、表格、内嵌图片、可折叠演讲者备注与键盘翻页。

  • 100% 本地离线、零外部 CDN:所有解析与渲染依赖均打包进本地 ui://office-preview/viewer.html(约 877 KiB),文档内容不上传任何第三方服务器。

环境要求

  • Antigravity App v2.34.0+(支持 MCP Apps file entrypoint)

  • 本机已安装 Node.js v20+(命令行 node 可用)

安装方式

方式一:直接喂给 Antigravity Agent 自动安装(最推荐)

直接复制下面这段 Prompt 发给你的 Antigravity 对话框即可:

请帮我从 https://github.com/el0808/antigravity-office-preview 安装 Antigravity 原生插件 `office-preview` 到 `~/.gemini/config/plugins/office-preview`。

请按顺序完成以下步骤:
1. 检查本机 `node -v`(需 v20+)和 `git --version`;若缺失则停止并告知需要安装的工具。
2. 检查目标目录 `~/.gemini/config/plugins/office-preview`:
   - 不存在:执行 `git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git ~/.gemini/config/plugins/office-preview`
   - 已存在且指向该仓库:执行 `git -C ~/.gemini/config/plugins/office-preview pull --ff-only` 更新到最新版
   - 已存在但属于其他无关目录:先停止并询问用户是否覆盖。
3. 核对 `~/.gemini/config/plugins/office-preview` 内 5 个运行时文件全部存在:`plugin.json`、`mcp_config.json`、`assets/logo.svg`、`dist/mcp-server.mjs`、`dist/viewer.html`。
4. 做一次 MCP 启动自检:向 `node ~/.gemini/config/plugins/office-preview/dist/mcp-server.mjs` 标准输入发送一条 JSON-RPC `initialize` 请求,确认 stdout 返回合法的 `result.serverInfo` 且 stderr 无报错。
5. 若当前环境支持刷新 MCP 服务则顺手刷新,最后回复安装结果并附上可点击管理链接 `[Office Document Preview](customization://office-preview)`,提醒用户直接点击任意 `.docx`/`.xlsx`/`.xls`/`.pptx` 文件即可预览(若此前已打开过旧的不可预览标签页,关掉重开一次即可)。

方式二:一行命令零构建秒装(无需 npm install)

仓库已内置预构建好的 dist/ 运行产物,直接克隆到 Antigravity 全局插件目录即可自动发现生效:

macOS / Linux:

git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git ~/.gemini/config/plugins/office-preview

Windows (PowerShell):

git clone --depth 1 https://github.com/el0808/antigravity-office-preview.git "$HOME\.gemini\config\plugins\office-preview"

方式三:从源码自行构建安装

git clone https://github.com/el0808/antigravity-office-preview.git
cd antigravity-office-preview
npm install
npm run build
npm run install-plugin

使用与限制说明

  • 直接点击预览:在 Antigravity 文件列表中点击 .docx / .xlsx / .xls / .pptx 自动调用本插件渲染。

  • 超过 10 MiB 的大文件:Antigravity 的 antigravity-file:// 资源桥接有 10 MiB 上限;超过 10 MiB 的文件可在预览栏点击 Open 按钮或直接拖入窗口通过本地文件选择器打开。

  • 卸载:在 Antigravity 的 Customizations → Plugins → Office Document Preview 页面卸载,或直接删除 ~/.gemini/config/plugins/office-preview 目录。

License

MIT

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

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables offline browsing, previewing, searching, and citing local PDFs, Word, Excel/CSV, Markdown, HTML, images, and code directly in Antigravity's sidebar, with agent integration for opening documents and sending selected text to conversations.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables previewing local Word, Excel, PowerPoint, PDF, HTML, ZIP, Jupyter Notebook, media, images/SVG, and Markdown files directly in Google Antigravity's sidebar or full-page view, with automatic agent-driven opening and file navigation.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables Google Antigravity users to preview Word, Excel, PowerPoint, and PDF files locally in the conversation’s right-hand panel without downloading or uploading documents, and lets AI agents open previews via the preview_office_file tool.
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables previewing, in-place editing, and agent collaboration for local Word, PowerPoint, Excel/CSV, LaTeX, JSONL, EPUB, STL, and ZIP/TAR files inside a native Antigravity side-panel viewer. Supports surgical XML-preserving saves, atomic writes with backups, and sending selected content or file structure to the Agent as context.
      MIT