LibreOffice MCP Server
Provides tools for creating, reading, converting, editing, and analyzing LibreOffice documents, including Writer, Calc, Impress, and Draw files, spreadsheet data, batch conversion, merging, document search, statistics, and live viewing/editing through a LibreOffice extension.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LibreOffice MCP Server convert report.docx to PDF, keeping the formulas rendered"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-libre(工作增强版)
Fork 自 patrup/mcp-libre(MIT),感谢原作基座。本版在其上增强:
公式感知路由:docx 含 OMML 公式时自动改走 Word COM 真渲染(LibreOffice 会忽略公式字号,Bug 32419)
Word COM 优先:Windows 上 docx→pdf 默认先走 Word(大带图文档 LO 常超时,Word 快 5 倍+字体保真),失败自动回退 LO
MCP 形态接入:任意 MCP 客户端可注册(uv venv + 依赖安装后以 stdio 运行 src/main.py)
安装:git clone 本仓库 → uv venv .venv && uv pip install -r requirements(或参考 pyproject.toml)→ MCP 客户端注册 command: <仓库>/.venv/Scripts/python.exe, args: [<仓库>/src/main.py]。
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.
📂 Repository Structure
This repository is organized into logical directories:
src/- Core MCP server implementationtests/- Test suite and validation scriptsexamples/- Demo scripts and usage examplesconfig/- Configuration templates for integrationsscripts/- Utility scripts for setup and managementdocs/- Comprehensive documentation
For detailed information, see docs/REPOSITORY_STRUCTURE.md.
Related MCP server: MCP Documents
🚀 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:
./mcp-helper.sh requirements🛠 Installation
Clone the repository:
git clone https://github.com/patrup/mcp-libre/ cd mcp-libreCheck prerequisites:
./mcp-helper.sh requirements # Show detailed requirements ./mcp-helper.sh check # Verify your systemInstall dependencies:
uv syncMake helper script executable:
chmod +x mcp-helper.sh
🎯 Quick Start
Test the Server
# Run functionality tests
./mcp-helper.sh test
# Run interactive demo
./mcp-helper.sh demoStart MCP Server
# 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 --testIntegration with Super Assistant
# Start the MCP proxy
./mcp-helper.sh proxy
# Then configure Super Assistant extension:
# Server URL: http://localhost:3006🔧 Available Tools
Tool | Description |
| Create new LibreOffice documents |
| Extract text from documents |
| Convert between formats |
| Get document metadata |
| Read spreadsheet data |
| Edit document text |
| Search documents by content |
| Batch format conversion |
| Merge multiple documents |
| Document analysis |
| Open document in GUI for live viewing |
| Start live editing with real-time preview |
| Monitor document changes in real-time |
| Force document refresh in GUI |
📚 Documentation
Prerequisites: Quick reference for system requirements
Plugin Migration Guide: Migrate from external server to plugin
Examples: Code examples and usage patterns
Live Viewing Guide: See changes live in LibreOffice GUI
Super Assistant Setup: Chrome extension integration
ChatGPT Browser Guide: Using with ChatGPT and alternatives
Troubleshooting: Common issues and solutions
Quick Start: Quick reference guide
Complete Solution: Comprehensive overview
🔗 Integration Options
1. LibreOffice Extension (NEW - Recommended!) 🎉
The most powerful and efficient way to use the MCP server:
# Build and install the LibreOffice extension
cd plugin/
./install.sh install
# Test the extension
./install.sh testBenefits 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:8765Configure 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:
./generate-config.sh claude
# Creates ~/.config/claude/claude_desktop_config.jsonThen 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:
./generate-config.sh mcp
npx @srbhptl39/mcp-superassistant-proxy@latest --config ~/Documents/mcp/mcp.config.json
# Server URL: http://localhost:30064. Direct MCP Client
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
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,.odgMicrosoft Office:
.doc,.docx,.xls,.xlsx,.ppt,.pptxText:
.txt,.rtf
Output (Conversion)
PDF:
.pdfMicrosoft Office:
.docx,.xlsx,.pptxWeb:
.html,.htmText:
.txtLibreOffice:
.odt,.ods,.odp,.odgMany others: 50+ formats supported by LibreOffice
🧪 Testing
LibreOffice Extension Testing
# 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 modeExternal Server Testing
# 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:
# 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/directoryThis automatically creates configurations with your actual project paths:
Claude Desktop:
~/.config/claude/claude_desktop_config.jsonSuper Assistant:
~/Documents/mcp/mcp.config.json(or custom location)
Environment Variables
export PYTHONPATH="/path/to/mcp-libre"
export LIBREOFFICE_PATH="/usr/bin/libreoffice" # OptionalCustom Search Paths
Edit libremcp.py to modify document discovery locations:
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
# Check LibreOffice installation
libreoffice --version
libreoffice --headless --help
# Test conversion manually
libreoffice --headless --convert-to pdf document.odtJava 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
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
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
MCP Specification: https://spec.modelcontextprotocol.io/
LibreOffice: https://www.libreoffice.org/
FastMCP Framework: https://github.com/modelcontextprotocol/python-sdk
📞 Support
Issues: Use GitHub issues for bug reports
Documentation: See the
docs/folder for detailed guidesExamples: Check
EXAMPLES.mdfor usage patterns
LibreOffice MCP Server v0.1.0 - Bridging AI and Document Processing
Available Tools
15 toolsbatch_convert_documentsC
Convert multiple documents in a directory to a different format
Args:
source_dir: Directory containing source documents
target_dir: Directory where converted documents should be saved
target_format: Target format for conversion
source_extensions: List of source file extensions to convert (default: common formats)
Inputs: source_dir (required), target_dir (required), target_format (required), source_extensions. Returns: result
create_documentB
Create a new LibreOffice document
Args:
path: Full path where the document should be created
doc_type: Type of document to create (writer, calc, impress, draw)
content: Initial content for the document (for writer documents)
Inputs: path (required), content, doc_type. Returns: Information about a LibreOffice document
create_live_editing_sessionC
Create a live editing session with automatic refresh capabilities
Args:
path: Path to the document for live editing
auto_refresh: Whether to enable automatic refresh detection
Inputs: path (required), auto_refresh. Returns: result
_docx_has_ommlA
检测 docx 是否含 OMML 公式(word/document.xml 里查 <m:oMath)。
2026-10-24:LibreOffice 对 OMML 的 run 字号(m:r/w:rPr/w:sz)完全忽略,
公式全部按 Math 组件默认基准字号渲染(LO Bug 32419,多年未修)——
含公式的 docx 用 LO 转 PDF,公式字号/溢出判断全部失真。
含公式 → 路由 Word COM(真渲染);无公式 → LO 照旧(快)。
Inputs: path (required). Returns: result
get_document_infoC
Get detailed information about a LibreOffice document
Args:
path: Path to the document file
Inputs: path (required). Returns: Information about a LibreOffice document
get_document_statisticsC
Get detailed statistics about a document
Args:
path: Path to the document file
Inputs: path (required). Returns: result
insert_text_at_positionB
Insert text into a LibreOffice Writer document
Args:
path: Path to the document file
text: Text to insert
position: Where to insert the text ("start", "end", or "replace")
Inputs: path (required), text (required), position. Returns: Information about a LibreOffice document
merge_text_documentsA
Merge multiple text documents into a single document
Args:
document_paths: List of paths to documents to merge
output_path: Path where merged document should be saved
separator: Text to insert between merged documents
Inputs: output_path (required), document_paths (required), separator. Returns: Information about a LibreOffice document
open_document_in_libreofficeA
Open a document in LibreOffice GUI for live viewing
Args:
path: Path to the document to open
readonly: Whether to open in read-only mode (default: False)
Inputs: path (required), readonly. Returns: result
read_document_textC
Extract text content from a LibreOffice document
Args:
path: Path to the document file
Inputs: path (required). Returns: Text content extracted from a document
read_impress_layoutA
精确读取 PPT(.pptx)每页每个元素的几何布局:坐标/宽高(厘米)、旋转、占位符角色、z 序、组内子元素、文本摘要。
三层 z 序:masters(最底层装饰) < layouts(版式装饰) < 页面 shapes(最顶层)。
重叠/遮挡判断必须三层合并——"标题压住橙色块"这类问题,装饰块在版式/母版上,只看页面形状查不出来。
页面元素几何为 None 表示未显式设置(继承版式占位符位置)。
用于回答"这个元素在页面哪里/多大面积/有没有重叠出界/层级谁压谁"——read_document_text 只给文字流,
位置信息在文本转换时全部丢失。仅支持 .pptx;.ppt/.odp 先用 convert_document 转 pptx 再读。
Args:
path: PPT 文件路径(.pptx)
slides: 可选,页码过滤,如 "1" 或 "1,3-5";缺省读全部页
Inputs: path (required), slides. Returns: path, slides, layouts, masters, +3 more
read_spreadsheet_dataA
Read data from a LibreOffice Calc spreadsheet
Args:
path: Path to the spreadsheet file (.ods, .xlsx, etc.)
sheet_name: Name of the specific sheet to read (if None, reads first sheet)
max_rows: Maximum number of rows to read (default 100)
Inputs: path (required), max_rows, sheet_name. Returns: Data from a spreadsheet
refresh_document_in_libreofficeB
Send a refresh signal to LibreOffice to reload a document
Args:
path: Path to the document that should be refreshed
Inputs: path (required). Returns: result
search_documentsC
Search for documents containing specific text
Args:
query: Text to search for
search_path: Directory to search in (default: common document locations)
Inputs: query (required), search_path. Returns: result
watch_document_changesB
Watch a document for changes and provide live updates
Args:
path: Path to the document to watch
duration_seconds: How long to watch for changes (default: 30 seconds)
Inputs: path (required), duration_seconds. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools target distinct document operations and file types, so selection is generally clear. However, get_document_info overlaps with get_document_statistics, the live-editing cluster (open/refresh/watch/create_live_editing_session) has some boundary ambiguity, and _docx_has_omml looks like an internal helper exposed as a tool.
Nearly all tools use snake_case with predictable verb_noun phrasing, such as create_document, read_document_text, and merge_text_documents. The main deviations are the internal-looking _docx_has_omml name and the adjective-prefixed batch_convert_documents, but the set remains mostly consistent.
Fifteen tools is within the expected well-scoped range and covers reading, writing, conversion, search, and live-viewing workflows. The count is not excessive, though one exposed internal helper slightly dilutes the set.
The surface covers document creation, reading, search, batch conversion, and Writer text insertion, but editing support is thin for Calc and Impress. There are no clear tools for updating spreadsheet cells, modifying slides, deleting documents, or general single-document export/save workflows.
Related MCP Connectors
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Parse, convert and create Office and PDF documents. OAuth at /mcp/connect/, API key at /mcp/.
Document conversion MCP server: PDF to Markdown, image OCR, spreadsheet parsing.
Related MCP Servers
- AlicenseDqualityDmaintenanceEnables reading, writing, editing, and converting Office documents (ODT, DOCX, ODS, XLSX, PDF, etc.) using MCP tools, with no external dependencies.1156 npmMIT
- AlicenseCqualityDmaintenanceA unified MCP server for document processing that enables creating, editing, and converting Word documents (DOCX), PDFs, Markdown, and images, with support for templates, formatting, and batch operations.100MIT
- FlicenseBqualityCmaintenanceMCP server for controlling LibreOffice (Writer and Calc) via the UNO API, enabling document creation, editing, saving, and export from AI clients.312-
- AlicenseAqualityCmaintenanceMCP server for Office documents — create, edit, fill templates, convert, and extract Word/Excel/PowerPoint. LaTeX-style markup, math formulas, PDF export, template loops, and document diff. stdio / SSE / Streamable HTTP with auth and rate limiting.12Apache 2.0