Skip to main content

MCP server for LibreOffice automation — presentations, documents, spreadsheets

Project description

LibreOffice MCP Server

A Model Context Protocol (MCP) server that gives agentic coding tools programmatic control over presentations (pptx), documents (docx), and spreadsheets (xlsx) — plus PDF export via LibreOffice headless mode.

Works with any MCP-compatible agent: Claude Code, Codex, OpenCode, Pi Agent, Cursor, Windsurf, etc.


Tools Overview

Presentations (presentation_*)

Tool Description
presentation_create Create a new .pptx with configurable dimensions
presentation_add_slide Add a slide (title / title_and_content / blank / title_only)
presentation_set_title Set a slide's title text
presentation_add_bullets Add bullet points to a slide
presentation_add_table Add a styled data table to a slide
presentation_add_image Add an image to a slide
presentation_export_pdf Convert .pptx.pdf via LibreOffice
presentation_info Get slide count, dimensions, titles

Documents (document_*)

Tool Description
document_create Create a new .docx
document_add_heading Add a heading at any level
document_add_paragraph Add formatted paragraph text
document_add_table Add a table with headers + rows

Spreadsheets (spreadsheet_*)

Tool Description
spreadsheet_create Create a new .xlsx
spreadsheet_add_sheet Add a worksheet
spreadsheet_set_cell Write a value to a cell
spreadsheet_add_chart Add a bar / column / line / pie chart

Prerequisites

  • Python 3.10+
  • LibreOffice (for PDF export — soffice on PATH)
  • pip or uv

Install LibreOffice:

# macOS
brew install --cask libreoffice

# Ubuntu/Debian
sudo apt install libreoffice

# Fedora
sudo dnf install libreoffice

Installation

Option A: pip (editable dev install)

cd ~/Documents/01-Projects/libreoffice-mcp
pip install -e .

Option B: uv (recommended)

cd ~/Documents/01-Projects/libreoffice-mcp
uv pip install -e .

This installs the libreoffice-mcp CLI entrypoint.


Agent Configuration (Tested Locally)

Claude Code

# ~/.claude/mcp.json
cat > ~/.claude/mcp.json <<'EOF'
{
  "mcpServers": {
    "libreoffice": {
      "command": "/Users/muhaimin/.hermes/hermes-agent/venv/bin/libreoffice-mcp"
    }
  }
}
EOF

Restart Claude Code with Ctrl+Shift+P → "Restart Claude Code Server".

OpenCode (~/.config/opencode/opencode.jsonc)

Add under mcpServers:

    "libreoffice": {
      "type": "local",
      "command": [
        "/Users/muhaimin/.hermes/hermes-agent/venv/bin/libreoffice-mcp"
      ],
      "enabled": true
    }

Restart OpenCode.

Hermes Agent (~/.hermes/config.yaml)

Add under mcp_servers:

  libreoffice:
    command: /Users/muhaimin/.hermes/hermes-agent/venv/bin/libreoffice-mcp
    enabled: true

Restart Hermes.


Quickstart Example

Create a presentation with 3 slides programmatically:

# Agent calls these via MCP tools

1. presentation_create {"output_path": "/tmp/deck.pptx"}
2. presentation_set_title  {"file_path": "/tmp/deck.pptx", "slide_index": 0, "title": "Quarterly Review"}
3. presentation_add_bullets {"file_path": "/tmp/deck.pptx", "slide_index": 0, "bullets": ["Revenue +24%", "8 releases shipped", "1.2M users"]}
4. presentation_add_slide {"file_path": "/tmp/deck.pptx", "layout": "title_and_content"}
5. presentation_set_title {"file_path": "/tmp/deck.pptx", "slide_index": 1, "title": "Roadmap"}
6. presentation_add_bullets {"file_path": "/tmp/deck.pptx", "slide_index": 1, "bullets": ["Q3: Foundation", "Q4: Acceleration", "Q1: Scale"]}
7. presentation_export_pdf {"file_path": "/tmp/deck.pptx"}

Project Structure

libreoffice-mcp/
├── pyproject.toml
├── README.md
└── libreoffice_mcp/
    ├── __init__.py
    ├── server.py          # MCP stdio server + tool dispatch
    ├── presentation.py    # pptx operations (python-pptx)
    ├── document.py        # docx operations (python-docx)
    ├── spreadsheet.py     # xlsx operations (openpyxl)
    └── utils.py           # Path helpers

Troubleshooting

soffice not found when exporting PDF

Make sure LibreOffice is installed and soffice is on your PATH:

which soffice
soffice --version

On macOS, Homebrew sometimes links it as /opt/homebrew/bin/soffice. Ensure your shell PATH includes this.

MCP tools not appearing

  • Check the agent's MCP server logs for connection errors.
  • Verify libreoffice-mcp runs standalone: echo '{}' | libreoffice-mcp
  • Ensure Python dependencies are installed: pip install python-pptx openpyxl python-docx mcp

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libreoffice_mcp-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libreoffice_mcp-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file libreoffice_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: libreoffice_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for libreoffice_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d5b47484462cb42ae4d01df69d48d118506879a2329408d824f49993bbac476
MD5 51bd172604c1208b64392d21cf3f613e
BLAKE2b-256 511be5fd5c445a190e7bfbe8407cb6d5cc3366d499489eefe0a30fc31d14dc09

See more details on using hashes here.

Provenance

The following attestation bundles were made for libreoffice_mcp-0.1.0.tar.gz:

Publisher: release.yml on minrahim1999/libreoffice-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libreoffice_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: libreoffice_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for libreoffice_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 985215ad0b258ee38ec09c7dd62a350f9ce1e2e5c91c3dd45de05df017fc6a40
MD5 3f0c7435fc11dbe5c86ce4f3bdc79234
BLAKE2b-256 7f70b8483a92d645664cd74df77073468551411b1efa69da37dc4681eeb0460e

See more details on using hashes here.

Provenance

The following attestation bundles were made for libreoffice_mcp-0.1.0-py3-none-any.whl:

Publisher: release.yml on minrahim1999/libreoffice-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page