npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@botrun/mcp-ppt-generator

v1.0.0

Published

MCP Server for converting Markdown to PowerPoint presentations

Readme

MCP PPT Generator

一個基於 Model Context Protocol (MCP) 的 PowerPoint 簡報產生器,讓 AI 助手能夠使用外部 PPTX 模板產生專業簡報。

專案目的

在實際工作場景中,使用者經常需要:

  1. 懶人模式:請 AI 搜尋資料後直接產出簡報
  2. 文字轉簡報:將一段文字(整理過或未整理過)轉換為簡報
  3. 套用模板:使用機關或公司的制式模板(如 Slidesgo 模板)產出簡報

本專案提供:

  • MCP Server:讓 Claude 等 AI 助手能夠直接產生 PPTX 檔案
  • Claude Code Skills:提供 /create-ppt/analyze-template 智能引導流程

功能特色

  • 外部模板支援:使用任何 PPTX 模板(如 Slidesgo、公司模板)
  • 智能文字替換:保留原始樣式和動畫,只替換文字內容
  • 模板分析:自動分析模板結構,識別投影片類型
  • 簡化 API:新架構只需指定「元素名稱 → 新文字」
  • 內建模板:提供 Professional 和 Clean 兩種內建樣式

安裝

# 複製專案
git clone https://github.com/anthropics/mcp-ppt-generator.git
cd mcp-ppt-generator

# 安裝依賴
npm install

# 編譯
npm run build

使用方式

整合至 Claude Code(推薦)

步驟 1:新增 MCP Server

claude mcp add ppt-generator node /path/to/mcp-ppt-generator/dist/index.js \
  -e PPT_TEMPLATE_DIR=/path/to/mcp-ppt-generator/templates \
  -e PPT_OUTPUT_DIR=/path/to/mcp-ppt-generator/output

步驟 2:安裝 Skills

