lo-mcp
Allows creation, editing, and export of LibreOffice Writer documents (e.g., insert text, find/replace, save, export to PDF/DOCX/ODT).
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., "@lo-mcp create a new document, add 'Hello World', and export as PDF"
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.
lo-mcp
A stdio MCP server for LibreOffice Writer. Minimal scope on purpose: create, edit, and export Writer documents. No Calc/Impress yet — add them later if Writer proves useful.
Why this shape
LibreOffice's own bundled Python interpreter (LibreOfficePython, used by
import uno for document automation) carries a macOS Launch Constraint —
spawning it as a subprocess from Claude Code's process tree gets SIGKILLed
by macOS (CODESIGNING 4 Launch Constraint Violation). Plain soffice does
not carry this constraint, but driving Writer interactively needs the uno
Python bindings, which only load correctly under LibreOffice's own bundled
interpreter (cross-interpreter import uno from an unrelated Python is an
ABI mismatch — observed to hang the process in uninterruptible sleep, not
fail cleanly).
So: a small LibreOffice extension (extension/) runs inside the
already-running soffice process, using LibreOffice's own already-correct
interpreter — no subprocess, no cross-interpreter import. It exposes a
local HTTP server. The MCP server (src/lo_mcp/) is a thin, unconstrained
client that talks to it over plain HTTP — same pattern as freecad-mcp
connecting to the AICopilot addon running inside FreeCAD.
Related MCP server: libre-mcp
Setup
Build and install the extension:
extension/build.sh /Applications/LibreOffice.app/Contents/MacOS/unopkg add --force dist/lo-mcp.oxtLaunch (or restart) LibreOffice.
In LibreOffice: lo-mcp menu > Start Server. This opens
127.0.0.1:8794— local-only, only listens while you've started it. No real authentication, but POSTs must carry anX-Lo-Mcp-Clientheader, which forces browsers to CORS-preflight cross-origin requests; since the server never answers withAccess-Control-Allow-Origin, that preflight fails and a malicious web page can't drive it.Register the MCP server:
uv sync claude mcp add lo-mcp -- uv run --project /Volumes/Files/claude/lo-mcp lo-mcp
Call check_connection first in any session — if LibreOffice isn't running
or the server wasn't started, it says so.
Tools
check_connection, create_document, open_document, list_documents,
get_text, insert_text, find_and_replace, save_document,
export_document (pdf/docx/odt/doc/rtf/txt/html), close_document.
Testing
uv run pytestRequires LibreOffice running with the server started; skips otherwise.
Extending to Calc/Impress
Add operations to extension/pythonpath/lo_mcp_extension.py (new *Ops
class or methods, registered in _OPS) and matching thin @mcp.tool()
wrappers in src/lo_mcp/server.py. The HTTP/extension plumbing doesn't
change.
Available Tools
15 toolscheck_connectionA
Check whether the lo-mcp LibreOffice extension is reachable.
Call this first. If not connected, LibreOffice needs to be running with the lo-mcp extension's server started (lo-mcp menu > Start Server).
Inputs: no named parameters.
close_documentA
Close a document. Refuses if there are unsaved changes unless force=True.
Inputs: doc_id (required), force.
create_documentA
Create a new, blank Writer document. Returns a doc_id for later calls.
Inputs: no named parameters.
export_documentC
Export a document to path. Format is inferred from the extension if omitted.
Supported formats: odt, pdf, docx, doc, rtf, txt, html.
Inputs: path (required), doc_id (required), format.
find_and_replaceC
Replace all occurrences of search with replace in a document. Returns the count replaced.
Inputs: doc_id (required), search (required), replace (required), regex.
get_paragraph_styleA
Read a paragraph's style name and break type. Defaults to the last paragraph.
paragraph_index is 0-based; negative indices count from the end, Python-style.
Inputs: doc_id (required), paragraph_index.
get_table_cellB
Read a table cell's text (e.g. cell="A1"). Uses the first table if table_name is omitted.
Inputs: cell (required), doc_id (required), table_name.
get_textC
Read the full text content of a Writer document.
Inputs: doc_id (required).
insert_tableA
Insert a table at the end of the document. Supports up to 26 columns.
data, if given, is a 2D list of row values written into cells (values beyond the table's rows/cols are ignored). header=True bolds row 1.
Inputs: cols (required), rows (required), doc_id (required), data, +1 more.
insert_textA
Append text at the end of a Writer document.
break_before controls what precedes the text: "none" (default, keeps typing in the current paragraph), "line" (soft line break, same paragraph), "paragraph" (starts a new paragraph), or "page" (starts a new paragraph on a new page).
bold/italic/underline apply direct character formatting to just the text being inserted. style is a paragraph style name (e.g. "Heading 1", "Title") applied to the paragraph the text lands in; char_style is a character style name (e.g. "Emphasis", "Strong Emphasis") applied to just the inserted run. Use list_styles to see what's actually available in a given document rather than guessing names.
Inputs: text (required), doc_id (required), bold, style, +4 more.
list_documentsA
List documents currently open via lo-mcp, with their doc_id and modified state.
Inputs: no named parameters.
list_stylesA
List style names available in a document for a given style family.
family is one of "ParagraphStyles" (default), "CharacterStyles", "PageStyles", "FrameStyles", "NumberingStyles". Use this before calling insert_text(style=...)/char_style=.../set_paragraph_style to find valid names instead of guessing — built-in style sets vary slightly by LibreOffice version and locale, and documents can also define custom styles.
Inputs: doc_id (required), family.
open_documentC
Open an existing document from disk. Returns a doc_id.
Inputs: path (required).
save_documentB
Save a document in place (if it already has a location) or to a new path.
Inputs: doc_id (required), path, format.
set_paragraph_styleA
Apply a paragraph style (e.g. "Heading 1", "Title") to an existing paragraph.
Defaults to the last paragraph if paragraph_index is omitted. Index is 0-based (negative indices count from the end, Python-style) and counts paragraphs only — tables don't count.
Inputs: style (required), doc_id (required), paragraph_index.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool has a clearly distinct purpose, from connection checking to document lifecycle operations, content insertion, reading, and style management. No two tools could be easily confused.
All tool names follow a consistent verb_noun pattern with underscores and lowercase, e.g., create_document, get_text, set_paragraph_style, find_and_replace. No mixing of conventions.
15 tools cover document creation, opening, saving, closing, exporting, content insertion (text, table), reading (text, styles, table cells), search/replace, style listing, and document listing. This is well-scoped for a Writer manipulation server.
The tool set covers basic document operations and insertion, but lacks deletion capabilities (no tool to remove text, tables, or paragraphs) and modification of existing content (e.g., changing formatting after insertion, updating table cells). These gaps are notable for a full document editing workflow.
Maintenance
Related MCP Connectors
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
MCP server for generating rough-draft project plans from natural-language prompts.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server for reading, editing, and validating Microsoft Word documents with specialized support for track changes, comments, and footnotes. It enables structural auditing, heading extraction, and precise OOXML-level document manipulation through natural language tools.101001,116 PyPI71MIT
- FlicenseBqualityCmaintenanceMCP server for controlling LibreOffice (Writer and Calc) via the UNO API, enabling document creation, editing, saving, and export from AI clients.312-
- AlicenseNot gradedqualityCmaintenanceMCP server enabling AI to control WPS Office (Writer/Calc/Impress) for document creation, editing, export, and live typing.MIT
- 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