基本能力
产品定位
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的能力
使用教程
使用依赖
- 确保系统满足以下要求:
- Windows系统
- Microsoft PowerPoint已安装
- Python 3.7+
-
Claude Desktop客户端
-
安装依赖包:
bash
uv add fastmcp pywin32
安装教程
- 克隆项目仓库
- 安装依赖包(如上所述)
- 配置Claude Desktop:
- 打开Claude Desktop
- 导航至设置
- 修改配置文件
%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"]
}
}
}
调试方式
- 初始化PowerPoint:
Could you open PowerPoint for me?
- 创建新演示文稿:
Please create a new PowerPoint presentation.
- 添加幻灯片:
Add a new slide to the presentation.
- 添加内容:
Add a text box to slide 1 with the text "Hello World".
- 保存演示文稿:
Save the presentation to C:\Users\username\Documents\presentation.pptx