Office-PowerPoint-MCP-Server

repository·main·Indexed 23 days ago

https://github.com/gongrzhe/office-powerpoint-mcp-server

A Model Context Protocol (MCP) server for creating, manipulating, and designing PowerPoint presentations using python-pptx. Version 2.0.7 provides 34 specialized tools for presentation management, content creation, template operations, and professional design, including unified tools for text, image, and theme management. It supports Stdio, HTTP, and Docker deployment modes and integrates with Claude Desktop.

Tokens
8.5K
Snippets
18
Records
28
Agent score
33%

What's inside office-powerpoint-mcp-server

  1. Apply professional color schemes to templates

    main

    All built-in templates work with four professional color schemes. These schemes include primary, secondary, accent, light, and text colors optimized for business use:

    • modern_blue: Microsoft-inspired theme with dynamic gradients.
    • corporate_gray: Professional grayscale with blue accents.
    • elegant_green: Forest green theme with cream and light accents.
    • warm_red: Deep red theme with orange and yellow highlights.
  2. Work with slide templates

    main

    The server provides several tools for template-based workflows:

    • list_slide_templates: Lists available templates and their features.
    • apply_slide_template: Applies an existing template to a slide using template_id and content_mapping to fill placeholders.
    • create_slide_from_template: Creates a new slide from a template, supporting content_mapping and image_paths for images.
    • create_presentation_from_templates: Generates a full presentation by providing a template_sequence of template IDs and their respective content.
    • get_template_info: Inspects a .pptx file to see its layouts and properties.
    • create_presentation_from_template: Creates a new presentation based on a specific template file path.
    # List all available slide templates with their features
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="list_slide_templates",
        arguments={}
    )
    
    # Apply a professional template to an existing slide
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="apply_slide_template",
        arguments={
            "slide_index": 0,
            "template_id": "title_slide",
            "color_scheme": "modern_blue",
            "content_mapping": {
                "title": "Quarterly Business Review",
                "subtitle": "Q4 2024 Results",
                "author": "Leadership Team"
            }
        }
    )
    
    # Create a new slide using a template
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="create_slide_from_template",
        arguments={
            "template_id": "text_with_image",
            "color_scheme": "elegant_green",
            "content_mapping": {
                "title": "Our Revolutionary Solution",
                "content": "• 250% increase in efficiency\n• 98% customer satisfaction\n• Industry-leading performance"
            },
            "image_paths": {
                "supporting": "path/to/product_image.jpg"
            }
        }
    )
    
    # Generate a complete presentation from multiple templates
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="create_presentation_from_templates",
        arguments={
            "template_sequence": [
                {
                    "template_id": "title_slide",
                    "content": {
                        "title": "2024 Annual Report",
                        "subtitle": "Growth and Innovation",
                        "author": "Executive Team"
                    }
                },
                {
                    "template_id": "key_metrics_dashboard",
                    "content": {
                        "metric_1_value": "94%",
                        "metric_2_value": "$2.4M",
                        "metric_3_value": "247"
                    }
                },
                {
                    "template_id": "before_after_comparison",
                    "content": {
                        "content_left": "Manual processes taking hours",
                        "content_right": "Automated workflows in minutes"
                    }
                }
            ],
            "color_scheme": "modern_blue"
        }
    )
  3. Install Office-PowerPoint-MCP-Server using the Setup Script

    main

    The recommended way to set up the server is using the provided setup_mcp.py script, which automates prerequisite checks, dependency installation, and MCP configuration generation.

    Run the following command:

    python setup_mcp.py

    Options provided by the script:

    • Install from PyPI (recommended).
    • Set up a local development environment.
    • Configure using uvx (if installed).
    • Integrate with Claude Desktop.
  4. Manual Installation of Office-PowerPoint-MCP-Server

    main

    If you prefer to install manually, follow these steps:

    1. Clone the repository:
      git clone https://github.com/GongRzhe/Office-PowerPoint-MCP-Server.git
      cd Office-PowerPoint-MCP-Server
    2. Install dependencies:
      pip install -r requirements.txt
    3. Make the server executable:
      chmod +x ppt_mcp_server.py
    git clone https://github.com/GongRzhe/Office-PowerPoint-MCP-Server.git
    cd Office-PowerPoint-MCP-Server
    pip install -r requirements.txt
    chmod +x ppt_mcp_server.py
  5. Workflow for using PowerPoint templates

    main

    To create a presentation based on an existing template while maintaining branding (themes, fonts, colors), follow this workflow:

    1. Inspect Template: Use the get_template_info tool to analyze available layouts and properties within your template files.
    2. Create from Template: Use create_presentation_from_template to generate a new presentation. This tool automatically preserves the template's theme.
    3. Use Template Layouts: When adding new slides, reference the specific layout indices discovered during the inspection step.

    Templates can contain existing slides which are preserved during the creation process.

  6. Configure the MCP Server in Claude Desktop

    main

    You can add the server to your MCP settings using either a local Python installation or via uvx (which requires no local installation).

    Option 1: Local Python Server

    Use this if you have installed the server locally via pip or the setup script:

    {
      "mcpServers": {
        "ppt": {
          "command": "python",
          "args": ["/path/to/ppt_mcp_server.py"],
          "env": {}
        }
      }
    }

    If you have uvx installed, you can run the server directly from PyPI:

    {
      "mcpServers": {
        "ppt": {
          "command": "uvx",
          "args": [
            "--from", "office-powerpoint-mcp-server", "ppt_mcp_server"
          ],
          "env": {}
        }
      }
    }
  7. Configure custom template paths via PPT_TEMPLATE_PATH

    main

    The PowerPoint MCP Server allows you to use existing .pptx or .potx files as templates for new presentations. To specify custom directories where the server should look for these templates, set the PPT_TEMPLATE_PATH environment variable.

    Supported search locations by default include the current directory, ./templates, ./assets, and ./resources. If you provide a custom path, the server will include it in its search logic.

    # Unix/Linux/macOS
    export PPT_TEMPLATE_PATH="/path/to/templates:/another/path"
    
    # Windows  
    set PPT_TEMPLATE_PATH="C:\templates;C:\company_templates"
  8. Manage images and picture effects

    main

    Image management is handled via the manage_image and apply_picture_effects tools:

    • manage_image: Use operation: "add" to insert an image with specific dimensions (left, top, width, height) and an enhancement_style (e.g., "presentation").
    • apply_picture_effects: Apply multiple effects (like shadow or glow) to a shape at once. For example, you can define shadow_type, blur_radius, distance, and color (as an RGB list) within the effects argument.
    # Add image with automatic enhancement - CONSOLIDATED TOOL
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="manage_image",
        arguments={
            "slide_index": 1,
            "operation": "add",
            "image_source": "company_logo.png",
            "left": 1.0,
            "top": 1.0,
            "width": 3.0,
            "height": 2.0,
            "enhancement_style": "presentation"
        }
    )
    
    # Apply multiple picture effects at once - CONSOLIDATED TOOL
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="apply_picture_effects",
        arguments={
            "slide_index": 1,
            "shape_index": 0,
            "effects": {
                "shadow": {
                    "shadow_type": "outer",
                    "blur_radius": 4.0,
                    "distance": 3.0,
                    "direction": 315.0,
                    "color": [128, 128, 128],
                    "transparency": 0.6
                },
                "glow": {
                    "size": 5.0,
                    "color": [0, 176, 240],
                    "transparency": 0.4
                }
            }
        }
    )
  9. Manage and validate text

    main

    The manage_text tool provides advanced text control:

    • operation: "add": Creates and formats text in one step, allowing you to set font_size, font_name, bold, color (RGB list), and alignment.
    • operation: "validate": Checks if text fits within its shape. If validation_only is set to False, the tool will attempt to auto-fix the issue by adjusting the font size within the min_font_size and max_font_size bounds.
    # Add and format text in one operation - CONSOLIDATED TOOL
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="manage_text",
        arguments={
            "slide_index": 0,
            "operation": "add",
            "left": 1.0,
            "top": 2.0,
            "width": 8.0,
            "height": 1.5,
            "text": "Welcome to Our Quarterly Review",
            "font_size": 32,
            "font_name": "Segoe UI",
            "bold": True,
            "color": [0, 120, 215],
            "alignment": "center",
            "auto_fit": True
        }
    )
    
    # Validate and fix text fit issues - SAME TOOL, DIFFERENT OPERATION
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="manage_text",
        arguments={
            "slide_index": 0,
            "operation": "validate",
            "shape_index": 0,
            "validation_only": False,  # Auto-fix enabled
            "min_font_size": 10,
            "max_font_size": 48
        }
    )
  10. Add charts and data visualization

    main

    Use the add_chart tool to insert data-driven visualizations. You can specify the chart_type (e.g., "column"), categories (X-axis labels), series_names, and series_values (a list of lists containing the data points). It also supports formatting options like has_legend, legend_position, has_data_labels, and a chart title.

    # Add a chart slide
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="add_slide",
        arguments={
            "layout_index": 1,  # Content slide layout
            "title": "Sales Data",
            "presentation_id": presentation_id
        }
    )
    slide_index = result["slide_index"]
    
    # Add a column chart with comprehensive customization
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="add_chart",
        arguments={
            "slide_index": slide_index,
            "chart_type": "column",
            "left": 1.0,
            "top": 2.0,
            "width": 8.0,
            "height": 4.5,
            "categories": ["Q1", "Q2", "Q3", "Q4"],
            "series_names": ["2023", "2024"],
            "series_values": [
                [100, 120, 140, 160],
                [110, 130, 150, 170]
            ],
            "has_legend": True,
            "legend_position": "bottom",
            "has_data_labels": True,
            "title": "Quarterly Sales Performance",
            "presentation_id": presentation_id
        }
    )
  11. Apply professional design and themes

    main

    Use the apply_professional_design tool to quickly style your presentation. It supports two main operations:

    1. operation: "slide": Applies styling to a specific slide using slide_type (e.g., title_content) and a color_scheme (e.g., modern_blue).
    2. operation: "theme": Applies a color scheme to the entire presentation. Set apply_to_existing: True to update an existing deck.
    # Create a professional slide with modern styling - CONSOLIDATED TOOL
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="apply_professional_design",
        arguments={
            "operation": "slide",
            "slide_type": "title_content",
            "color_scheme": "modern_blue",
            "title": "Quarterly Business Review",
            "content": [
                "Revenue increased by 15% compared to last quarter",
                "Customer satisfaction scores reached all-time high of 94%",
                "Successfully launched 3 new product features",
                "Expanded team by 12 new talented professionals"
            ]
        }
    )
    
    # Apply professional theme to entire presentation - SAME TOOL, DIFFERENT OPERATION
    result = use_mcp_tool(
        server_name="ppt",
        tool_name="apply_professional_design",
        arguments={
            "operation": "theme",
            "color_scheme": "modern_blue",
            "apply_to_existing": True
        }
    )