LibreOffice MCP Tools
Provides tools for reading, writing, and editing Office documents via LibreOffice, including document management, text manipulation, spreadsheet operations, and presentation editing across multiple file formats.
Click on "Install 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 Toolsopen the quarterly report.docx and show me the headings"
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.
LibreOffice MCP Tools
A Model Context Protocol (MCP) server that gives AI agents (Claude, Copilot, Gemini, Cursor, etc.) the ability to read, write, and edit Office documents via LibreOffice β with a token-efficient design that minimizes LLM context usage.
Inspired by the architecture of chrome-devtools-mcp.
β¨ Features
22 MCP tools covering reading, writing, spreadsheets, and presentations
Token-efficient design: outline-first navigation, range-based access, pagination
Broad format support: DOCX, DOC, XLSX, XLS, PPTX, PPT, ODT, ODS, ODP, RTF, CSV, TXT, PDF
Legacy format bridge:
.doc,.xls,.pptauto-converted via LibreOffice before parsingNo LibreOffice required for basic reads: native parsers handle DOCX, XLSX, PPTX directly
LibreOffice required for: legacy formats, PDF export, format conversion
π Supported Formats
Format | Extensions | Read | Write | Method |
Word 2007+ |
| β | β | Native (mammoth read / JSZip OOXML write) |
Word 97-2003 |
| β | β | LibreOffice bridge |
Excel 2007+ |
| β | β | Native (ExcelJS) |
Excel 97-2003 |
| β | β | LibreOffice bridge |
PowerPoint 2007+ |
| β | β | Native (JSZip OOXML) |
PowerPoint 97-2003 |
| β | β | LibreOffice bridge |
OpenDocument Text |
| β | β | LibreOffice bridge |
OpenDocument Spreadsheet |
| β | β | LibreOffice bridge |
OpenDocument Presentation |
| β | β | LibreOffice bridge |
Rich Text Format |
| β | β | LibreOffice bridge |
CSV |
| β | β | Native |
| β (text) | β | LibreOffice CLI | |
Plain text |
| β | β | Native |
π Quick Start
Prerequisites
Node.js 20+
LibreOffice (optional for basic DOCX/XLSX/PPTX reads; required for .doc/.xls/.ppt and format conversion)
Windows: Download LibreOffice
macOS:
brew install --cask libreofficeLinux:
sudo apt install libreofficeorsudo dnf install libreoffice
Installation
Using npx (recommended β no install needed):
{
"mcpServers": {
"libreoffice": {
"command": "npx",
"args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"]
}
}
}Global install:
npm install -g @passerbyflutter/libreoffice-mcp-toolsFrom source:
git clone https://github.com/passerbyflutter/libreoffice-mcp-tools
cd libreoffice-mcp-tools
npm install
npm run buildConfigure your MCP client
Add to your MCP client configuration (e.g., Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"libreoffice": {
"command": "npx",
"args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"],
"env": {
"SOFFICE_PATH": "/path/to/soffice"
}
}
}
}Or use .mcp.json at your project root:
{
"mcpServers": {
"libreoffice": {
"command": "npx",
"args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"]
}
}
}CLI Options
node build/bin/libreoffice-mcp.js [options]
--libreoffice-path <path> Path to soffice executable
(default: auto-detected or SOFFICE_PATH env)π Tool Reference
Document Management
Tool | Description |
| Open a file β returns |
| Release document handle and temp files |
| List all open documents |
| Create new empty document (writer/calc/impress) |
| Save to current or new path |
| Export via LibreOffice (PDF, HTML, CSV, etc.) |
| Convert file format (DOCβDOCX, XLSXβCSV, etc.) |
Reading (Token-Efficient)
Tool | Description |
| Title, author, word/page count, dates |
| Headings (Writer) / sheet names (Calc) / slide titles (Impress) |
| Paginated document text as Markdown |
| Specific paragraph or slide range |
| Find text with surrounding context |
Writing (Writer)
Tool | Description |
| Insert at start/end/after heading |
| Find & replace (first or all occurrences) |
| Insert paragraph at specific index |
| Apply heading/paragraph style |
Spreadsheet (Calc)
Tool | Description |
| Sheet names with row/col counts |
| Cell range as JSON + markdown table |
| Set cell value or formula |
| Set 2D range of values |
| Add new sheet |
| Get formula expressions in range |
Presentation (Impress)
Tool | Description |
| Slide titles with index |
| Full slide content (title, body, notes) |
| Speaker notes |
| Add new slide (requires LibreOffice) |
| Update slide content |
π‘ Token-Saving Workflow
For maximum token efficiency, follow this pattern:
1. document_open(filePath) β get docId
2. document_get_metadata(docId) β understand size/type
3. document_get_outline(docId) β see structure
4. document_read_range(docId, startIndex=N, endIndex=M) β read specific sectionInstead of dumping the entire document, you navigate to exactly what you need.
Spreadsheet workflow:
1. document_open(path) β docId
2. spreadsheet_list_sheets(docId) β see all sheets
3. spreadsheet_get_range(docId, sheetName="Sales", range="A1:D20") β targeted dataπ Architecture
src/
βββ index.ts # createMcpServer() β MCP server factory
βββ LibreOfficeAdapter.ts # soffice subprocess manager
βββ DocumentContext.ts # Open document registry
βββ DocumentSession.ts # Per-document state + format bridge
βββ McpResponse.ts # Response builder (text/JSON/markdown)
βββ Mutex.ts # Serializes LibreOffice subprocess calls
βββ parsers/
β βββ DocxParser.ts # DOCX read β {paragraphs, outline, metadata} (mammoth)
β βββ DocxOoxmlEditor.ts # DOCX write β direct JSZip OOXML manipulation (format-preserving)
β βββ XlsxParser.ts # XLSX read/write via ExcelJS
β βββ PptxParser.ts # PPTX read β {slides[]} (JSZip XML)
β βββ PptxOoxmlEditor.ts # PPTX write β add/update slides, create PPTX (JSZip OOXML)
βββ formatters/
β βββ MarkdownFormatter.ts
β βββ JsonFormatter.ts
β βββ TableFormatter.ts # Spreadsheet β Markdown table
βββ tools/
βββ documents.ts # open/close/list/create
βββ reader.ts # metadata/outline/read/search
βββ writer.ts # insert/replace/style
βββ spreadsheet.ts # get/set cells/ranges/sheets
βββ presentation.ts # slides/notes
βββ converter.ts # save/export/convertπ§ͺ Testing
# Create sample fixtures
node tests/create-fixtures.mjs
# Run smoke tests
npm testπ Environment Variables
Variable | Description |
| Path to LibreOffice |
| Set to |
π License
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/passerbyflutter/libreoffice-mcp-tools'
If you have feedback or need assistance with the MCP directory API, please join our Discord server