Skip to main content
Glama

PPTX MCP 服务器

一个基于 FastMCP 的服务器,用于以编程方式创建、编辑和渲染 PowerPoint (PPTX) 演示文稿。支持幻灯片创建、文本和形状插入、图像嵌入以及将幻灯片渲染为 PNG(使用 LibreOffice)。

特征

  • **创建/清除演示文稿:**开始新的或重置现有的 PPTX 文件。

  • **添加幻灯片:**插入具有可自定义布局的幻灯片。

  • **文本和内容:**向幻灯片添加标题、内容和自定义文本框。

  • **形状:**插入各种各样的 PowerPoint 形状(包括流程图元素)。

  • **图像:**将图像嵌入幻灯片。

  • **幻灯片描述:**获取幻灯片内容的文本摘要以供验证。

  • **幻灯片渲染:**将幻灯片渲染为 PNG 图像(需要 LibreOffice)。

  • **下载PPTX:**下载生成的演示文稿文件。

Related MCP server: PowerPoint MCP Server

要求

  • Python 3.12+

  • python-pptx

  • 枕头

  • FastMCP

  • LibreOffice (用于幻灯片图像渲染;必须单独安装并位于系统 PATH 中)

安装

  1. 安装 Python 依赖项:

    pip install -r requirements.txt

    (或者查看

  2. 安装 LibreOffice (用于图像渲染):

    • Linux: sudo pacman -S libreoffice-freshsudo apt install libreoffice

    • macOS: brew install --cask libreoffice

    • Windows:从 libreoffice.org 下载

用法

启动服务器:

python server.py

您可以使用环境变量设置服务器的主机和端口:

  • HOST (默认值: 127.0.0.1

  • PORT (默认值: 8000

例如,要在所有接口和端口 9000 上运行:

HOST=0.0.0.0 PORT=9000 python server.py

或者(使用 FastMCP 进行开发):

fastmcp dev server.py

API 概述

服务器通过 FastMCP 公开工具和资源,包括:

  • create_or_clear_presentation(filename)

  • add_slide(filename, layout_index)

  • add_title_and_content(filename, slide_index, title, content)

  • add_textbox(filename, slide_index, text, left_inches, top_inches, width_inches, height_inches, font_size_pt, bold)

  • add_shape(filename, slide_index, shape_type_name, left_inches, top_inches, width_inches, height_inches, text)

  • add_picture(filename, slide_index, image, left_inches, top_inches, width_inches, height_inches)

  • get_slide_content_description(filename, slide_index)

  • get_slide_image(filename, slide_index)(需要 LibreOffice)

  • get_pptx_file(filename)

查看代码以了解完整的参数详细信息和可用的形状类型。

演示文稿和模板

  • 演示文稿保存在presentations/目录中。

  • 您可以在presentations/templates/中添加自己的模板。

执照

请参阅许可证以了解详情。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samos123/pptx-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server