Skip to main content
Glama

LibreOffice MCP Tools

npm version

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, .ppt auto-converted via LibreOffice before parsing

  • No 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+

.docx, .dotx

βœ…

βœ…

Native (mammoth read / JSZip OOXML write)

Word 97-2003

.doc, .dot

βœ…

βœ…

LibreOffice bridge

Excel 2007+

.xlsx, .xlsm

βœ…

βœ…

Native (ExcelJS)

Excel 97-2003

.xls

βœ…

βœ…

LibreOffice bridge

PowerPoint 2007+

.pptx

βœ…

βœ…

Native (JSZip OOXML)

PowerPoint 97-2003

.ppt

βœ…

βœ…

LibreOffice bridge

OpenDocument Text

.odt

βœ…

βœ…

LibreOffice bridge

OpenDocument Spreadsheet

.ods

βœ…

βœ…

LibreOffice bridge

OpenDocument Presentation

.odp

βœ…

βœ…

LibreOffice bridge

Rich Text Format

.rtf

βœ…

βœ…

LibreOffice bridge

CSV

.csv

βœ…

βœ…

Native

PDF

.pdf

βœ… (text)

❌

LibreOffice CLI

Plain text

.txt

βœ…

βœ…

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 libreoffice

    • Linux: sudo apt install libreoffice or sudo 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-tools

From source:

git clone https://github.com/passerbyflutter/libreoffice-mcp-tools
cd libreoffice-mcp-tools
npm install
npm run build

Configure 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

document_open

Open a file β†’ returns docId handle. Auto-bridges legacy formats.

document_close

Release document handle and temp files

document_list

List all open documents

document_create

Create new empty document (writer/calc/impress)

document_save

Save to current or new path

document_export

Export via LibreOffice (PDF, HTML, CSV, etc.)

document_convert

Convert file format (DOC→DOCX, XLSX→CSV, etc.)

Reading (Token-Efficient)

Tool

Description

document_get_metadata

Title, author, word/page count, dates

document_get_outline

Headings (Writer) / sheet names (Calc) / slide titles (Impress)

document_read_text

Paginated document text as Markdown

document_read_range

Specific paragraph or slide range

document_search

Find text with surrounding context

Writing (Writer)

Tool

Description

document_insert_text

Insert at start/end/after heading

document_replace_text

Find & replace (first or all occurrences)

document_insert_paragraph

Insert paragraph at specific index

document_apply_style

Apply heading/paragraph style

Spreadsheet (Calc)

Tool

Description

spreadsheet_list_sheets

Sheet names with row/col counts

spreadsheet_get_range

Cell range as JSON + markdown table

spreadsheet_set_cell

Set cell value or formula

spreadsheet_set_range

Set 2D range of values

spreadsheet_add_sheet

Add new sheet

spreadsheet_get_formulas

Get formula expressions in range

Presentation (Impress)

Tool

Description

presentation_list_slides

Slide titles with index

presentation_get_slide

Full slide content (title, body, notes)

presentation_get_notes

Speaker notes

presentation_add_slide

Add new slide (requires LibreOffice)

presentation_update_slide

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 section

Instead 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

SOFFICE_PATH

Path to LibreOffice soffice executable

DEBUG

Set to lo-mcp:* for verbose logging

πŸ“„ License

MIT

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

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