PowerPoint CLI工具

一个独立的命令行工具,用于创建和编辑PowerPoint文件,支持从模板创建、添加幻灯片、文本、图片等功能。

  • by tmustier
  • TypeScript
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 tmustier/powerpoint-cli

使用说明

powerpoint cli

用于创建和编辑PowerPoint的独立CLI(.pptx)文件,包装 office powerpoint mcp服务器 通过 麦克波特.

原始项目是用于PowerPoint操作的MCP(模型上下文协议)服务器。此repo将其打包为CLI,因此可以直接从命令行使用或作为 代理技能-兼容的技能——无需将37个工具模式加载到代理上下文中。

它做什么

  • 从头开始或从模板创建演示文稿
  • 添加幻灯片、文本、项目符号、图像、表格、图表、形状、连接器
  • 应用专业主题和配色方案
  • 从主题自动生成演示文稿
  • 提取文本并检查幻灯片结构
  • 管理超链接、过渡、字体和文档属性

它不做什么

  • 在GUI中打开或显示演示文稿
  • 转换为PDF或其他格式
  • 处理动画或视频/音频嵌入
  • 就地编辑现有文本(您可以添加新文本或替换占位符)

需求

  • 包子 运行时
  • 紫外线 (对于底层Python MCP服务器,在首次运行时安装)

安装

# Install bun if needed
curl -fsSL https://bun.sh/install | bash

# Install uv if needed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone
git clone https://github.com/tmustier/powerpoint-cli.git

作为一种pi技能

git clone https://github.com/tmustier/powerpoint-cli.git ~/.pi/agent/skills/powerpoint

当您要求代理处理PowerPoint文件时,该技能会自动加载。

用法

批处理模式(用于多步骤工作流)

服务器是有状态的——创建、构建,然后保存。使用批处理运行器:

echo '{
  "commands": [
    { "tool": "create_presentation" },
    { "tool": "add_slide", "args": { "title": "Hello World" } },
    { "tool": "manage_text", "args": {
      "slide_index": 0, "operation": "add",
      "left": 1, "top": 2, "width": 8, "height": 1,
      "text": "Welcome!", "font_size": 24
    }},
    { "tool": "save_presentation", "args": { "file_path": "./output.pptx" } }
  ]
}' | bun powerpoint-batch.ts

还接受文件或 --recipe 标志:

bun powerpoint-batch.ts recipe.json
bun powerpoint-batch.ts --recipe '{"commands": [...]}'

批处理运行器自动跟踪 presentation_id 跨命令。

单命令模式

对于一次性或只读操作:

bun powerpoint-cli.js list-slide-templates
bun powerpoint-cli.js get-template-info --template-id title_slide
bun powerpoint-cli.js --help

看 技能.md 获取包含所有参数的完整工具参考。

运作原理

powerpoint-cli.js 由生成 麦克波特 generate-cli它正在孕育 office powerpoint mcp服务器 作为stdio上的子进程,将CLI标志/JSON转换为MCP工具调用。

powerpoint-batch.ts 使单个服务器会话在多个命令之间保持活动状态,围绕 已知上游错误 哪里 create_presentation 不设置活动演示ID(定义了执行此操作的包装器,但从未应用)。

再生

npx mcporter generate-cli \
  --command "uvx --from office-powerpoint-mcp-server ppt_mcp_server" \
  --name powerpoint \
  --output powerpoint-cli.ts \
  --bundle powerpoint-cli.js

已知问题

上游MCP服务器具有 状态持久性错误 使用stdio传输: create_presentation 将演示文稿存储在内存中,但从不将其设置为活动演示文稿(此演示文稿的包装器代码存在,但从未应用)。一些MCP客户端还会在每次调用时重新生成stdio进程,完全失去状态。

批处理运行器(powerpoint-batch.ts)通过在整个会话中保持单个服务器进程处于活动状态和自动注入来解决这两个问题 presentation_id 进入后续命令。如果你使用 powerpoint-cli.js 直接来说,每个调用都是独立的——只对无状态/只读命令使用它。

许可证

麻省理工学院