Skip to main content
Glama

LibreOffice MCP 도구

npm version

[!WARNING] 이 프로젝트는 GitHub Copilot이 작성하였으며 사람이 완전히 검토하지 않았습니다. 코드에 버그, 보안 문제 또는 예상치 못한 동작이 포함되어 있을 수 있습니다. 사용 시 위험은 사용자 본인의 책임입니다. 철저한 검토 없이 프로덕션 환경에서 사용하지 마십시오.

AI 에이전트(Claude, Copilot, Gemini, Cursor 등)가 LibreOffice를 통해 Office 문서를 읽고, 쓰고, 편집할 수 있는 기능을 제공하는 Model Context Protocol (MCP) 서버입니다. LLM 컨텍스트 사용량을 최소화하는 토큰 효율적인 설계를 갖추고 있습니다.

chrome-devtools-mcp의 아키텍처에서 영감을 받았습니다.

✨ 주요 기능

  • 22개의 MCP 도구: 읽기, 쓰기, 스프레드시트 및 프레젠테이션 기능 포함

  • 토큰 효율적인 설계: 개요 우선 탐색, 범위 기반 액세스, 페이지 매김

  • 광범위한 형식 지원: DOCX, DOC, XLSX, XLS, PPTX, PPT, ODT, ODS, ODP, RTF, CSV, TXT, PDF

  • 레거시 형식 브리지: .doc, .xls, .ppt 파일은 파싱 전 LibreOffice를 통해 자동 변환

  • 기본 읽기 시 LibreOffice 불필요: 네이티브 파서가 DOCX, XLSX, PPTX를 직접 처리

  • LibreOffice 필수 작업: 레거시 형식, PDF 내보내기, 형식 변환

Related MCP server: docx-mcp-server

📋 지원 형식

형식

확장자

읽기

쓰기

방식

Word 2007+

.docx, .dotx

✅

✅

네이티브 (mammoth 읽기 / JSZip OOXML 쓰기)

Word 97-2003

.doc, .dot

✅

✅

LibreOffice 브리지

Excel 2007+

.xlsx, .xlsm

✅

✅

네이티브 (ExcelJS)

Excel 97-2003

.xls

✅

✅

LibreOffice 브리지

PowerPoint 2007+

.pptx

✅

✅

네이티브 (JSZip OOXML)

PowerPoint 97-2003

.ppt

✅

✅

LibreOffice 브리지

OpenDocument Text

.odt

✅

✅

LibreOffice 브리지

OpenDocument Spreadsheet

.ods

✅

✅

LibreOffice 브리지

OpenDocument Presentation

.odp

✅

✅

LibreOffice 브리지

Rich Text Format

.rtf

✅

✅

LibreOffice 브리지

CSV

.csv

✅

✅

네이티브

PDF

.pdf

✅ (텍스트)

❌

LibreOffice CLI

일반 텍스트

.txt

✅

✅

네이티브

🚀 빠른 시작

사전 요구 사항

  • Node.js 20+

  • LibreOffice (기본 DOCX/XLSX/PPTX 읽기에는 선택 사항; .doc/.xls/.ppt 및 형식 변환에는 필수)

    • Windows: LibreOffice 다운로드

    • macOS: brew install --cask libreoffice

    • Linux: sudo apt install libreoffice 또는 sudo dnf install libreoffice

설치

npx 사용 (권장 — 설치 불필요):

{
  "mcpServers": {
    "libreoffice": {
      "command": "npx",
      "args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"]
    }
  }
}

전역 설치:

npm install -g @passerbyflutter/libreoffice-mcp-tools

소스에서 설치:

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

MCP 클라이언트 구성

MCP 클라이언트 구성(예: Claude Desktop claude_desktop_config.json)에 추가하십시오:

{
  "mcpServers": {
    "libreoffice": {
      "command": "npx",
      "args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"],
      "env": {
        "SOFFICE_PATH": "/path/to/soffice"
      }
    }
  }
}

또는 프로젝트 루트의 .mcp.json을 사용하십시오:

{
  "mcpServers": {
    "libreoffice": {
      "command": "npx",
      "args": ["-y", "@passerbyflutter/libreoffice-mcp-tools"]
    }
  }
}

CLI 옵션

node build/bin/libreoffice-mcp.js [options]

  --libreoffice-path <path>   Path to soffice executable
                              (default: auto-detected or SOFFICE_PATH env)

🛠 도구 참조

문서 관리

도구

