该项目提供了一个可与 Claude Desktop 配合使用的 PowerPoint 自动化服务器,通过 Model Control Protocol (MCP) 实现交互。借助该服务器,Claude 能够控制 Microsoft PowerPoint,执行创建演示文稿、添加幻灯片、修改内容等任务。
本项目提供的 PowerPoint 自动化 MCP 服务器可与 Claude Desktop 协同工作,借助 MCP 协议实现交互,让 Claude 控制 PowerPoint 完成各类操作。
uv add fastmcp pywin32
要将 Claude Desktop 配置为使用此 MCP 服务器,请在 %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?
请创建一个新 PowerPoint 演示文稿。
在演示文稿中添加一张新的幻灯片。
在第一页幻灯片上添加一个文本框,内容为“你好,世界”。
将演示文稿保存到 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): 设置幻灯片的标题。pywin32 和 fastmcp Python 包。欢迎贡献!请随时提交 Pull Request。
(此处应包含具体的许可证信息)