Logo di LibreOffice

LibreOffice

Community
patrup

Provides tools and resources for interacting with LibreOffice documents.

Autorepatrup
Repositorymcp-libre
LinguaPython
Fork
33
Stelle
105
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    LibreOffice mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    105 stelle e 33 fork nel repository collegato.

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 MCP LibreOffice con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso LibreOffice, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi LibreOffice come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di LibreOffice.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "mcp-libre": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di LibreOffice, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di LibreOffice.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare LibreOffice per aiutarmi con questa attività?
LibreOffice
Certo. Ho letto.
Ecco cosa ho trovato con LibreOffice.

Domande frequenti

A cosa serve il server MCP LibreOffice?

LibreOffice è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare LibreOffice MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare LibreOffice con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP LibreOffice con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando LibreOffice, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego LibreOffice MCP a TypingMind?

LibreOffice funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre LibreOffice MCP in TypingMind?

LibreOffice mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare LibreOffice MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se LibreOffice richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