설명

document_open

파일 열기 → docId 핸들 반환. 레거시 형식 자동 브리지.

document_close

문서 핸들 및 임시 파일 해제

document_list

열려 있는 모든 문서 나열

document_create

새 빈 문서 생성 (writer/calc/impress)

document_save

현재 또는 새 경로에 저장

document_export

LibreOffice를 통해 내보내기 (PDF, HTML, CSV 등)

document_convert

파일 형식 변환 (DOC→DOCX, XLSX→CSV 등)

읽기 (토큰 효율적)

도구

설명

document_get_metadata

제목, 작성자, 단어/페이지 수, 날짜

document_get_outline

제목 (Writer) / 시트 이름 (Calc) / 슬라이드 제목 (Impress)

document_read_text

Markdown 형식의 페이지 매김된 문서 텍스트

document_read_range

특정 단락 또는 슬라이드 범위

document_search

주변 컨텍스트와 함께 텍스트 찾기

쓰기 (Writer)

도구

설명

document_insert_text

시작/끝/제목 뒤에 삽입

document_replace_text

찾기 및 바꾸기 (첫 번째 또는 모든 항목)

document_insert_paragraph

특정 인덱스에 단락 삽입

document_apply_style

제목/단락 스타일 적용

스프레드시트 (Calc)

도구

설명

spreadsheet_list_sheets

행/열 수가 포함된 시트 이름

spreadsheet_get_range

JSON + 마크다운 테이블 형식의 셀 범위

spreadsheet_set_cell

셀 값 또는 수식 설정

spreadsheet_set_range

2D 값 범위 설정

spreadsheet_add_sheet

새 시트 추가

spreadsheet_get_formulas

범위 내 수식 표현식 가져오기

프레젠테이션 (Impress)

도구

설명

presentation_list_slides

인덱스가 포함된 슬라이드 제목

presentation_get_slide

전체 슬라이드 콘텐츠 (제목, 본문, 노트)

presentation_get_notes

발표자 노트

presentation_add_slide

새 슬라이드 추가 (LibreOffice 필요)

presentation_update_slide

슬라이드 콘텐츠 업데이트

💡 토큰 절약 워크플로우

최대 토큰 효율성을 위해 다음 패턴을 따르십시오:

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

전체 문서를 덤프하는 대신 필요한 부분만 정확하게 탐색합니다.

스프레드시트 워크플로우:

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

🏗 아키텍처

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

🧪 테스트

# Create sample fixtures
node tests/create-fixtures.mjs

# Run smoke tests
npm test

📝 환경 변수

변수

설명

SOFFICE_PATH

LibreOffice soffice 실행 파일 경로

DEBUG

상세 로깅을 위해 lo-mcp:*로 설정

📄 라이선스

MIT

Available Tools

27 tools
document_apply_styleC

Apply a heading or paragraph style to a specific paragraph by index.

Inputs: docId (required), paragraphIndex (required), style (required).

document_closeA

Close an open document and release its resources (including any temp files from format bridging).

Inputs: docId (required).

document_convertA

Convert a document file to a different format using LibreOffice CLI. Creates a new file; original is not modified. Useful for: DOC→DOCX, DOCX→PDF, XLSX→CSV, etc. LibreOffice must be installed.

Inputs: filePath (required), format (required), outputPath.

document_createB

Create a new empty document and open it. Returns a docId. Supports creating: writer (text document → .docx), calc (spreadsheet → .xlsx), impress (presentation → .pptx).

Inputs: documentType (required), filePath (required).

document_exportA

Export a document to a different format using LibreOffice. Supports exporting to: PDF, HTML, TXT, DOCX, XLSX, PPTX, ODT, ODS, ODP, CSV. LibreOffice must be installed.

Inputs: docId (required), format (required), outputPath.

document_get_metadataA

Get metadata for an open document: title, author, page count, word count, format, file size, dates. Token-efficient: use this before reading document content to understand its size and structure.

Inputs: docId (required).

document_get_outlineA

Get the structural outline of a document:

  • Writer documents: headings hierarchy (H1, H2, H3...)

  • Calc spreadsheets: list of sheet names with row/column counts

  • Impress presentations: slide titles with index numbers Token-efficient: always call this before document_read_text to understand structure.

Inputs: docId (required).

document_insert_paragraphC

Insert a new paragraph at a specific index in a Writer document.

Inputs: docId (required), text (required), index (required), style.

document_insert_textB

