Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

gavanduffy/slides-mcp

Repository files navigation

Slides MCP Server

A Model Context Protocol (MCP) server that converts structured JSON slideshows to PowerPoint presentations (PPTX) via LibreOffice.

Overview

This MCP server enables LLMs to generate PowerPoint presentations by:

  1. Converting markdown outlines to structured JSON (done by LLM)
  2. Building OpenDocument Presentation (ODP) files from JSON
  3. Converting ODP to PPTX using LibreOffice headless mode
  4. Returning the presentation file or base64-encoded data

Prerequisites

  • Node.js 18 or higher
  • LibreOffice (for ODP to PPTX conversion)

Installing LibreOffice

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install libreoffice-impress

macOS:

brew install --cask libreoffice

Windows: Download and install from LibreOffice website

Installation

npm install
npm run build

Usage

Stdio Mode (for MCP clients)

npm start:stdio

Or directly:

node dist/server/stdioServer.js

HTTP Mode (for web integration)

npm start:http

The server will start on http://localhost:3000 (or the port specified by the PORT environment variable).

Configuration

To use with an MCP client like Claude Desktop, add to your MCP configuration:

{
  "mcpServers": {
    "slides-mcp": {
      "command": "node",
      "args": ["/path/to/slides-mcp/dist/server/stdioServer.js"]
    }
  }
}

See mcp-config-example.json for a complete example.

MCP Tool: json_to_pptx

Input Schema

{
  "slideshow": {
    "meta": {
      "title": "Presentation Title",
      "author": "Author Name (optional)"
    },
    "masters": [
      {
        "name": "Master Name",
        "backgroundColor": "#ffffff (optional)"
      }
    ],
    "images": [
      {
        "id": "img1",
        "dataBase64": "base64-encoded-image-data",
        "mimeType": "image/png"
      }
    ],
    "slides": [
      {
        "id": "slide1 (optional)",
        "title": "Slide Title (optional)",
        "elements": [
          {
            "type": "text",
            "placeholder": "title or content (optional)",
            "text": "Text content",
            "bullet": false,
            "level": 0
          },
          {
            "type": "image",
            "imageRef": "img1",
            "x": 2,
            "y": 3,
            "width": 10,
            "height": 8
          }
        ],
        "notes": {
          "plainText": "Speaker notes",
          "paragraphs": ["Para 1", "Para 2"]
        }
      }
    ]
  },
  "options": {
    "returnBase64": false
  }
}

Output

  • File mode (default): Returns path to generated PPTX file
  • Base64 mode: Returns base64-encoded PPTX data

Example

See example-slideshow.json for a complete example of a slideshow JSON structure.

Development

Build

npm run build

Watch mode

npm run watch

Run tests

npm test

Lint

npm run lint

Docker

Build Docker image

docker build -f docker/Dockerfile -t slides-mcp .

Run with HTTP transport

docker run -p 3000:3000 slides-mcp

Run with stdio transport

docker run -i slides-mcp node dist/server/stdioServer.js

Architecture

User markdown
  → LLM parsing prompt
    → slideshow JSON
      → MCP tool json_to_pptx(slideshow JSON)
        → ODP package
          → LibreOffice headless
            → PPTX file

Project Structure

src/
  schema/
    slideshowSchema.ts    # Zod schema and types
  odp/
    index.ts              # ODP orchestrator
    contentXml.ts         # Slide content generation
    stylesXml.ts          # Master styles and formatting
    metaXml.ts            # Document metadata
    manifestXml.ts        # ODP package manifest
    images.ts             # Image embedding
    zip.ts                # ODP ZIP packaging
  libreoffice/
    convert.ts            # ODP to PPTX converter
  tools/
    jsonToPptx.ts         # MCP tool implementation
  server/
    serverCore.ts         # Core MCP server logic
    stdioServer.ts        # Stdio transport
    httpServer.ts         # HTTP transport

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •