مفتوح المصدر · مفتوح المصدر · 2026

LibreOffice-MCP

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

Python · LibreOffice UNO · MCP

GitHub | Release v0.10.2

بطاقة عرض إصدار LibreOffice MCP v0.10.2 ومعمارية الأدوات الـ 222 عبر UNO

نظرة عامة والمشكلة الهندسية

يمتلك وكلاء الذكاء الاصطناعي قدرة عالية على صياغة النصوص وتحليل البيانات، غير أن أتمتة حزم المكتب الفعلية—مثل تنسيق التقارير الاحترافية، وتعديل الجداول الحسابية، وبناء العروض التقديمية، وتصدير ملفات PDF—تبقى هشة عندما تعتمد على تعديل ملفات XML يدوياً أو محاكاة واجهة المستخدم الرسومية.

يربط مشروع LibreOffice-MCP وكلاء الذكاء الاصطناعي مباشرة ببيئة LibreOffice عبر بروتوكول سياق النموذج (MCP). ويضم المشروع إضافة LibreOffice بصيغة .oxt، وحزمة MCPB، وخادم MCP بلغة Python يوفر أكثر من 210 أداة برمجية للتحكم الكامل في Writer وCalc وImpress.

مشروع مفتوح المصدر: يُطوّر ويُصان المشروع علناً على GitHub عبر المستودع swe-sanad/LibreOffice-MCP ضمن منظومة أدوات MCP للمطورين.

المعمارية والقرارات التقنية

يفصل التصميم بين واجهة البروتوكول الموجهة للوكلاء وبين محرك المستندات الداخلي في LibreOffice:

  • خادم MCP بلغة Python: يقدّم فهرساً منظماً يضم أكثر من 210 أداة محددة المعاملات، مما يتيح لوكلاء الذكاء الاصطناعي استكشافها وتنفيذ عمليات الإنشاء والتنسيق والاستعلام والتصدير بدقة.
  • الجسر البرمجي عبر LibreOffice UNO: يتصل الخادم مباشرة بواجهة Universal Network Objects (UNO) الخاصة بـ LibreOffice بدلاً من تعديل ملفات ODF خارجياً، مما يضمن صحة التنسيقات والصيغ الحسابية والتخطيط الطباعي.
  • تغطية شاملة للحزمة المكتبية: يدعم معالجة النصوص (Writer)، والجداول الحسابية (Calc)، والعروض التقديمية (Impress) عبر واجهة خادم موحدة.
  • تغليف وتوزيع مرن (.oxt وMCPB): توفير إضافة .oxt أصلية لـ LibreOffice إلى جانب حزمة MCPB لتبسيط التثبيت لدى المستخدمين ومستضيفي الوكلاء.
لماذا UNO بدلاً من XML المباشر: التعامل عبر UNO يوكّل حسابات التخطيط وتوريث الأنماط والتصدير إلى محرك LibreOffice الأصلي نفسه، متجنباً تشوه المستندات.

دورة حياة البرمجيات وممارسات الجودة

يتطلب بناء واجهة تضم أكثر من 210 أداة للوكلاء انضباطاً صارماً في تصميم العقود البرمجية:

  1. مخططات أدوات حتمية: تعريف دقيق لمدخلات ومخرجات كل أداة لتمكين الوكيل من تنفيذ سلاسل تعديل متعددة الخطوات بثبات.
  2. تقسيم وظيفي واضح: فصل قدرات Writer وCalc وImpress في مساحات منظمة بدلاً من دوال ضخمة متداخلة.
  3. حزم توزيع قابلة للتكرار: توفير الإضافة وحزمة 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):

  1. 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, window PrintWindow screenshots, saved-file XML inspection, and uno_exec / dispatch_uno escape hatches).
  2. 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.
  3. Claude Desktop Bundle (libreoffice-connector-0.10.2.mcpb) — One-click .mcpb desktop 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) in calc_format_range (6aa5e18).
  • Calc formula normalization: Normalized formula argument separators and ODF bracket handling across locales (6aa5e18, a6ba47c) — _normalize_formula preserves commas inside plain-text cells and quoted string literals, converts top-level arguments to the sheet's arg_sep, and strips accidental [...] brackets around sheet references.
  • document_lifecycle with no document open: Handled no_document states cleanly by returning an advisory payload recommending create_document or open_document instead of raising an error (6aa5e18).
  • list_documents & lo_status reliability: Routed list_documents through the shared _open_docs_info() helper (05255dc) and kept document titles JSON-safe in lo_status when an embedded chart is open (1897fd0).
  • PR #17 fixes: Merged PR #17 improvements (ad6c85d).
  • Offline tools/call tests: Kept tools/call unit tests fully offline by stubbing _connect, and updated test_reconnect.py for arg_sep (a6ba47c).

Added / Changed in v0.10.2

  • All 222 tools advertised directly: Updated BASIC_TOOLS in mcp/loconn/registry.py so every registered tool is advertised directly to MCP clients without requiring dispatch discovery (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) to writer_format_table and calc_format_table (plus neutral/sanad presets), sizes_mm to calc_set_dimensions, and header_on/footer_on to calc_page_setup (6aa5e18).
  • Documentation: Regenerated docs/MCP-TOOLS.md for v0.10.2 (ebbb68a, e48f2d0) and updated the project name in README.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 .oxt is installed, the MCP server connects directly to your running LibreOffice over the local agent-acceptor named pipe with no CLI flags. Otherwise it connects on LO_UNO_PORT (default 2002) or auto-launches LibreOffice (LO_AUTOSTART=0 to disable, LO_HEADLESS=1 for 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.json configures the libreoffice MCP server automatically via mcpb/index.js.
  • Full Tool Reference: See docs/MCP-TOOLS.md and CHANGELOG.md.