PowerPoint自动化服务

一个基于FastMCP的PowerPoint自动化服务器,提供32种工具用于演示文稿的创建、管理和设计。

  • by rcarvalo
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 rcarvalo/powerpoint-mcp-server

使用说明

PowerPoint MCP 服务器 - FastMCP 版本

一个使用python-pptx构建的全面MCP服务器,用于PowerPoint操作 FastMCP。

特点/特性

这台服务器提供 32种专业工具 分为11个重点模块:

演示管理(7种工具)

  • 创建/打开/保存演示文稿
  • 根据模板文件创建,同时保留布局
  • 获取演示信息和属性
  • 设置核心属性(标题、作者等)

内容管理(6种工具)

  • 添加具有自定义布局和背景的幻灯片
  • 使用高级格式管理文本
  • 添加并增强图像
  • 提取文本内容
  • 填充占位符
  • 添加项目符号

模板操作(7种工具)

  • 31+个预设幻灯片模板
  • 根据主题自动生成演示文稿
  • 将模板应用于现有幻灯片
  • 优化文本以提高可读性
  • 8种配色方案 & 5种排版风格

结构元素(4种工具)

  • 添加具有自定义样式的表格
  • 20多种形状类型(基本形状、流程图形状、多边形)
  • 添加线条和连接器
  • 添加文本框

专业设计(3种工具)

  • 应用专业主题
  • 添加图表(柱状图、条形图、折线图、饼图)
  • 高级文本格式化

专业特性(5种工具)

  • 超链接管理
  • 图表数据更新
  • 连接线/箭头
  • 幻灯片母版管理
  • 幻灯片过渡效果

运输方式

此服务器支持两种传输模式:

  • **STDIO(默认)**适用于Claude Desktop和MCP客户端。通过stdin/stdout进行通信。
  • **HTTP(超文本传输协议)**适用于Web应用、API和云部署。提供支持流传输的RESTful端点。

快速入门

选项1:Claude桌面版(STDIO模式)- 推荐

1. 安装依赖项

cd powerpoint-mcp-server

# Install with uv (recommended)
uv sync

# Or manually install dependencies
uv pip install chuk-mcp-server python-pptx Pillow fonttools

2. 测试服务器

# Test that it works
uv run python server.py --help

3. 配置Claude桌面版

在您的Claude桌面配置文件中添加:

  • macOS(苹果电脑操作系统): ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "powerpoint": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/remicarvalot/project_pro/powerpoint-mcp-server",
        "run",
        "python",
        "server.py"
      ]
    }
  }
}

重要的替换 /Users/remicarvalot/project_pro/powerpoint-mcp-server 并替换为您的实际安装路径。

4. 重启Claude桌面版

您的PowerPoint MCP服务器现已配备全部32种工具,随时可用!

选项2:Web/API(HTTP模式)

非常适合网络应用和云部署。

# Start HTTP server on port 8000
uv run python server.py --http

# Or specify custom port/host
uv run python server.py --port 8000 --host 0.0.0.0

使用curl进行测试:

curl http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

选项3:Docker(生产环境部署)

Docker 会自动以 HTTP 模式运行服务器,非常适合生产环境部署。

使用 docker-compose(最简单的方法)

docker-compose up

或者手动构建

# Build the image
docker build -t powerpoint-mcp-server .

# Run the container
docker run -p 8000:8000 powerpoint-mcp-server

使用示例

一旦连接到Claude Desktop,您可以询问:

"Create a new PowerPoint presentation about AI"
"Add a title slide with the title 'Machine Learning 101'"
"Apply the modern_blue color scheme"
"Add a slide with a chart showing quarterly results"
"Create a presentation from the business template"
"Save the presentation as 'my-presentation.pptx'"

可用工具(共32个)

演示管理

  1. create_presentation - 创建一个新的空白演示文稿
  2. create_presentation_from_template - 从模板文件创建
  3. open_presentation - 打开现有的.pptx文件
  4. save_presentation - 保存到磁盘
  5. get_presentation_info - 获取元数据
  6. get_template_file_info - 获取模板详情
  7. set_core_properties - 设置标题、作者等。

内容管理

  1. add_slide - 添加带有布局的幻灯片
  2. get_slide_info - 获取幻灯片详情
  3. extract_slide_text - 从幻灯片中提取文本
  4. extract_presentation_text - 提取所有文本
  5. populate_placeholder - 填充占位符
  6. add_bullet_points - 添加带格式的项目符号
  7. manage_text - 统一文本操作
  8. manage_image - 添加并增强图像

