Get the FREE Ultimate OpenClaw Setup Guide →

libreoffice

A WIP LibreOffice MCP adapter. Now supports Writer, Calc, Impress, and Draw, with potential for more Base and Math tools to be added.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio waterpistolai-libreoffice-mcp python -m libreoffice_mcp \
  --env LIBREOFFICE_PORT="Port to connect to LibreOffice socket (default 2083)"

How to use

This MCP server provides a Python-based adapter for controlling LibreOffice via the OooDev library. It exposes a suite of tools that cover document operations (open, close, save, export), Calc table and cell handling (get/set values, create sheets, apply formulas), Writer text enhancements (insert text, tables, images, styling), and more advanced capabilities like creating charts, pivot tables, and basic database-like operations through LibreOffice Base tools. You can interact with these tools through the MCP client by specifying the tool name and required parameters, enabling remote automation and scripting against LibreOffice documents through a consistent, Pythonic API. The adapter aims to simplify common UNO interactions by wrapping them in OooDev abstractions such as CalcDoc, WriteDoc, and Chart2, while preserving the original feature set.

To use it, start the MCP server (see installation) and connect with the MCP client. Typical workflows include opening a Calc or Writer document, reading or mutating cell values, applying styles, inserting tables or images, generating charts or pivot tables, and optionally saving or exporting to PDF. The base tools also provide data-oriented operations for simple table listing and modification, aligning with the sdb/sdbc namespaces via OooDev when available. If you need to run a Python macro or insert form controls, you can invoke run_macro or insert_form_control through the same MCP interface.

Prerequisites in practice are having LibreOffice running with a socket (port 2083 by default) and the Python dependencies installed (notably ooo-dev-tools). The server will manage connections via OooDev Lo utilities, enabling a Pythonic interface to your LO documents across Writer, Calc, Impress, and Draw.

How to install

Prerequisites:

  • Python 3.8+ installed on the host running the MCP server
  • LibreOffice installed and running with a socket listener (default port 2083)
  • Internet access to install Python dependencies
  1. Create a Python virtual environment (optional but recommended):

    python -m venv .venv source .venv/bin/activate # on Unix/Linux .venv\Scripts\activate # on Windows

  2. Install MCP adapter dependencies, including OooDev tools:

    pip install ooo-dev-tools

    If your project publishes a specific package for this MCP server, install it as well

    Example (adjust if your package name differs):

    pip install libreoffice-mcp-adapter

  3. Install or place the LibreOffice MCP server package that provides the module to run:

    • Ensure your module named libreoffice_mcp is available on PYTHONPATH (or installed via pip)
  4. Start the MCP server:

    The command assumes the Python module exposes a FastAPI app or similar entrypoint under libreoffice_mcp

    python -m libreoffice_mcp

  5. Verify the server is reachable:

  6. Optional: configure environment variables for LO socket port and other options as needed, for example:

    export LIBREOFFICE_PORT=2083

Additional notes

Tips and common issues:

  • Ensure LibreOffice is running and listening on a socket before starting the MCP server. If the port differs from 2083, set LIBREOFFICE_PORT accordingly.
  • The adapter uses OooDev abstractions; if you encounter UNO-specific errors, ensure LibreOffice is compatible with the version of OooDev installed.
  • When using Base-related tools, note that Base support in OooDev may be limited depending on版本; some operations may fallback to low-level UNO interfaces.
  • For long-running tasks, consider enabling connection caching (if supported by the adapter) to reduce startup overhead when repeatedly accessing LO documents.
  • If you need to extend capabilities (e.g., more forms, shapes, or additional chart types), you can cultivate new tools by leveraging OooDev modules like Forms, Chart2, Calc, and Write in your custom tool implementation.

Related MCP Servers

Sponsor this space

Reach thousands of developers