Insert text into a Writer document at a specified position. Position options: 'start' (beginning), 'end' (end of document), or after a specific heading text.

Inputs: docId (required), text (required), position, headingText, +1 more.

document_listB

List all currently open documents with their docId, file path, format, and size.

Inputs: no named parameters.

document_openA

Open a document file and return a docId handle for use with other tools. Supports: .docx, .doc, .xlsx, .xls, .pptx, .ppt, .odt, .ods, .odp, .rtf, .csv, .txt, .pdf Legacy binary formats (.doc, .xls, .ppt, .odt, .ods, .odp, .rtf) are automatically converted via LibreOffice before parsing. Returns docId to use with all other document tools.

Inputs: filePath (required).

document_read_rangeA

Read a specific range of a document by paragraph index (for Writer) or slide index (for Impress). More token-efficient than document_read_text when you only need a specific section.

Inputs: docId (required), startIndex (required), endIndex.

document_read_textA

Read document content as Markdown text. For large documents, use limit/offset for pagination. Default returns up to 4000 characters. Use document_get_outline first to understand structure.

Inputs: docId (required), limit, offset, maxChars.

document_replace_textC

Find and replace text in a Writer document. Optionally replace all occurrences.

Inputs: docId (required), find (required), replace (required), replaceAll, +1 more.

document_saveB

Save the current state of a document to its file path (or a new path).

Inputs: docId (required), filePath.

presentation_add_slideC

Add a new slide to a presentation.

Inputs: docId (required), title (required), body, notes.

presentation_get_notesB

Get speaker notes for all slides or a specific slide.

Inputs: docId (required), slideIndex.

presentation_get_slideB

Get the full content of a specific slide: title, body text, and speaker notes.

Inputs: docId (required), slideIndex (required).

presentation_list_slidesA

List all slides in a presentation with their index and title. Token-efficient overview before reading content.

Inputs: docId (required).

presentation_update_slideC

Update the title or body text of an existing slide.

Inputs: docId (required), slideIndex (required), title, body.

spreadsheet_add_sheetC

Add a new sheet to a spreadsheet workbook.

Inputs: docId (required), sheetName (required), headers.

spreadsheet_get_formulasA

Get all formulas in a spreadsheet range (returns formula expressions, not computed values).

Inputs: docId (required), sheetName, range.

spreadsheet_get_rangeA

Read a range of cells from a spreadsheet sheet. Returns data as structured JSON and a markdown table. Use range like "A1:D10" for specific cells, or omit for paginated full sheet. Token-efficient: specify a range rather than reading the whole sheet.

Inputs: docId (required), sheetName, range, limit, +2 more.

spreadsheet_list_sheetsB

List all sheets in a spreadsheet with their names, row counts, and column counts.

Inputs: docId (required).

spreadsheet_set_cellA

Set the value or formula of a single cell in a spreadsheet. Changes are saved immediately.

Inputs: docId (required), cell (required), value (required), sheetName, +1 more.

spreadsheet_set_rangeC

Set multiple cell values in a spreadsheet. Provide a 2D array of values matching the range.

Inputs: docId (required), startCell (required), values (required), sheetName.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 27 tools

    Disambiguation4/5

    Most tools have distinct purposes with clear boundaries, such as document operations versus presentation or spreadsheet tools. However, some overlap exists: document_read_text and document_read_range both handle reading content, and document_convert and document_export both involve format conversion, which could cause minor confusion in selection.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern with clear prefixes (document_, presentation_, spreadsheet_) that group related operations. All names use snake_case uniformly, making them predictable and easy to parse for agents.

    Tool Count3/5

    With 27 tools, the count is borderline high for a single server, potentially overwhelming for agents. While the tools cover a broad range of LibreOffice operations, the number feels heavy and could be streamlined by consolidating overlapping functions like reading or conversion tools.

    Completeness5/5

    The tool set provides comprehensive coverage for document, presentation, and spreadsheet workflows, including creation, reading, updating, conversion, and metadata operations. There are no obvious gaps; agents can perform full CRUD/lifecycle tasks across all supported file types without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables complete Office document lifecycle management for AI agents, including creation, editing, conversion, and templating of DOCX, XLSX, PPTX, PDF, and EML files.
      40
      57 PyPI
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to create and process office documents locally, including generating branded PDF, Word, Excel, and editable PowerPoint files from templates and themes, plus reading, OCR, form-filling, manipulation, and conversion of PDFs.
      1
      MIT