convez.ai
MCP Server
jacobNar

libre-office-mcp

jacobNar/libre-office-mcp

Ver no GitHub
InicialPluginScore · de 0 a 100

An MCP server with tools to create documents with Libre Office. Currently supports Libre Office Draw

Instalação

$npx convez-ai jacobNar/libre-office-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

README

A tradução para o português deste README ainda está na fila.

LibreOffice Draw MCP Server

A Model Context Protocol (MCP) server that connects to a local headless LibreOffice Draw instance via the UNO API, exposing tools to programmatically draw Database/ER Diagrams (entities and sticky connectors).


Section 1: System Environment & Virtual Environment Setup

Choose the installation track matching your operating system:

On Linux (Ubuntu/Debian)

  1. Install system-level python-uno bindings:
    sudo apt update
    sudo apt install python3-uno
    
  2. Create your virtual environment with global system packages enabled so it can load the uno module:
    python3 -m venv --system-site-packages .venv
    
  3. Activate the environment:
    source .venv/bin/activate
    
  4. Install python dependencies:
    pip install fastmcp
    

On Windows

  1. Create a standard virtual environment:
    python -m venv .venv
    
  2. Activate it:
    .venv\Scripts\activate
    
  3. Install python dependencies:
    pip install fastmcp
    

Section 2: python-uno Environment Configuration (Windows Only)

Windows does not distribute a system-level python-uno package. To run the server inside your Windows environment:

Option A: Use the LibreOffice Bundled Python (Recommended / Easiest)

LibreOffice comes with its own Python executable that pre-configures all UNO path bindings. You can execute the server directly using:

& "C:\Program Files\LibreOffice\program\python.exe" server.py

Option B: Link System Python to LibreOffice UNO

  1. Set the following environment variables on your PC:
    • PATH: Add C:\Program Files\LibreOffice\program to your PATH.
    • URE_BOOTSTRAP: Set to vnd.sun.star.pathname:C:\Program Files\LibreOffice\program\fundamentalrc (or the equivalent path in your installation).
  2. Copy uno.py and unohelper.py from C:\Program Files\LibreOffice\program into your .venv\Lib\site-packages folder.

Section 3: Codebase Architecture

The codebase is organized into modular classes adhering to DRY, Separation of Concerns, and comment-free style guidelines:

  1. config.py: Configuration class for connection parameters and models.
  2. libreoffice_client.py: Class encapsulating UNO client operations (connecting, drawing shapes, linking shapes, and saving).
  3. server.py: FastMCP server exposing tools using the default stdio transport.

Section 4: Testing & Execution Playbook

1. Launch LibreOffice in Headless Listening Mode

Launch LibreOffice locally with a socket listener on port 2002:

# On Linux/macOS
sudo soffice "--accept=socket,host=127.0.0.1,port=2002;urp;" --headless --norestore --nologo --nodefault

# On Windows
& "C:\Program Files\LibreOffice\program\soffice.exe" "--accept=socket,host=127.0.0.1,port=2002;urp;" --headless --norestore --nologo --nodefault

(Make sure the host IP in config.py matches the listener host).

2. Run the MCP Server

To run the server over a network port using the Server-Sent Events (SSE) transport:

python server.py

This starts the server process listening on port 8000. The server endpoint will be available at http://<host-ip>:8000/sse.

3. Connect to the MCP Server Remotely

From your other computer on the Tailscale network, you can connect to the running MCP server by pointing your client application to the SSE URL:

http://<Tailscale-IP>:8000/sse

For example, you can configure the remote server in your client's configuration file (such as claude_desktop_config.json):

{
  "mcpServers": {
    "libreoffice-draw": {
      "url": "http://<Tailscale-IP>:8000/sse"
    }
  }
}
Ver o original no GitHub

Bom para

Relacionados