PowerPoint Automation MCP Server

PowerPoint Automation MCP Server

Enables AI assistants to create, modify, and manage PowerPoint presentations programmatically using python-pptx.

Category
访问服务器

README

PowerPoint Automation MCP Server

A Model Context Protocol (MCP) server that provides comprehensive PowerPoint automation capabilities using python-pptx. This server enables AI assistants to create, modify, and manage PowerPoint presentations programmatically.

Demo

https://github.com/user-attachments/assets/3daf3bef-4d75-4639-a891-0e64b80b4807

Features

  • Presentation Management: Create, open, save, and close presentations
  • Slide Operations: Add, delete, and manage slides with various layouts
  • Content Creation: Add text boxes, images, tables, and charts
  • Text Formatting: Update text with font styling (name, size, bold, italic)
  • Shape Manipulation: Move, resize, and modify shape properties
  • Table Operations: Create tables and update cell content
  • Chart Creation: Add various chart types (column, line, pie, bar) with data
  • Group Management: Ungroup shapes for easier manipulation
  • Layout Support: Work with different slide layouts and placeholders

Recommended Prompts

Translation Scenario

For translating presentations, process in batches to avoid context overflow and ensure data safety:

Translate this presentation [absolute path of ppt], processing 10 slides at a time and saving after each batch of 10 slides.

This approach:

  • Prevents token limit issues on large presentations
  • Saves progress incrementally to avoid data loss
  • Allows for review between batches

Installation

git clone https://github.com/buckylee2019/powerpoint-automation-mcp.git
cd powerpoint-automation-mcp
uv sync

Running the Server

uv run --directory /path/to/powerpoint-automation-mcp mcp-ppt-server

API Reference

The server provides 25+ tools for comprehensive PowerPoint automation. All operations work with a single active presentation to simplify the API.

Presentation Management

initialize_powerpoint() -> bool

Initialize the PowerPoint automation system.

create_presentation(template: str = None) -> Dict

Create a new presentation, optionally from a template.

  • template: Optional path to template file

open_presentation(file_path: str) -> Dict

Open an existing PowerPoint file.

  • file_path: Full path to .pptx file

get_presentation() -> Dict

Get information about the currently active presentation.

save_presentation(path: str = None) -> Dict

Save the active presentation.

  • path: Optional save path (uses current path if omitted)

close_presentation() -> Dict

Close the active presentation.

Slide Management

get_slides() -> List[Dict]

Get list of all slides with metadata.

add_slide(layout_index: int = 1) -> Dict

Add a new slide with specified layout.

  • layout_index: Layout type (0=Title, 1=Title+Content, etc.)

delete_slide(slide_index: int) -> Dict

Delete a slide from the presentation.

  • slide_index: 0-based slide index

get_slide_layouts() -> Dict

Get all available slide layouts with their properties.

set_slide_title(slide_index: int, title: str) -> Dict

Set the title of a slide.

Content Inspection

get_slide_shapes(slide_index: int) -> Dict

ALWAYS RUN FIRST! Get all shapes in a slide with properties and IDs.

  • Returns shape types, positions, sizes, and text content
  • Identifies grouped shapes that may need ungrouping

get_slide_text(slide_index: int) -> Dict

Get all text content in a slide organized by shape.

  • Detects grouped shapes that may need ungrouping first

Text and Shape Manipulation

update_text(slide_index: int, shape_index: int, text: str, font_name: str = None, font_size: int = None, bold: bool = None, italic: bool = None, preserve_existing: bool = True) -> Dict

Update text content with optional formatting.

  • Supports font styling while preserving existing formatting
  • preserve_existing: Keep original formatting for unspecified properties

update_shape_by_id(slide_index: int, shape_id: str, text: str = None, left: float = None, top: float = None, width: float = None, height: float = None) -> Dict

Update shape properties by ID.

  • Positions and sizes in inches

Content Creation

add_textbox(slide_index: int, text: str, left: float = 1, top: float = 1, width: float = 4, height: float = 2) -> Dict

Add a text box to a slide.

add_image(slide_index: int, image_path: str, left: float = 1, top: float = 1, width: float = None, height: float = None) -> Dict

Add an image to a slide.

  • Maintains aspect ratio if only width or height specified

add_table(slide_index: int, rows: int, cols: int, left: float = 1, top: float = 1, width: float = 8, height: float = 4) -> Dict

Add a table to a slide.

add_chart(slide_index: int, chart_type: str, categories: List[str], series_names: List[str], series_values: List[List[float]], left: float = 1, top: float = 1, width: float = 8, height: float = 4, has_legend: bool = True) -> Dict

Add a chart with multiple data series.

  • chart_type: 'COLUMN', 'LINE', 'PIE', 'BAR'
  • categories: X-axis labels
  • series_names: Legend labels
  • series_values: Data values for each series

Table Operations

update_table_cell(slide_index: int, shape_index: int, row: int, col: int, text: str) -> Dict

Update text in a specific table cell.

get_table_content(slide_index: int, shape_index: int) -> Dict

Retrieve all content from a table.

Advanced Operations

ungroup_shapes(slide_index: int) -> Dict

Ungroup all text-containing groups in a slide.

  • Only processes simple groups (no nested groups)
  • Preserves shape positions and properties
  • Skips groups without text content

Usage Workflow

  1. Initialize: Call initialize_powerpoint()
  2. Open/Create: Use open_presentation() or create_presentation()
  3. Inspect: Always run get_slide_shapes() first to understand slide structure
  4. Ungroup if needed: Use ungroup_shapes() if grouped shapes are detected
  5. Modify: Use appropriate tools to add/modify content
  6. Save: Call save_presentation() to persist changes

Error Handling

All functions return dictionaries with either success data or error information:

// Success response
{
  "success": true,
  "message": "Operation completed",
  "data": {...}
}

// Error response
{
  "error": "Description of what went wrong"
}

MCP Configuration

Add to your MCP settings:

{
  "mcpServers": {
    "powerpoint-automation": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/powerpoint-automation-mcp",
        "mcp-ppt-server"
      ]
    }
  }
}

Dependencies

  • python-pptx: PowerPoint file manipulation
  • mcp: Model Context Protocol framework
  • fastmcp: Simplified MCP server creation

License

MIT License - see LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选