libreoffice
A WIP LibreOffice MCP adapter. Now supports Writer, Calc, Impress, and Draw, with potential for more Base and Math tools to be added.
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
-
Create a Python virtual environment (optional but recommended):
python -m venv .venv source .venv/bin/activate # on Unix/Linux .venv\Scripts\activate # on Windows
-
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
-
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)
-
Start the MCP server:
The command assumes the Python module exposes a FastAPI app or similar entrypoint under libreoffice_mcp
python -m libreoffice_mcp
-
Verify the server is reachable:
- Open http://localhost:8000/docs (or the configured port) to view the MCP API docs
-
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
web-eval-agent
An MCP server that autonomously evaluates web applications.
ReActMCP
ReActMCP is a reactive MCP client that empowers AI assistants to instantly respond with real-time, Markdown-formatted web search insights powered by the Exa API.
Gitingest
mcp server for gitingest
teslamate
A Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
pfsense
pfSense MCP Server enables security administrators to manage their pfSense firewalls using natural language through AI assistants like Claude Desktop. Simply ask "Show me blocked IPs" or "Run a PCI compliance check" instead of navigating complex interfaces. Supports REST/XML-RPC/SSH connections, and includes built-in complian