内容
# MCP PowerPoint 插件
一个用于 PowerPoint 操作的模型上下文协议 (Model Context Protocol, MCP) 插件,允许 AI 助手以编程方式创建和操作 PowerPoint 演示文稿。
## 特性
- 创建新的 PowerPoint 演示文稿
- 向演示文稿添加幻灯片
- 获取演示文稿中的幻灯片信息
- 将演示文稿导出为 PDF
- 读取演示文稿的元数据和结构
## 安装
```bash
# 克隆仓库
git clone https://github.com/islem-zaraa/mcp-powerpoint.git
# 进入项目目录
cd mcp-powerpoint
# 安装依赖
npm install
# 本地开发链接
npm link
```
## 作为 CLI 使用
该插件可以直接作为命令行工具使用:
```bash
# 创建一个新的演示文稿
mcp-powerpoint create --outputPath="presentation.pptx" --title="My Presentation"
# 向现有演示文稿添加幻灯片
mcp-powerpoint add-slide --file="presentation.pptx" --title="New Slide" --content="This is the content of the slide"
# 获取演示文稿中的幻灯片
mcp-powerpoint get-slides --file="presentation.pptx"
# 将演示文稿导出为 PDF
mcp-powerpoint export-pdf --file="presentation.pptx" --outputPath="presentation.pdf"
# 读取演示文稿的元数据
mcp-powerpoint read --file="presentation.pptx"
```
## 作为 MCP 插件使用
该插件可以集成到兼容 MCP 的 AI 助手系统中:
```javascript
const mcpPowerPointPlugin = require('mcp-powerpoint/src/mcp-plugin');
// 在你的 MCP 系统中注册插件
mcpSystem.registerPlugin(mcpPowerPointPlugin);
// 现在 AI 可以通过 MCP 协议使用 PowerPoint 功能
// 示例函数调用:
// - mcp_powerpoint_create_presentation
// - mcp_powerpoint_add_slide
// - mcp_powerpoint_get_slides
// - mcp_powerpoint_export_to_pdf
// - mcp_powerpoint_read_presentation
```
## 函数描述
### mcp_powerpoint_create_presentation
创建一个新的 PowerPoint 演示文稿。
**参数:**
- `outputPath`: 保存 PowerPoint 文件的路径(必须以 .pptx 结尾)
- `title`: (可选)演示文稿的标题
### mcp_powerpoint_add_slide
向现有的 PowerPoint 演示文稿添加幻灯片。
**参数:**
- `file`: PowerPoint 文件的路径
- `title`: (可选)幻灯片的标题
- `content`: (可选)幻灯片的内容
### mcp_powerpoint_get_slides
从 PowerPoint 演示文稿中获取幻灯片。
**参数:**
- `file`: PowerPoint 文件的路径
### mcp_powerpoint_export_to_pdf
将 PowerPoint 演示文稿导出为 PDF。
**参数:**
- `file`: PowerPoint 文件的路径
- `outputPath`: 保存 PDF 文件的路径(必须以 .pdf 结尾)
### mcp_powerpoint_read_presentation
读取 PowerPoint 演示文稿的元数据和结构。
**参数:**
- `file`: PowerPoint 文件的路径
## 限制
- 该插件目前提供基本的 PowerPoint 功能
- 由于 PPTX 格式的复杂性,编辑现有幻灯片存在限制
- PDF 导出在此版本中是一个模拟功能
## 许可证
MIT
## 贡献
欢迎贡献!请随时提交 Pull Request。 ### 主题
- mcp
- model-context-protocol
- mcp-server
- powerpoint
- presentation
- slides
- office