LibreOffice MCP Tools
This server provides 22 MCP tools for AI agents to read, write, and manipulate Office documents (DOCX, XLSX, PPTX, legacy formats, PDF) with a token-efficient design.
Document Management
Open documents across 13+ formats (DOCX, DOC, XLSX, XLS, PPTX, PPT, ODT, ODS, ODP, RTF, CSV, TXT, PDF), receiving a
docIdhandleClose, list, create (Writer/Calc/Impress), save, export (PDF, HTML, CSV, etc.), and convert documents between formats
Token-Efficient Reading
Metadata: title, author, word/page count, file size, dates
Outline: headings (Writer), sheet names (Calc), slide titles (Impress)
Text: paginated Markdown output with character/item limits
Range: specific paragraph or slide index ranges
Search: find text with surrounding context
Writer Editing
Insert text at start, end, or after a specific heading
Replace text (first or all occurrences, case-insensitive option)
Insert paragraphs at a specific index
Apply heading/paragraph styles to paragraphs by index
Calc (Spreadsheet) Editing
List sheets with row/column counts
Read cell ranges as JSON and/or Markdown table
Set single cells or ranges (2D array), add sheets with optional headers
Retrieve formula expressions from a range
Impress (Presentation) Editing
List slides with index and title
Get full slide content (title, body, speaker notes)
Retrieve speaker notes for all or specific slides
Add new slides or update existing title/body text
Format Support
Native parsing/writing for DOCX, XLSX, PPTX, CSV, TXT
Legacy and OpenDocument formats (DOC, XLS, PPT, ODT, ODS, ODP, RTF) via LibreOffice bridge
PDF text reading and export
LibreOffice is optional for basic modern-format reads but required for legacy formats, PDF export, and conversions
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
This project waswritten by GitHub Copilot and has not been fully reviewed by a human. Code may contain bugs, security issues, or unexpected behavior. Use at your own risk. Do not use in production without thorough review.
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