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

pip install libreoffice-mcp

Option B: uv

uv pip install libreoffice-mcp

This installs the libreoffice-mcp CLI entrypoint.


Agent Configuration (Tested Locally)

Claude Code

Add to ~/.claude/mcp.json:

{
  "mcpServers": {
    "libreoffice": {
      "command": "libreoffice-mcp"
    }
  }
}

If libreoffice-mcp is not on your PATH, use the full path to the binary (e.g. ~/.local/bin/libreoffice-mcp or your venv path).

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

OpenCode

Add under mcpServers in ~/.config/opencode/opencode.jsonc:

    "libreoffice": {
      "type": "local",
      "command": ["libreoffice-mcp"],
      "enabled": true
    }

Use the full binary path if it's not on your PATH.

Restart OpenCode.

Hermes Agent

Add under mcp_servers in ~/.hermes/config.yaml:

  libreoffice:
    command: libreoffice-mcp
    enabled: true

Use the full binary path if needed.


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

Template Tools (Human-Grade Output)

For professional, styled output without manual formatting:

Tool Description Best For
template_executive_presentation 5-slide corporate deck with hero, metrics, financials, roadmap Board decks, quarterly reviews
template_proposal_document Multi-page doc with title page, sections, budget table Client proposals, SOWs
template_financial_spreadsheet Styled Excel with formulas, margins, embedded chart Monthly/quarterly reports

These templates produce navy/orange color scheme, 16:9 widescreen, and professional typography — no manual tweaking needed.

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.2.1.tar.gz (16.0 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.2.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: libreoffice_mcp-0.2.1.tar.gz
  • Upload date:
  • Size: 16.0 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.2.1.tar.gz
Algorithm Hash digest
SHA256 f0978f28acb478e64cb5a8482d1ad9134c0ce52d205a8954ddc7fa786fa14ed9
MD5 663986c56038ea686109613ebbce5d6a
BLAKE2b-256 6d7c74df048a14b6c1912f7cba5a736c1591e60afd67a2c264ad30de294d1747

See more details on using hashes here.

Provenance

The following attestation bundles were made for libreoffice_mcp-0.2.1.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.2.1-py3-none-any.whl.

File metadata

  • Download URL: libreoffice_mcp-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abb3557e18cb1b8da901846865a4b19649924425b8c83da53b49d78d5b26b77b
MD5 55b651d4b4d643021b01267fe8327f09
BLAKE2b-256 390e54203e9aed2281c17dbae8d1b5f131e47a5eb0154297698321c38f726b63

See more details on using hashes here.

Provenance

The following attestation bundles were made for libreoffice_mcp-0.2.1-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