模板操作

  1. list_slide_templates - 列出31+个模板
  2. apply_slide_template - 将模板应用于幻灯片
  3. create_slide_from_template - 从模板创建
  4. create_presentation_from_templates - 从序列构建
  5. get_template_info - 获取模板详情
  6. auto_generate_presentation - AI风格生成
  7. optimize_slide_text - 提高可读性

结构元素

  1. add_table - 添加格式化表格
  2. add_shape - 添加20多种形状类型
  3. add_line - 画线
  4. add_textbox - 添加文本框

专业设计

  1. apply_professional_design - 应用主题
  2. add_chart - 添加专业图表
  3. format_text_advanced - 高级格式化

专业特性

  1. update_chart_data - 更新图表数据
  2. manage_hyperlinks - 管理超链接
  3. add_connector - 添加连接线
  4. manage_slide_masters - 访问幻灯片母版
  5. manage_slide_transitions - 设置过渡效果

实用工具

  • list_presentations - 列出所有已加载的演示文稿
  • switch_presentation - 在演示文稿之间切换
  • get_server_info - 获取服务器功能

模板系统

该服务器包含31+个预设的幻灯片模板,其中包括:

标准模板:

  • 标题幻灯片,议程幻灯片,图文幻灯片
  • 双栏文本,关键指标仪表盘
  • 图表对比,感谢幻灯片
  • 数据表幻灯片,全图幻灯片
  • 三栏布局,引用客户评价
  • 工艺流程,以及更多。。。

配色方案(8):

  1. 现代蓝
  2. 企业灰
  3. 优雅的绿色
  4. 暖红色
  5. 粉彩之梦
  6. 自然_地球
  7. 霓虹色的、充满活力的
  8. 极简主义单色(或:简约单色风格)

字体样式(5):

  1. 现代无衬线体(或简称:现代无衬线)
  2. 优雅衬线体
  3. 现代科技
  4. 有机流量
  5. 粗犷风格_粗体

环境配置

设置自定义模板目录:

# Unix/Mac
export PPT_TEMPLATE_PATH="/path/to/templates:/another/path"

# Windows
set PPT_TEMPLATE_PATH="C:\templates;D:\more-templates"

发展

安装开发依赖项

uv sync --dev

运行测试

uv run pytest

类型检查

uv run mypy server.py

Linting(代码检查/代码分析)

uv run ruff check .

命令行选项

# Force STDIO mode (default)
python server.py --stdio
python server.py --transport=stdio

# Force HTTP mode
python server.py --http
python server.py --port 8000
python server.py --host 0.0.0.0
python server.py --transport=http

# Enable debug logging
python server.py --debug
python server.py --log-level debug

建筑学

这台服务器集成了:

  • FastMCP - 轻量级且快速的MCP框架
  • Office-PowerPoint-MCP-服务器 - 32个专业的PowerPoint工具
  • 模块化设计 - 11个工具模块 + 7个实用程序模块(共3,068行)
  • 高级功能 - 模板、主题、自动生成、优化

项目结构

powerpoint-mcp-server/
├── server.py                      # Main server file
├── pyproject.toml                 # Project configuration
├── tools/                         # 11 tool modules
│   ├── presentation_tools.py      # Presentation management
│   ├── content_tools.py           # Content operations
│   ├── template_tools.py          # Template system
│   ├── structural_tools.py        # Shapes, tables, lines
│   ├── professional_tools.py      # Design & themes
│   ├── chart_tools.py             # Chart operations
│   ├── hyperlink_tools.py         # Hyperlink management
│   ├── connector_tools.py         # Connectors
│   ├── master_tools.py            # Slide masters
│   └── transition_tools.py        # Transitions
├── utils/                         # 7 utility modules
│   ├── template_utils.py          # Template system (1,142 lines)
│   ├── design_utils.py            # Design tools (688 lines)
│   ├── content_utils.py           # Content ops (578 lines)
│   ├── validation_utils.py        # Validation (322 lines)
│   └── presentation_utils.py      # Presentation ops (216 lines)
├── slide_layout_templates.json    # 31+ template definitions
├── Dockerfile                     # Docker configuration
└── docker-compose.yml             # Docker Compose setup

做出贡献

这个项目融合了:

请参阅各个仓库的贡献指南。

许可证

MIT 许可证 - 详情请参见 LICENSE 文件。

版本

2.3.0 - FastMCP版,具备完整的PowerPoint功能(已修复工具模式问题)

支持

对于问题:

  • ChukMCPServer:https://github.com/chrishayuk/chuk-mcp-server/issues
  • PowerPoint 功能特性:https://github.com/yourusername/Office-PowerPoint-MCP-Server/issues