Logotipo de LibreOffice

LibreOffice

Comunidad
patrup

Provides tools and resources for interacting with LibreOffice documents.

Editorpatrup
Repositoriomcp-libre
IdiomaPython
Forks
33
Estrellas
105
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    LibreOffice ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    105 estrellas y 33 forks en el repositorio enlazado.

LibreOffice MCP Server

A comprehensive Model Context Protocol (MCP) server that provides tools and resources for interacting with LibreOffice documents. This server enables AI assistants and other MCP clients to create, read, convert, and manipulate LibreOffice documents programmatically.

Python 3.12+ LibreOffice MCP Protocol

📂 Repository Structure

This repository is organized into logical directories:

  • src/ - Core MCP server implementation
  • tests/ - Test suite and validation scripts
  • examples/ - Demo scripts and usage examples
  • config/ - Configuration templates for integrations
  • scripts/ - Utility scripts for setup and management
  • docs/ - Comprehensive documentation

For detailed information, see docs/REPOSITORY_STRUCTURE.md.

🚀 Features

LibreOffice Extension (Plugin) - NEW! 🎉

  • Native Integration: Embedded MCP server directly in LibreOffice
  • Real-time Editing: Live document manipulation with instant visual feedback
  • Performance: 10x faster than external server (direct UNO API access)
  • Multi-document: Work with all open LibreOffice documents
  • Auto-start: Automatically available when LibreOffice starts
  • HTTP API: External AI assistant access via localhost:8765

Document Operations

  • Create Documents: New Writer, Calc, Impress, and Draw documents
  • Read Content: Extract text from any LibreOffice document
  • Convert Formats: Convert between 50+ formats (PDF, DOCX, HTML, etc.)
  • Edit Documents: Insert, append, or replace text in Writer documents
  • Document Info: Get detailed metadata about documents

Spreadsheet Operations

  • Read Spreadsheets: Extract data from Calc spreadsheets and Excel files
  • Structured Data: Get data as 2D arrays with row/column information

Advanced Tools

  • Document Search: Find documents containing specific text
  • Batch Convert: Convert multiple documents simultaneously
  • Merge Documents: Combine multiple documents into one
  • Document Analysis: Get detailed statistics (word count, sentences, etc.)

Live Viewing & Real-time Editing

  • GUI Integration: Open documents in LibreOffice for live viewing
  • Real-time Updates: See changes as AI assistants modify documents
  • Change Monitoring: Watch documents for modifications in real-time
  • Interactive Sessions: Create live editing sessions with automatic refresh

