使用说明
Claude桌面版PowerPoint自动化MCP服务器
此项目提供了一个PowerPoint自动化服务器,该服务器通过模型控制协议(MCP)与Claude Desktop配合使用。它允许Claude与Microsoft PowerPoint交互,实现创建演示文稿、添加幻灯片、修改内容等任务。
特性
- 创建、打开、保存和关闭PowerPoint演示文稿
- 列出所有打开的演示文稿
- 获取幻灯片信息和内容
- 添加具有不同布局的新幻灯片
- 在幻灯片中添加文本框
- 更新形状中的文本内容
- 设置幻灯片标题
- 还有更多!
快速开始
- 使用
uvx运行:
uvx --from https://github.com/socamalo/PPT_MCP_Server.git mcp-ppt
安装
-
克隆此存储库:
-
安装依赖项:
uv add fastmcp pywin32 -
配置Claude桌面:
- 打开克劳德桌面
- 导航到设置
- 按照以下说明配置MCP服务器
配置
要配置Claude Desktop以使用此MCP服务器,请将以下内容添加到位于以下位置的Claude Desktop配置文件中 %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"ppts": {
"command": "uv",
"args": ["run", "path/to/main.py"]
}
}
}
如果你使用的是虚拟环境或替代Python可执行文件(如 uv):
{
"mcpServers": {
"ppts": {
"command": "C:\\Path\\To\\Python\\Scripts\\uv.exe",
"args": ["run", "C:\\Path\\To\\Project\\main.py"]
}
}
}
用法
配置后,您可以使用Claude Desktop控制PowerPoint。交互示例:
-
初始化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
可用功能
服务器提供以下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):设置幻灯片的标题
需求
- 安装了Microsoft PowerPoint的Windows
- Python 3.7+
- Claude桌面客户端
pywin32和fastmcpPython包
局限性
- 仅适用于安装了PowerPoint的Windows
- PowerPoint应用程序将在操作过程中打开并可见
- 仅限于PowerPoint COM API提供的功能
贡献
欢迎投稿!请随时提交拉取请求。