The LibreOffice MCP Extension integrates Model Context Protocol (MCP) server functionality directly into LibreOffice, enabling AI assistants to interact with LibreOffice documents in real-time through direct UNO API access.
- Create documents directly in LibreOffice (Writer, Calc, Impress, Draw)
- Insert and format text in active documents
- Live document editing without file I/O overhead
- Multi-document support for all open documents
- Save and export documents to various formats (PDF, DOCX, ODT, etc.)
- Get comprehensive document information and statistics
- Real-time text content extraction
- Format text with fonts, styles, and attributes
- HTTP API server running on localhost:8765
- Compatible with Claude Desktop and other MCP clients
- RESTful endpoints for easy integration
- Real-time status monitoring and control
- Appears in LibreOffice Tools menu
- Auto-starts with LibreOffice
- System tray integration
- Professional .oxt extension format
- Download
libreoffice-mcp-extension.oxt - Open LibreOffice
- Go to Tools > Extension Manager
- Click Add and select the .oxt file
- Restart LibreOffice
unopkg add libreoffice-mcp-extension.oxtcd plugin/
./build.sh
unopkg add ../build/libreoffice-mcp-extension.oxtAfter installation, access MCP server controls via:
- Tools > MCP Server (menu)
- Use the toolbar button for quick toggle
Available commands:
- Start MCP Server: Begins the HTTP API server
- Stop MCP Server: Stops the server
- Restart MCP Server: Restarts the server
- Show Server Status: Displays current status
The extension starts an HTTP server on http://localhost:8765 with the following endpoints:
# Server information
curl http://localhost:8765/
# List available tools
curl http://localhost:8765/tools
# Health check
curl http://localhost:8765/health# Execute a specific tool
curl -X POST http://localhost:8765/tools/create_document_live \
-H "Content-Type: application/json" \
-d '{"doc_type": "writer"}'
# Execute tool via generic endpoint
curl -X POST http://localhost:8765/execute \
-H "Content-Type: application/json" \
-d '{
"tool": "insert_text_live",
"parameters": {
"text": "Hello from AI assistant!"
}
}'create_document_live: Create new Writer, Calc, Impress, or Draw documents- Parameters:
doc_type(writer|calc|impress|draw)
insert_text_live: Insert text at cursor or specific positionformat_text_live: Apply formatting to selected textget_text_content_live: Extract text content from document
get_document_info_live: Get comprehensive document detailslist_open_documents: List all currently open documents
save_document_live: Save active documentexport_document_live: Export to PDF, DOCX, ODT, TXT, etc.
Add to your Claude Desktop configuration:
{
"mcpServers": {
"libreoffice": {
"command": "curl",
"args": [
"-X", "POST",
"http://localhost:8765/execute",
"-H", "Content-Type: application/json",
"-d", "{\"tool\": \"{{tool}}\", \"parameters\": {{parameters}}}"
]
}
}
}Configure the MCP proxy to point to:
http://localhost:8765
# Create a new Writer document
curl -X POST http://localhost:8765/tools/create_document_live \
-H "Content-Type: application/json" \
-d '{"doc_type": "writer"}'
# Insert text
curl -X POST http://localhost:8765/tools/insert_text_live \
-H "Content-Type: application/json" \
-d '{"text": "This is AI-generated content!"}'
# Apply formatting to selected text
curl -X POST http://localhost:8765/tools/format_text_live \
-H "Content-Type: application/json" \
-d '{
"bold": true,
"font_size": 14,
"font_name": "Arial"
}'
# Save document
curl -X POST http://localhost:8765/tools/save_document_live \
-H "Content-Type: application/json" \
-d '{"file_path": "/home/user/Documents/ai-document.odt"}'
# Export to PDF
curl -X POST http://localhost:8765/tools/export_document_live \
-H "Content-Type: application/json" \
-d '{
"export_format": "pdf",
"file_path": "/home/user/Documents/ai-document.pdf"
}'# Get document information
curl http://localhost:8765/tools/get_document_info_live
# Extract text content
curl http://localhost:8765/tools/get_text_content_live
# List all open documents
curl http://localhost:8765/tools/list_open_documents| Feature | External Server | Plugin Extension |
|---|---|---|
| Performance | โญโญ (file I/O) | โญโญโญโญโญ (direct API) |
| Real-time Editing | โญโญ (file-based) | โญโญโญโญโญ (live objects) |
| Installation | โญโญโญโญ (simple) | โญโญโญ (extension install) |
| Multi-document | โญโญ (file ops) | โญโญโญโญโญ (all open docs) |
| GUI Integration | โญ (none) | โญโญโญโญโญ (native menus) |
| Startup Time | โญโญ (LibreOffice launch) | โญโญโญโญโญ (instant) |
AI Assistant (Claude/Super Assistant)
โ (HTTP API calls)
LibreOffice Plugin Extension
โ (UNO API - direct access)
LibreOffice Internal Components
โ (direct memory access)
Documents & Data Structures
- UNO Bridge: Direct LibreOffice API integration
- MCP Server: Embedded protocol server
- AI Interface: HTTP API for external connections
- Extension Registration: LibreOffice lifecycle management
- Check LibreOffice version (requires 7.0+)
- Verify Python environment
- Check Extension Manager for conflicts
- Review LibreOffice error logs
- Verify port 8765 is available
- Check firewall settings
- Review extension logs
- Try restarting LibreOffice
- Ensure document is open for document-specific tools
- Check parameter formats in API calls
- Verify LibreOffice permissions
- Check UNO API compatibility
- Check LibreOffice extension logs
- Use
curl http://localhost:8765/healthfor server status - Access Tools > MCP Server > Show Server Status
- Visit project GitHub repository for issues
git clone <repository-url>
cd mcp-libre/plugin
./build.shunopkg remove org.mcp.libreoffice.extension # Remove old version
unopkg add ../build/libreoffice-mcp-extension.oxt- Enable LibreOffice Basic IDE debugging
- Check Python console output
- Monitor HTTP server logs
- Use UNO reflection tools
This extension is released under the MIT License. See LICENSE file for details.
Contributions are welcome! Please check the main project repository for contribution guidelines.
Happy AI-powered document editing with LibreOffice! ๐