PowerPoint MCP Server
用于 Antigravity 的 PowerPoint MCP Server
一个生产级本地 Model Context Protocol (MCP) 服务器,使用 Python 编写,为 Google Antigravity 提供对话式、确定性的 PowerPoint (.pptx) 检查、精准编辑、高分辨率渲染、视觉差异比较和基于规则的验证。
1. 概述与理念
现代 AI 幻灯片编辑常常破坏精细的格式、打破字体层级,并重置复杂的布局,因为 LLM 试图从头重新生成整个演示文稿。
PowerPoint MCP Server 实现了一种确定性的、最小差异编辑理念:
先检查后修改:直接从 OpenXML 树中提取语义角色(
title、subtitle、body、diagram、image、footer)和精确的 EMU/英寸边界框。运行级样式保留:文本编辑保留字体、字号、颜色、边距和多运行富文本格式。
非破坏性工作副本:修改在隔离的会话工作区中进行,位于
.ppt-agent/sessions/<session_id>/working.pptx,并自动生成带时间戳的备份(presentation.backup-YYYYMMDD-HHMMSS.pptx)。视觉验证循环:集成的 Windows PowerPoint COM 自动化和无头 LibreOffice 渲染生成 PNG 幻灯片图像和像素差异热图,以视觉验证布局更改。
Related MCP server: PPTX MCP Server
2. 架构
┌─────────────────────────────────────────────────────────────────┐
│ Antigravity CLI Agent │
│ (Skill: .agents/skills/powerpoint-editor/SKILL.md) │
└───────────────────────────────┬─────────────────────────────────┘
│ JSON-RPC 2.0 via Stdio
┌───────────────────────────────▼─────────────────────────────────┐
│ PowerPoint MCP Server (server.py) │
│ 19 FastMCP / MCPServer Tools & 3 MCP Resources │
└───────┬───────────────────────┼─────────────────────────┬───────┘
│ │ │
┌───────▼──────────────┐ ┌──────▼───────────────┐ ┌──────▼───────────────┐
│ Inspection & Models │ │ Editing & Geometry │ │ Rendering & Diffing │
│ - Shape Hierarchies │ │ - Move / Resize │ │ - Windows PPT COM │
│ - Semantic Inference │ │ - Align / Distribute │ │ - LibreOffice CLI │
│ - Multi-Factor Match │ │ - Text Run Styling │ │ - Pixel Diff Heatmaps│
│ - Rule Validation │ │ - Safe OOXML Helpers │ │ - Bounding Clusters │
└──────────────────────┘ └──────────────────────┘ └──────────────────────┘
│
┌───────────────────────────────▼─────────────────────────────────┐
│ Session & Safety Layer │
│ .ppt-agent/sessions/<session_id>/working.pptx + backups/ │
└─────────────────────────────────────────────────────────────────┘3. 先决条件与要求
操作系统:Windows 10/11(用于原生 PowerPoint COM 自动化)、macOS 或 Linux。
Python:Python 3.10、3.11、3.12 或 3.13+。
包管理器:
uv(推荐)或pip。演示软件(可选但建议用于渲染):Microsoft PowerPoint 2016 / 2019 / 2021 / Office 365(Windows)。LibreOffice(系统 PATH 中的
sofficeCLI)。
4. 安装与设置
使用 uv 克隆仓库并安装依赖:
# Clone the repository
git clone https://github.com/example/powerpoint-mcp.git
cd powerpoint-mcp
# Create and sync virtual environment with uv
uv sync或者,使用标准 pip:
python -m venv .venv
# On Windows PowerShell:
.venv\Scripts\Activate.ps1
# On macOS/Linux:
source .venv/bin/activate
pip install -e .5. 运行 MCP 服务器
要通过标准输入/输出(stdio)运行 MCP 服务器:
uv run python -m powerpoint_mcp.server或通过直接脚本入口点:
uv run powerpoint-mcp6. Antigravity 工作区配置
配置你的工作区 .agents/mcp_config.json 以注册服务器:
{
"mcpServers": {
"powerpoint-mcp": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"powerpoint_mcp.server"
],
"env": {
"PPT_RENDERER": "auto",
"PPT_WORKSPACE_DIR": ".ppt-agent",
"PPT_BACKUP_ENABLED": "true",
"PPT_DEFAULT_OUTPUT_DIR": "./output"
}
}
}
}7. Antigravity 技能安装
技能定义位于 .agents/skills/powerpoint-editor/SKILL.md。Antigravity 会自动发现 .agents/skills/ 内的技能。
该技能编码了:
15 条不可变的 PowerPoint 编辑规则。
用于文本编辑、几何调整和参考幻灯片匹配的结构化决策树。
工具调用优化和批处理规则。
8. 支持的 MCP 工具参考(19 个核心工具)
工具名称 | 参数 | 描述 |
|
| 打开演示文稿并初始化带有工作副本的隔离会话工作区。 |
|
| 检查演示文稿元数据、幻灯片数量、尺寸、布局和标题。 |
|
| 检查幻灯片形状、EMU/英寸坐标、语义角色、文本和样式。 |
|
| 对单个形状进行深度检查:运行、字体、颜色、边距、线条、填充、XML。 |
|
| 修改坐标、尺寸、旋转、z 顺序或多形状对齐/分布。 |
|
| 修改文本和样式,并保留运行级样式。 |
|
| 将形状及其格式和关系克隆到相同或目标幻灯片上。 |
|
| 按绝对坐标或相对偏移(以英寸为单位)移动形状。 |
|
| 使用绝对尺寸或缩放倍数调整形状大小。 |
|
| 从幻灯片形状树中干净地移除形状。 |
|
| 用于透明度、渐变和阴影的安全低级 DrawingML 操作。 |
|
| 基于规则的验证,用于重叠(VAL-01)、裁剪(VAL-02)、微小字体(VAL-05)、溢出(VAL-04)。 |
|
| 通过 PowerPoint COM 或 LibreOffice 将单个幻灯片渲染为高分辨率 PNG。 |
|
| 将演示文稿中的所有幻灯片渲染为 PNG 图像。 |
|
| 比较两个幻灯片之间的几何、布局、排版和语义匹配。 |
|
| 像素级差异叠加、更改的边界框和相似度百分比。 |
|
| 将工作副本保存回原始路径,并自动生成带时间戳的备份。 |
|
| 将工作副本保存到新的目标路径。 |
|
| 将工作副本还原为原始演示文稿或指定的备份时间戳。 |
9. 支持的 MCP 资源
URI 资源 | MIME 类型 | 描述 |
|
| 演示文稿元数据、尺寸、布局和幻灯片标题的 JSON 摘要。 |
|
| 幻灯片 |
|
| 幻灯片 |
10. 独立 CLI 调试工具
检查演示文稿或幻灯片
# Inspect entire presentation metadata
python scripts/inspect_pptx.py presentation.pptx
# Inspect specific slide as ASCII tree
python scripts/inspect_pptx.py presentation.pptx --slide 1
# Inspect single shape in JSON format
python scripts/inspect_pptx.py presentation.pptx --slide 1 --shape 2 --json将幻灯片渲染为 PNG
# Render all slides to ./renders/
python scripts/render_pptx.py presentation.pptx --output ./renders
# Render single slide at 300 DPI using PowerPoint COM
python scripts/render_pptx.py presentation.pptx --slide 1 --dpi 300 --renderer powerpoint11. 示例对话命令
以下是 Antigravity 使用 PowerPoint MCP Server 处理的典型自然语言提示:
"打开 pitch_deck.pptx 并检查幻灯片 2。"
"将幻灯片 1 上的标题向左移动 0.2 英寸。"
"将幻灯片 1 上的三个功能框水平分布,间距相等。"
"将幻灯片 2 上的三张卡片沿顶部边缘对齐。"
"将形状 4 中的正文文本更改为 'Enterprise Cloud Solutions',并使其加粗,同时保留 14pt Calibri 字体。"
"复制幻灯片 2 上的图表卡片,并将其向下移动 0.5 英寸。"
"使幻灯片 2 匹配幻灯片 1 的布局和字体层级,但保持幻灯片 2 的内容不变。"
"验证幻灯片 3 是否存在重叠或离屏元素,并修复发现的问题。"
"渲染幻灯片 1,并显示与之前版本的视觉差异。"
"将修改后的演示文稿保存为 final_presentation.pptx。"
12. 故障排除与常见问题
Windows 上的 PowerPoint COM 错误
症状:
pywintypes.com_error: (-2147417848, 'The object invoked has disconnected from its clients.')解决方案:确保 Windows 任务管理器中没有挂起的
POWERPNT.EXE实例。关闭现有的后台 PowerPoint 进程或重新启动。服务器自动使用线程安全的 COM 调度,并带有CoInitialize/CoUninitialize。
无头环境与 LibreOffice 回退
在无头 CI/CD 环境或没有 Microsoft Office 的 Linux 服务器上,安装 LibreOffice:
sudo apt-get install libreoffice在你的环境中设置
PPT_RENDERER=libreoffice或PPT_RENDERER=auto。
字体与排版漂移
如果渲染的幻灯片缺少自定义字体,请在主机上安装 TrueType/OpenType 字体文件。如果缺少专有字体,LibreOffice 和 PowerPoint 将替换为标准系统字体(Calibri、Arial)。
许可证
MIT 许可证。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceCreates and manipulates PowerPoint presentations with capabilities for adding various slide types, generating images, and incorporating tables and charts through natural language commands.11144MIT
- FlicenseAqualityDmaintenanceEnables AI assistants to create, edit, and manipulate PowerPoint presentations programmatically with support for text styling, shapes, slide rearrangement, and direct Office XML access.81
- AlicenseNot gradedqualityCmaintenanceEnables PowerPoint automation on Windows, including template-based creation, real-time editing, LaTeX equations, animations, and multimodal slide analysis, all via natural language.110MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with PowerPoint presentations through natural language commands, supporting reading, editing, slide management, and automated speaker notes processing.MIT
Related MCP Connectors
Deterministic, fully editable PowerPoint from typed slide intents. 200+ layouts, brand templates.
Generate, edit, and export AI presentations to PDF, PPTX, or a shareable link.
Presentations.AI MCP server — create designed slide decks from a topic, text, or document.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/atharva-bedekar/PowerPointMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server