office-viewer_viewer
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
功能特点
文件标签页直接打开 (
fileentrypoint):在工作区、聊天链接或文件列表中点击.pdf、.docx、.doc、.xlsx、.xls、.xlsm、.csv、.tsv、.pptx、.ppt,直接在右侧边栏打开自定义预览器。侧边栏独立入口 (
+菜单 / 左侧边栏):点击右侧边栏+→ Office & PDF 预览,即可拖入文件、浏览本机文件夹、查看最近打开历史,或流式读取超过 10 MiB 的大文件。AI 对话联动(内置 Skill + Rule):直接对 Agent 说「在右侧边栏打开这份 PDF / Word / Excel / PPT」,或让 Agent 生成文档后自动在右侧栏预览;支持将当前页面内容一键「附加到对话」。
多格式双引擎渲染:
PDF (
.pdf):内置 PDF.js + 离线 CJK CMap 与标准字体(零外部网络请求),支持缩放、旋转、目录跳转、全文搜索与文字划选复制。Word (
.docx/.doc):支持纯前端即时排版(.docx),以及 Windows 下调用本机 Microsoft Word COM 的高保真原版排版(带磁盘缓存,兼容.doc)。Excel / 表格 (
.xlsx/.xls/.xlsm/.csv/.tsv):支持多工作表切换、冻结行列号、合并单元格、公式栏查看/复制、筛选搜索、大表分页,以及一键切换 Excel 打印预览。PowerPoint (
.pptx/.ppt):支持即时幻灯片浏览 + 演讲者备注 + 键盘翻页,以及 Windows 下本机 Microsoft PowerPoint 原版高保真渲染。
开箱即用,零
npm install:本仓库与 Release 已内置打包后的dist/server.mjs、dist/viewer.html及 PDF.js 离线字体资源,安装后只需本机有 Node.js ≥ 18 即可直接运行。
Related MCP server: doc-viewer
支持格式与平台说明
格式 | 跨平台纯 JS 即时预览 (Windows / macOS / Linux) | 本机 Office 原版高保真模式 (Windows + MS Office) |
| ✅ 完整支持(含中文 CJK CMap) | — |
| ✅ | ✅ Word COM 转高清 PDF(带缓存) |
| — | ✅ Word COM 自动转高清 PDF |
| ✅ SheetJS 交互表格 / 公式 / 筛选 | ✅ Excel COM 打印视图 PDF |
| ✅ 幻灯片解析 + 演讲者备注 | ✅ PowerPoint COM 原版高保真 PDF |
| — | ✅ PowerPoint COM 自动转高清 PDF |
快速安装
前置条件:本机已安装 Node.js(v18 或更高版本)。
方式一:通过 Antigravity CLI 一键安装(推荐)
agy plugin install https://github.com/GanYoung/antigravity-office-viewer方式二:手动克隆到全局插件目录(适用于 Antigravity App / IDE)
Windows (PowerShell):
git clone https://github.com/GanYoung/antigravity-office-viewer.git "$env:USERPROFILE\.gemini\config\plugins\office-viewer"macOS / Linux:
git clone https://github.com/GanYoung/antigravity-office-viewer.git ~/.gemini/config/plugins/office-viewer方式三:下载 Release 压缩包
前往 Releases 页面 下载
antigravity-office-viewer-v1.0.0.zip。解压到全局插件目录
~/.gemini/config/plugins/office-viewer/(确保目录内直接包含plugin.json、mcp_config.json、dist/等文件)。Antigravity 会自动发现并加载插件,无需手动编辑配置。
使用方式
点击文件直接预览:在 Antigravity 中点击任意
.pdf/.docx/.xlsx/.pptx/.csv文件即可在右侧标签页打开。从侧边栏打开文档中心:点击右侧边栏
+菜单 → 选择 Office & PDF 预览,即可拖拽文件、输入路径或浏览本地目录。在对话中直接吩咐 Agent:
在右侧边栏打开并预览我当前项目里的 PDF / Word / Excel / PPT 文件用原版排版模式在右侧栏预览这份 PPTX 演示文稿帮我打开桌面上的 report.pdf 第 5 页
暴露的 MCP 工具
插件注册的 MCP 服务器命名空间为 office-viewer_viewer:
preview_document({ path?, mode?, page?, sheet? }):在右侧边栏打开指定本地文档,或无参打开文档中心;支持mode: "auto" | "office" | "fast"、指定初始页码page或 Excel 工作表sheet。open_office_file:Antigravity 原生文件标签页处理器(fileentrypoint)。
项目结构
office-viewer/
├── plugin.json # Antigravity 插件清单
├── mcp_config.json # MCP Server 启动配置
├── assets/logo.svg # 插件图标
├── skills/office-viewer/ # Agent 按需加载的技能说明 (SKILL.md)
├── rules/AGENTS.md # 自动触发右侧栏预览的插件规则
├── src/
│ ├── server.mjs # MCP Server 源码(Node.js)
│ ├── viewer.js / .css # 单文件 MCP App 前端预览器源码
│ ├── pptx_parser.js # PPTX 客户端解析器
│ ├── template.html # 内联 HTML 模板
│ └── office_convert.ps1 # Windows Microsoft Office COM 转 PDF 脚本
├── dist/ # 开箱即用构建产物(零 node_modules 可运行)
│ ├── server.mjs # esbuild 打包后的独立 MCP Server
│ ├── viewer.html # 单文件内联 MCP App 页面
│ └── pdf-assets/ # 离线 PDF.js CMap 与标准字体
└── build.mjs # esbuild 构建脚本从源码开发与构建
如果你修改了 src/ 下的源码,重新构建只需执行:
npm install
npm run build构建脚本 build.mjs 会自动:
将
src/viewer.js、src/viewer.css和src/template.html打包为单文件dist/viewer.html(并校验体积< 10 MiB)。将
src/server.mjs及其全部依赖打包为独立可执行的dist/server.mjs。同步复制
pdfjs-dist的cmaps和standard_fonts到dist/pdf-assets/。
开源致谢(Third-Party Licenses)
本项目打包与使用了以下优秀的开源组件:
@modelcontextprotocol/sdk & @modelcontextprotocol/ext-apps — MIT License
PDF.js (
pdfjs-dist) — Apache-2.0 Licensedocx-preview — Apache-2.0 License
JSZip — MIT / GPLv3 Dual License
Zod — MIT License
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Open, inspect, filter, edit and convert xlsx and csv files from your AI chat. Processing is local.
Open, inspect, filter, edit and convert xlsx and csv files from your AI chat. Processing is local.
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables Google Antigravity agents to quickly inspect and read PDF, Word, Excel, PowerPoint, and text documents, extracting structure and content as token-efficient Markdown.-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables 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.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables browsing, editing, and previewing workspace files — Markdown, images, PDFs, and Git diffs — directly inside Google Antigravity's sidebars. Provides a file tree with quick search, CodeMirror-based editing with syntax highlighting, and one-click chat context attachment, all without consuming model tokens.MIT
- AlicenseNot gradedqualityBmaintenanceEnables 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