PowerPoint Automation MCP Server for Claude Desktop

PowerPoint Automation MCP Server for Claude Desktop

site icon
2025.03.27 15
PythonPowerPoint自动化办公自动化开发效率
PPT_MCP_Server是一个基于Model Control Protocol (MCP)的PowerPoint自动化服务,专为Claude Desktop设计。它允许用户通过Claude Desktop与Microsoft PowerPoint进行交互,实现创建演示文稿、添加幻灯片、修改内容等多种自动化操作。该服务特别适合需要批量处理PowerPoint文件的场景,能够显著提高工作效率。
View on GitHub

Overview

基本能力

产品定位

PPT_MCP_Server是一个PowerPoint自动化服务,通过MCP协议与Claude Desktop集成,提供对Microsoft PowerPoint的自动化控制能力。

核心功能

  • 创建、打开、保存和关闭PowerPoint演示文稿
  • 列出所有打开的演示文稿
  • 获取幻灯片信息和内容
  • 添加具有不同布局的新幻灯片
  • 向幻灯片添加文本框
  • 更新形状中的文本内容
  • 设置幻灯片标题

适用场景

  • 自动化生成PowerPoint演示文稿
  • 批量修改现有演示文稿内容
  • 定期报告自动化生成
  • 教学材料自动化制作

工具列表

  • initialize_powerpoint(): 连接PowerPoint并使其可见
  • get_presentations(): 列出所有打开的演示文稿
  • open_presentation(path): 从文件打开演示文稿
  • get_slides(presentation_id): 获取演示文稿中的所有幻灯片
  • get_slide_text(presentation_id, slide_id): 获取幻灯片的文本内容
  • update_text(presentation_id, slide_id, shape_id, text): 更新形状中的文本
  • save_presentation(presentation_id, path): 保存演示文稿
  • close_presentation(presentation_id, save): 关闭演示文稿
  • create_presentation(): 创建新演示文稿
  • add_slide(presentation_id, layout_type): 添加新幻灯片
  • add_text_box(presentation_id, slide_id, text, left, top, width, height): 添加文本框
  • set_slide_title(presentation_id, slide_id, title): 设置幻灯片标题

常见问题解答

  • 仅支持Windows系统且需要安装Microsoft PowerPoint
  • PowerPoint应用程序在操作期间会打开并可见
  • 功能受限于PowerPoint COM API的能力

使用教程

使用依赖

  1. 确保系统满足以下要求:
  2. Windows系统
  3. Microsoft PowerPoint已安装
  4. Python 3.7+
  5. Claude Desktop客户端

  6. 安装依赖包: bash uv add fastmcp pywin32

安装教程

  1. 克隆项目仓库
  2. 安装依赖包(如上所述)
  3. 配置Claude Desktop:
  4. 打开Claude Desktop
  5. 导航至设置
  6. 修改配置文件%APPDATA%\Claude\claude_desktop_config.json: json { "mcpServers": { "ppts": { "command": "uv", "args": ["run", "path/to/main.py"] } } } 或使用虚拟环境时: json { "mcpServers": { "ppts": { "command": "C:\\Path\\To\\Python\\Scripts\\uv.exe", "args": ["run", "C:\\Path\\To\\Project\\main.py"] } } }

调试方式

  1. 初始化PowerPoint: Could you open PowerPoint for me?
  2. 创建新演示文稿: Please create a new PowerPoint presentation.
  3. 添加幻灯片: Add a new slide to the presentation.
  4. 添加内容: Add a text box to slide 1 with the text "Hello World".
  5. 保存演示文稿: Save the presentation to C:\Users\username\Documents\presentation.pptx

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。