مفتوح المصدر · مفتوح المصدر · 2026
LibreOffice-MCP
إضافة LibreOffice وحزمة MCPB وخادم MCP بأكثر من 210 أداة لأتمتة المستندات
Python · LibreOffice UNO · MCP

نظرة عامة والمشكلة الهندسية
يمتلك وكلاء الذكاء الاصطناعي قدرة عالية على صياغة النصوص وتحليل البيانات، غير أن أتمتة حزم المكتب الفعلية—مثل تنسيق التقارير الاحترافية، وتعديل الجداول الحسابية، وبناء العروض التقديمية، وتصدير ملفات PDF—تبقى هشة عندما تعتمد على تعديل ملفات XML يدوياً أو محاكاة واجهة المستخدم الرسومية.
يربط مشروع LibreOffice-MCP وكلاء الذكاء الاصطناعي مباشرة ببيئة LibreOffice عبر بروتوكول سياق النموذج (MCP). ويضم المشروع إضافة LibreOffice بصيغة .oxt، وحزمة MCPB، وخادم MCP بلغة Python يوفر أكثر من 210 أداة برمجية للتحكم الكامل في Writer وCalc وImpress.
المعمارية والقرارات التقنية
يفصل التصميم بين واجهة البروتوكول الموجهة للوكلاء وبين محرك المستندات الداخلي في LibreOffice:
- خادم MCP بلغة Python: يقدّم فهرساً منظماً يضم أكثر من 210 أداة محددة المعاملات، مما يتيح لوكلاء الذكاء الاصطناعي استكشافها وتنفيذ عمليات الإنشاء والتنسيق والاستعلام والتصدير بدقة.
- الجسر البرمجي عبر LibreOffice UNO: يتصل الخادم مباشرة بواجهة Universal Network Objects (UNO) الخاصة بـ LibreOffice بدلاً من تعديل ملفات ODF خارجياً، مما يضمن صحة التنسيقات والصيغ الحسابية والتخطيط الطباعي.
- تغطية شاملة للحزمة المكتبية: يدعم معالجة النصوص (Writer)، والجداول الحسابية (Calc)، والعروض التقديمية (Impress) عبر واجهة خادم موحدة.
- تغليف وتوزيع مرن (
.oxtوMCPB): توفير إضافة.oxtأصلية لـ LibreOffice إلى جانب حزمة MCPB لتبسيط التثبيت لدى المستخدمين ومستضيفي الوكلاء.
دورة حياة البرمجيات وممارسات الجودة
يتطلب بناء واجهة تضم أكثر من 210 أداة للوكلاء انضباطاً صارماً في تصميم العقود البرمجية:
- مخططات أدوات حتمية: تعريف دقيق لمدخلات ومخرجات كل أداة لتمكين الوكيل من تنفيذ سلاسل تعديل متعددة الخطوات بثبات.
- تقسيم وظيفي واضح: فصل قدرات Writer وCalc وImpress في مساحات منظمة بدلاً من دوال ضخمة متداخلة.
- حزم توزيع قابلة للتكرار: توفير الإضافة وحزمة MCPB بصورة موثقة ومفتوحة للمراجعة والمساهمة المجتمعية.
التقنيات والمخرجات
| الطبقة | التقنية / المخرج | الدور |
|---|---|---|
| البروتوكول والتنفيذ | Python وMCP | توفير أكثر من 210 أداة أتمتة مهيكلة لوكلاء الذكاء الاصطناعي |
| واجهة المحرك المكتبي | LibreOffice UNO | تحكم برمجي أصلي في Writer وCalc وImpress |
| التوزيع والتثبيت | إضافة .oxt وحزمة MCPB |
تثبيت ميسّر داخل LibreOffice وعملاء MCP |
| المستودع المصدري | GitHub (swe-sanad/LibreOffice-MCP) |
شيفرة مصدرية مفتوحة وحزم إصدار موثقة |
أحدث إصدار: v0.10.2 — Full 222-Tool Surface, RTL/CTL & Calc Formula Reliability (v0.10.2)
LibreOffice MCP v0.10.2
v0.10.2 expands the MCP server from 220 to 222 tools and advertises all 222 tools directly by default, alongside targeted fixes for RTL/CTL typography, locale-safe Calc formula normalization, Calc/Writer table styling, document_lifecycle empty-state handling, and list_documents / lo_status reliability.
Overview
LibreOffice MCP bridges LibreOffice and AI assistants (Claude Desktop, Claude Code, VS Code Copilot, and any MCP client) over the native UNO API using LibreOffice's own bundled Python interpreter — requiring zero third-party Python packages (uno + Python standard library only):
- 222-Tool MCP Server (
mcp/libreoffice_mcp.py) — JSON-RPC 2.0 over stdio across 14 tool modules covering Writer, Calc, Impress, Draw, and Cross-application lifecycle, properties, recovery, and automation (embedded Basic/Python macros, windowPrintWindowscreenshots, saved-file XML inspection, anduno_exec/dispatch_unoescape hatches). - LibreOffice Extension (
claude-connector-0.10.2.oxt) — Adds an in-app Claude menu and toolbar in Calc and Writer (with a worker-thread progress dialog and DPAPI-encrypted key storage on Windows) plus the startup agent-acceptor named-pipe job so MCP clients connect flag-free to any open LibreOffice instance. - Claude Desktop Bundle (
libreoffice-connector-0.10.2.mcpb) — One-click.mcpbdesktop extension backed by a Node.js launcher (mcpb/index.js) that auto-locates LibreOffice's bundled Python across Windows, macOS, and Linux.
Tool Surface Breakdown (222 Tools — All Advertised)
| Family | Modules | Tools | Highlights |
|---|---|---|---|
| Calc | calc_analysis (16), calc_data (28), calc_format (17), calc_sheets (17) |
78 | Ranges, locale-normalized formulas, pivot tables, charts, conditional formatting, table presets, RTL sheet layout, print setup |
| Writer | writer_format (20), writer_structure (18), writer_tables (10), writer_text (21) |
69 | Index-accurate paragraph editing, inline markup, headings/TOC, captions, bookmarks, tracked changes, tables, RTL/CTL defaults |
| Cross-App | shared_lifecycle (16), shared_properties (12), shared_recovery (5), shared_automation (16) |
49 | Lifecycle phase advisor, checkpoints, crash recovery, document watch, accessible PDF/form export, Basic/Python macros, lo_screenshot, uno_exec |
| Impress | impress |
19 | Slide layouts, bullet outlines, speaker notes, tables, charts, transitions, per-object animations, slide rendering (impress_export_slides) |
| Draw | draw |
7 | Multi-page vector drawings, shapes, text boxes, images, and glued connectors |
What's Fixed in v0.10.2
- RTL/CTL font and direction handling: Fixed RTL/CTL typography and text direction behavior across Writer and Calc tools, including
writing_mode(rtl/ltr/page) and cell padding (padding_mm,padding_v_mm,padding_h_mm) incalc_format_range(6aa5e18). - Calc formula normalization: Normalized formula argument separators and ODF bracket handling across locales (
6aa5e18,a6ba47c) —_normalize_formulapreserves commas inside plain-text cells and quoted string literals, converts top-level arguments to the sheet'sarg_sep, and strips accidental[...]brackets around sheet references. document_lifecyclewith no document open: Handledno_documentstates cleanly by returning an advisory payload recommendingcreate_documentoropen_documentinstead of raising an error (6aa5e18).list_documents&lo_statusreliability: Routedlist_documentsthrough the shared_open_docs_info()helper (05255dc) and kept document titles JSON-safe inlo_statuswhen an embedded chart is open (1897fd0).- PR #17 fixes: Merged PR #17 improvements (
ad6c85d). - Offline
tools/calltests: Kepttools/callunit tests fully offline by stubbing_connect, and updatedtest_reconnect.pyforarg_sep(a6ba47c).
Added / Changed in v0.10.2
- All 222 tools advertised directly: Updated
BASIC_TOOLSinmcp/loconn/registry.pyso every registered tool is advertised directly to MCP clients without requiringdispatchdiscovery (e48f2d0). - Writer & Calc table styling and sheet setup: Added zebra/row banding and header/border color overrides (
header_bg,header_fg,zebra_bg,even_row_bg,odd_row_bg,border_color) towriter_format_tableandcalc_format_table(plusneutral/sanadpresets),sizes_mmtocalc_set_dimensions, andheader_on/footer_ontocalc_page_setup(6aa5e18). - Documentation: Regenerated
docs/MCP-TOOLS.mdfor v0.10.2 (ebbb68a,e48f2d0) and updated the project name inREADME.md(201d292).
Installation & Bundle Assets
| Asset | Target | How to Install |
|---|---|---|
libreoffice-connector-0.10.2.mcpb |
Claude Desktop | Download from the release assets below and open / drag into Claude Desktop → Settings → Extensions. |
claude-connector-0.10.2.oxt |
LibreOffice (24.8+ / min 7.2) | Install via Tools → Extension Manager → Add… (or unopkg add claude-connector-0.10.2.oxt), then restart LibreOffice. |
Usage Overview
- Automatic LibreOffice Transport (pipe → socket → auto-launch): When
.oxtis installed, the MCP server connects directly to your running LibreOffice over the localagent-acceptornamed pipe with no CLI flags. Otherwise it connects onLO_UNO_PORT(default2002) or auto-launches LibreOffice (LO_AUTOSTART=0to disable,LO_HEADLESS=1for headless). - Claude Code / Generic MCP Client:
claude mcp add libreoffice -e LO_UNO_PORT=2002 -- "C:\Program Files\LibreOffice\program\python.exe" "<repo>\mcp\libreoffice_mcp.py" - VS Code / GitHub Copilot: Open the repository workspace —
.vscode/mcp.jsonconfigures thelibreofficeMCP server automatically viamcpb/index.js. - Full Tool Reference: See
docs/MCP-TOOLS.mdandCHANGELOG.md.