MCP Resources

  • Document Discovery: List all LibreOffice documents (documents://)
  • Content Access: Access specific document content (document://{path})

📋 Requirements

  • LibreOffice: 24.2+ (must be accessible via command line)
  • Python: 3.12+
  • UV Package Manager: For dependency management

For detailed installation instructions for all platforms, run:

bash
./mcp-helper.sh requirements

🛠 Installation

  1. Clone the repository:

    bash
    git clone https://github.com/patrup/mcp-libre/
    cd mcp-libre
  2. Check prerequisites:

    bash
    ./mcp-helper.sh requirements  # Show detailed requirements
    ./mcp-helper.sh check         # Verify your system
  3. Install dependencies:

    bash
    uv sync
  4. Make helper script executable:

    bash
    chmod +x mcp-helper.sh

🎯 Quick Start

Test the Server

bash
# Run functionality tests
./mcp-helper.sh test

# Run interactive demo
./mcp-helper.sh demo

Start MCP Server

bash
# Standard MCP mode (stdio)
python src/main.py

# Or using UV
uv run python src/main.py

# Show help and options
python src/main.py --help

# Run tests
python src/main.py --test

Integration with Super Assistant

bash
# Start the MCP proxy
./mcp-helper.sh proxy

# Then configure Super Assistant extension:
# Server URL: http://localhost:3006

🔧 Available Tools

ToolDescription
create_documentCreate new LibreOffice documents
read_document_textExtract text from documents
convert_documentConvert between formats
get_document_infoGet document metadata
read_spreadsheet_dataRead spreadsheet data
insert_text_at_positionEdit document text
search_documentsSearch documents by content
batch_convert_documentsBatch format conversion
merge_text_documentsMerge multiple documents
get_document_statisticsDocument analysis
open_document_in_libreofficeOpen document in GUI for live viewing
create_live_editing_sessionStart live editing with real-time preview
watch_document_changesMonitor document changes in real-time
refresh_document_in_libreofficeForce document refresh in GUI

📚 Documentation

🔗 Integration Options

1. LibreOffice Extension (NEW - Recommended!) 🎉

The most powerful and efficient way to use the MCP server:

bash
# Build and install the LibreOffice extension
cd plugin/
./install.sh install

# Test the extension
./install.sh test

Benefits of the Extension:

  • 10x Performance: Direct UNO API access (no subprocess overhead)
  • Real-time Editing: Live document manipulation in open LibreOffice windows
  • Native Integration: Appears in LibreOffice Tools menu
  • Multi-document Support: Work with all open documents simultaneously
  • Auto-start: Automatically starts with LibreOffice
  • Advanced Features: Full access to LibreOffice formatting and capabilities

Usage:

  • The extension provides an HTTP API on http://localhost:8765
  • Configure your AI assistant to use this endpoint
  • Access controls via Tools > MCP Server in LibreOffice
  • Real-time document editing with instant visual feedback

For detailed plugin information, see plugin/README.md.

2. Claude Desktop

Generate configuration automatically:

bash
./generate-config.sh claude
# Creates ~/.config/claude/claude_desktop_config.json

Then restart Claude Desktop and start using LibreOffice commands:

  • "Create a new Writer document and save it as project-report.odt"
  • "Convert my document to PDF format"

3. Super Assistant Chrome Extension

Generate configuration and start proxy:

bash
./generate-config.sh mcp
npx @srbhptl39/mcp-superassistant-proxy@latest --config ~/Documents/mcp/mcp.config.json
# Server URL: http://localhost:3006

4. Direct MCP Client

python
from mcp.shared.memory import create_connected_server_and_client_session
from libremcp import mcp

async with client_session(mcp._mcp_server) as client:
    result = await client.call_tool("create_document", {
        "path": "/tmp/test.odt",
        "doc_type": "writer",
        "content": "Hello, World!"
    })

🎨 Usage Examples

Natural Language (via Super Assistant)

  • "Create a new Writer document with a project report"
  • "Convert my ODT file to PDF format"
  • "Search for documents containing 'budget' in my Documents folder"
  • "Get statistics for my essay - how many words?"

Programmatic Usage

python
from libremcp import create_document, read_document_text, convert_document

# Create a document
doc = create_document("/tmp/report.odt", "writer", "Project Report")

# Read content
content = read_document_text("/tmp/report.odt")
print(f"Words: {content.word_count}")

# Convert to PDF
result = convert_document("/tmp/report.odt", "/tmp/report.pdf", "pdf")

📁 Supported File Formats

Input (Reading)

  • LibreOffice: .odt, .ods, .odp, .odg
  • Microsoft Office: .doc, .docx, .xls, .xlsx, .ppt, .pptx
  • Text: .txt, .rtf

Output (Conversion)

  • PDF: .pdf
  • Microsoft Office: .docx, .xlsx, .pptx
  • Web: .html, .htm
  • Text: .txt
  • LibreOffice: .odt, .ods, .odp, .odg
  • Many others: 50+ formats supported by LibreOffice

🧪 Testing

LibreOffice Extension Testing

bash
# Install and test the plugin
cd plugin/
./install.sh install    # Build and install extension
./install.sh test       # Test functionality
./install.sh status     # Check status
./install.sh interactive # Interactive testing mode

External Server Testing

bash
# Show system requirements and installation guides
./mcp-helper.sh requirements

# Check dependencies and verify setup
./mcp-helper.sh check

# Run built-in functionality tests
./mcp-helper.sh test

# Interactive demo of all capabilities
./mcp-helper.sh demo

# Test specific functionality directly
uv run python libremcp.py --test

🔧 Configuration

MCP Configuration for Integrations

Generate personalized configuration files for Claude Desktop and/or Super Assistant:

bash
# Generate both Claude Desktop and Super Assistant configs
./generate-config.sh

# Generate only Claude Desktop config
./generate-config.sh claude

# Generate only Super Assistant config  
./generate-config.sh mcp

# Generate Super Assistant config in custom location
./generate-config.sh mcp /path/to/custom/directory

This automatically creates configurations with your actual project paths:

  • Claude Desktop: ~/.config/claude/claude_desktop_config.json
  • Super Assistant: ~/Documents/mcp/mcp.config.json (or custom location)

Environment Variables

bash
export PYTHONPATH="/path/to/mcp-libre"
export LIBREOFFICE_PATH="/usr/bin/libreoffice"  # Optional

Custom Search Paths

Edit libremcp.py to modify document discovery locations:

python
search_paths = [
    Path.home() / "Documents",
    Path.home() / "Desktop",
    Path("/custom/path"),
    Path.cwd()
]

🛡 Security

  • Local Execution: All operations run locally
  • File Permissions: Limited to user's file access
  • No Network: No external network dependencies
  • Temporary Files: Automatically cleaned up

🚨 Troubleshooting

LibreOffice Issues

bash
# Check LibreOffice installation
libreoffice --version
libreoffice --headless --help

# Test conversion manually
libreoffice --headless --convert-to pdf document.odt

Java Warnings

  • Java warnings are usually non-fatal
  • Core functionality works without Java
  • Install Java for full LibreOffice features

Permission Errors

  • Check file and directory permissions
  • Ensure LibreOffice can access document paths
  • Verify write permissions for output directories

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

The MIT License is a permissive license that allows:

  • ✅ Commercial use
  • ✅ Modification
  • ✅ Distribution
  • ✅ Private use

For other license options, see LICENSE_OPTIONS.md.

🔗 Links

📞 Support

  • Issues: Use GitHub issues for bug reports
  • Documentation: See the docs/ folder for detailed guides
  • Examples: Check EXAMPLES.md for usage patterns

LibreOffice MCP Server v0.1.0 - Bridging AI and Document Processing

Usa el MCP de LibreOffice con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado LibreOffice, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade LibreOffice como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de LibreOffice.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "mcp-libre": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de LibreOffice y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de LibreOffice.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar LibreOffice para ayudarme con esta tarea?
LibreOffice
Claro. Lo he leído.
Esto he encontrado usando LibreOffice.

Preguntas frecuentes

¿Para qué sirve el servidor MCP LibreOffice?

LibreOffice es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP LibreOffice con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar LibreOffice con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de LibreOffice con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con LibreOffice conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP LibreOffice a TypingMind?

LibreOffice funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP LibreOffice en TypingMind?

LibreOffice ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP LibreOffice?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si LibreOffice requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