# 複製到專案目錄
mkdir -p .claude/skills
cp -r /path/to/mcp-ppt-generator/skills/* .claude/skills/

步驟 3:使用

重啟 Claude Code 後:

# 首次使用外部模板,先分析模板
/analyze-template My-Template-Name

# 產生簡報
/create-ppt

整合至 Claude Desktop

編輯 Claude Desktop 設定檔:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "ppt-generator": {
      "command": "node",
      "args": ["/path/to/mcp-ppt-generator/dist/index.js"],
      "env": {
        "PPT_TEMPLATE_DIR": "/path/to/your/templates",
        "PPT_OUTPUT_DIR": "/path/to/output"
      }
    }
  }
}

MCP Tools

slides_to_pptx(推薦)

使用 slides.json 格式產生簡報,適用於外部模板。

參數

| 參數 | 類型 | 必填 | 說明 | |------|------|------|------| | slides_file | string | ✅ | slides.json 檔案路徑 | | save_file_path | string | | 指定輸出檔案的完整路徑 |

slides.json 格式

{
  "template": "My-Template-Name",
  "slides": [
    {
      "useSlide": 1,
      "replacements": {
        "Shape 7079": "我的標題",
        "Shape 7081": "副標題文字"
      }
    },
    {
      "useSlide": 3,
      "replacements": {
        "Shape 8785": "01",
        "Shape 8786": "專案概述",
        "Shape 8787": "02",
        "Shape 8788": "市場分析"
      }
    }
  ]
}

回傳

{
  "success": true,
  "message": "簡報產生成功",
  "file_path": "/path/to/output/presentation.pptx",
  "filename": "presentation.pptx",
  "slides_count": 5,
  "template": "My-Template-Name"
}

list_templates

列出所有可用的簡報模板(包含內建和外部模板)。

回傳

{
  "template_directory": "/path/to/templates",
  "built_in_templates": [
    { "id": "professional", "name": "Professional", "type": "built-in" },
    { "id": "clean", "name": "Clean", "type": "built-in" }
  ],
  "external_templates": [
    { "id": "My-Template-Name", "name": "My-Template-Name", "type": "external" }
  ]
}

analyze_template

分析外部 PPTX 模板的結構,提取每張投影片的元素資訊並儲存到檔案。

參數

| 參數 | 類型 | 必填 | 說明 | |------|------|------|------| | template | string | ✅ | 外部模板名稱(不含 .pptx) | | output_file | string | ✅ | 輸出檔案路徑 |

回傳

{
  "success": true,
  "message": "模板分析完成",
  "output_file": "templates/My-Template/elements.json",
  "totalSlides": 57
}

markdown_to_pptx

將 Markdown 檔案轉換為 PPTX 簡報(舊架構,適用於內建模板)。

參數

| 參數 | 類型 | 必填 | 說明 | |------|------|------|------| | markdown_file | string | ✅ | Markdown 檔案路徑 | | template | string | | 模板名稱(預設:professional) | | config_file | string | | 設定檔路徑(外部模板時必填) | | save_file_path | string | | 指定輸出檔案的完整路徑 | | filename | string | | 輸出檔名(預設:presentation) |

Claude Code Skills

/analyze-template

首次使用外部模板前,執行此 skill 來分析模板結構。

功能

  1. 將 PPTX 轉換為 PDF 和 PNG 預覽圖
  2. 提取所有投影片的元素資訊(elements.json)
  3. 使用 Gemini 分析投影片類型(analysis.json)

使用方式

/analyze-template My-Template-Name

輸出檔案

templates/My-Template-Name/
├── preview.pdf           # PDF 預覽
├── elements.json         # 元素資訊(元素名稱、原始文字)
├── analysis.json         # 類型資訊(title/toc/section/content/closing)
└── slides/
    ├── slide-001.png     # PNG 預覽圖
    ├── slide-002.png
    └── ...

環境需求

  • LibreOffice(用於 PPTX → PDF 轉換)
  • GEMINI_API_KEY 環境變數(用於 AI 分析投影片類型)

/create-ppt

智能簡報製作助手,引導用戶產生簡報。

流程

  1. 列出可用模板
  2. 讀取 analysis.json 了解投影片類型
  3. 讀取 elements.json 了解元素名稱
  4. 根據用戶內容規劃結構
  5. 建立 slides.json
  6. 呼叫 slides_to_pptx 產生簡報

使用方式

/create-ppt

# 或直接說需求
「幫我做一份關於 2025 旅遊趨勢的簡報」

工作流程

新架構流程(推薦)

1. 放置 PPTX 模板到 templates/ 目錄

2. /analyze-template My-Template
   → 產生 elements.json(元素名稱)
   → 產生 analysis.json(投影片類型)

3. /create-ppt
   → AI 讀取 analysis.json 選擇適當的投影片
   → AI 讀取 elements.json 取得元素名稱
   → 建立 slides.json
   → 呼叫 slides_to_pptx 產生簡報

檔案說明

| 檔案 | 產生方式 | 用途 | |------|----------|------| | elements.json | analyze_template MCP 工具 | 記錄元素名稱和原始文字 | | analysis.json | Gemini 分析 PDF | 記錄投影片類型和建議 | | slides.json | AI 產生 | 定義要產生的投影片內容 |

環境變數

| 變數 | 說明 | 預設值 | |------|------|--------| | PPT_TEMPLATE_DIR | 外部模板目錄 | ./templates | | PPT_OUTPUT_DIR | 輸出目錄 | ./output | | GEMINI_API_KEY | Gemini API 金鑰(analyze-template skill 需要) | - |

專案結構

mcp-ppt-generator/
├── src/
│   ├── index.ts                    # MCP Server 主程式
│   ├── parser/
│   │   └── index.ts                # Markdown 解析器
│   ├── generator/
│   │   ├── index.ts                # 內建模板產生器 (PptxGenJS)
│   │   └── template-generator.ts   # 外部模板產生器 (pptx-automizer)
│   ├── analyzer/
│   │   └── index.ts                # 模板分析器
│   └── templates/
│       └── index.ts                # 內建模板定義
├── skills/
│   ├── create-ppt/
│   │   └── SKILL.md                # 簡報製作 skill
│   └── analyze-template/
│       ├── SKILL.md                # 模板分析 skill
│       └── scripts/
│           ├── extract-elements.mjs      # 元素提取腳本
│           └── analyze-pdf-with-gemini.mjs  # Gemini 分析腳本
├── templates/                      # 外部 PPTX 模板目錄
├── output/                         # 輸出目錄
├── package.json
├── tsconfig.json
└── README.md

技術棧

  • Runtime: Node.js 18+
  • Language: TypeScript 5+
  • MCP SDK: @modelcontextprotocol/sdk
  • PPTX 產生:
  • PPTX 分析: JSZip
  • Schema 驗證: Zod
  • AI 分析: Google Gemini API

開發

# 開發模式(監聽檔案變更)
npm run dev

# 編譯
npm run build

# 使用 MCP Inspector 測試
npm run inspect

已知限制

  1. 文字樣式:使用 setText 方法,多段落文字可能會失去部分樣式
  2. 圖片支援:圖片功能尚在開發中
  3. 複雜動畫:複雜的動畫效果可能無法完整保留

授權

MIT License

相關連結