PowerPoint MCP Server

by jenstangen1
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides integration with GitHub for cloning the repository, allowing users to install the PowerPoint MCP server from version control.

  • Integrates with NumPy for numerical operations when generating financial charts and data-driven content in PowerPoint presentations.

  • Built on Python, allowing users to run the server and interact with PowerPoint files through Python commands for creating and manipulating presentations.

PowerPoint MCP 服务器

一个模型上下文协议 (MCP) 服务器,用于在 AI 辅助下创建和操作 PowerPoint 演示文稿。该服务器为 AI 模型提供了全面的 API,可与 PowerPoint 文件进行交互,并支持高级格式、财务图表和数据集成。

特征

演示管理

  • 创建和修改 PowerPoint 演示文稿
  • 添加、删除和修改幻灯片
  • 从工作区保存和加载演示文稿
  • 模板管理系统

元素操作

  • 对幻灯片元素(文本、形状、图像、图表)进行细粒度控制
  • 高级形状创建和造型
  • 元素定位和分组
  • 形状之间的连接线

金融一体化

  • 创建财务图表(折线图、条形图、柱形图、饼图、瀑布图等)
  • 生成比较表
  • 支持各种财务指标:
    • 收入
    • 息税折旧摊销前利润
    • 利润
    • 资产
    • 公平
    • 增长率
    • 边距
  • 目前使用虚拟数据,计划整合 Proff API 获取挪威公司数据
  • 通过API定制适应其他金融数据提供商

样式和格式

  • 富文本格式
  • 形状样式(填充、渐变、轮廓)
  • 图表定制
  • 背景颜色和效果

安装

  1. 克隆存储库:
git clone https://github.com/jenstangen1/pptx-mcp.git cd pptx-mcp
  1. 安装依赖项:
pip install -r requirements.txt

与 Claude 一起设置

将 MCP 安装到 Claude 的界面中

要将此 PowerPoint MCP 与 Claude 集成,请将以下 JSON 配置添加到您的 Claude MCP 文件中:

{ "mcpServers": { "powerpoint_mcp": { "command": "uv", "args": [ "--directory", "your directory here", "run", "mcp_powerpoint_server.py" ] } } }

注意:您可能需要修改目录路径以匹配您的安装位置。

可用的 MCP 工具

演示管理

  • list_presentations :列出工作区中的所有 PowerPoint 文件
  • upload_presentation :将新演示文稿上传到工作区
  • save_presentation :保存当前演示文稿

滑动操作

  • add_slide :向演示文稿添加新幻灯片
  • delete_slide :从演示文稿中删除幻灯片
  • get_slide_count :获取演示文稿中的幻灯片总数
  • analyze_slide :分析幻灯片的内容
  • set_background_color :设置幻灯片的背景颜色

元素操作

  • add_text :向幻灯片添加文本
  • add_shape :向幻灯片添加形状
  • edit_element :编辑元素的属性
  • style_element :将样式应用于元素
  • connect_shapes :用连接器连接两个形状
  • find_element :根据条件在幻灯片上查找元素

金融工具

  • get_company_financials :获取公司的财务数据(当前返回虚拟数据)
  • create_financial_chart :在幻灯片上创建财务图表
  • create_comparison_table :创建公司比较表

**注:**财务工具目前使用虚拟数据。未来版本计划与 Proff API 集成,以自动获取挪威公司数据。用户可以修改代码,以连接本地或首选的财务数据提供商。

模板操作

  • list_templates :列出所有可用的模板
  • apply_template :将模板应用于演示文稿
  • create_slide_from_template :从模板创建新幻灯片
  • save_as_template :将幻灯片保存为模板

调试工具

  • debug_element_mappings :用于检查幻灯片元素映射的调试工具

用法

启动服务器

运行服务器:

python mcp_powerpoint_server.py

如果不存在,服务器将为演示文稿和模板创建一个工作区目录。

基本操作

# List presentations presentations = mcp.list_presentations() # Create a new slide slide_index = mcp.add_slide(presentation_path, layout_name="Title and Content") # Add text to a slide element_id = mcp.add_text( presentation_path=presentation_path, slide_index=slide_index, text="Hello World", position=[1.0, 1.0], font_size=24 ) # Add a shape shape_id = mcp.add_shape( presentation_path=presentation_path, slide_index=slide_index, shape_type="rectangle", position={"x": 2.0, "y": 2.0}, size={"width": 2.0, "height": 1.0} )

财务图表

# Create a financial chart chart_id = mcp.create_financial_chart( presentation_path=presentation_path, slide_index=slide_index, chart_type="column", data={ "categories": ["2020", "2021", "2022"], "series": [{ "name": "Revenue", "values": [1000000, 1200000, 1500000] }] }, position={"x": 1.0, "y": 1.0}, size={"width": 6.0, "height": 4.0}, title="Revenue Growth" ) # Create a comparison table table_id = mcp.create_comparison_table( presentation_path=presentation_path, slide_index=slide_index, companies=["Company A", "Company B"], metrics=["revenue", "ebitda", "margin"], position={"x": 1.0, "y": 1.0}, title="Company Comparison" )

模板管理

# List available templates templates = mcp.list_templates() # Apply a template mcp.apply_template( presentation_path=presentation_path, template_name="financial_report", options={ "apply_master": True, "apply_theme": True, "apply_layouts": True } ) # Create a slide from template mcp.create_slide_from_template( presentation_path=presentation_path, template_name="comparison_slide", content={ "title": "Market Analysis", "subtitle": "Q3 2023" } )

目录结构

pptx-mcp/ ├── mcp_powerpoint_server.py # Main server implementation ├── requirements.txt # Python dependencies ├── presentations/ # Workspace for presentations │ └── templates/ # Template storage └── README.md # This file

依赖项

  • python-pptx:PowerPoint 文件操作
  • 枕头:图像处理
  • numpy:数值运算
  • MCP SDK:模型上下文协议实现

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

ID: b4ed10vdym