Skip to main content
Glama

hwp-mcp

Сервер, позволяющий читать, редактировать и создавать документы Hangul (.hwp / .hwpx) в ИИ, совместимых с MCP, таких как Claude, Cursor, ChatGPT и другие.

npm version npm downloads Built on rhwp License: MIT GitHub release

hwp-mcp — это сервер Model Context Protocol (MCP), который позволяет ИИ-агентам напрямую работать с документами Hancom Office. Возможно не только чтение, но и редактирование текста, заполнение шаблонов и создание новых документов.

Что это за проект?

Этот проект состоит из двух частей:

  • 🔧 Что сделал rhwp (основной движок) — rhwp от Edward Kim — это open-source движок, реализованный на Rust + WebAssembly, который с помощью обратной разработки полностью раскрыл закрытые форматы Hangul (HWP 5.0 binary, HWPX/OWPML). Парсинг, извлечение таблиц, изображений, формул, колонтитулов, рендеринг SVG, API полей Hancom — все эти ключевые возможности предоставляет rhwp. Без rhwp этого проекта бы не существовало.

  • 🤝 Что сделал hwp-mcp (адаптер для агентов) — тонкий слой MCP-сервера поверх @rhwp/core. Мы добавили:

    • Инструменты, понятные агентам, такие как read_hwp, fill_hwp_template, replace_hwp_text, чтобы LLM (например, Claude/Cursor) могли вызывать их на естественном языке.

    • Сценарный обходчик (traversal walker), который разом выгружает основной текст, таблицы, изображения, колонтитулы, сноски и формулы.

    • Слой удобства использования, такой как автоматическая обработка объединения ячеек таблиц, автоматическое объединение сносок/формул.

    • Слой мутации на уровне ZIP-архива .hwpx для обхода ограничений exportHwpx в rhwp 0.7.7 (ключевой элемент, делающий запись возможной).

    • Пакет npm hwp-mcp (установка одной командой) + загрузчик Node.js WASM.

Итог: Адаптер, который позволяет ИИ по-настоящему читать и писать документы Hangul. Пожалуйста, выражайте благодарность за все возможности работы с Hangul проекту rhwp 🙏


Related MCP server: HWP-MCP

Установка

Claude Code

claude mcp add hwp-mcp -- npx -y hwp-mcp

Claude Desktop / Cursor / VS Code (settings JSON)

{
  "mcpServers": {
    "hwp-mcp": {
      "command": "npx",
      "args": ["-y", "hwp-mcp"]
    }
  }
}

Требуется Node.js 20 или выше.


Список инструментов

Это 34 MCP-инструмента, предоставляемых hwp-mcp v0.2. Чтение/рендеринг поддерживаются для обоих форматов (.hwp/.hwpx), запись — только для .hwpx.

Чтение (5)

Инструмент

.hwp

.hwpx

Описание

read_hwp

✅

✅

Основной текст + таблицы (Markdown) + список изображений

read_hwp_text

✅

✅

Объединенный текст: основной + колонтитулы + сноски + формулы

read_hwp_tables

✅

✅

Таблицы в формате GitHub Markdown (с учетом объединения ячеек)

list_hwp_images

✅

✅

Список встроенных изображений (mime, байты)

extract_hwp_images

✅

✅

Извлечение изображений на диск

Мета / Запросы (5)

Инструмент

.hwp

.hwpx

Описание

get_hwp_info

✅

✅

Статистика: версия, страницы, шрифты, таблицы/изображения/сноски/формулы

get_hwp_page_def

✅

✅

Размер бумаги, поля, колонки, отступы колонтитулов по разделам

list_hwp_fields

✅

✅

Список полей Hancom

get_hwp_field_value

✅

✅

Получение значения поля

list_hwp_bindata

–

✅

Список записей BinData/ в .hwpx

Визуальный рендеринг (4)

Инструмент

.hwp

.hwpx

Описание

render_hwp_page

✅

✅

Указанная страница → SVG (inline/файл)

render_hwp_all_pages

✅

✅

Пакетный рендеринг всех страниц в SVG

render_hwp_html

✅

✅

Страница → HTML

render_hwp_equation_svg

–

–

Скрипт формулы OWPML → SVG

Запись — Текст (5)

Инструмент

.hwpx

Описание

replace_hwp_text

✅

Поиск и замена конкретной строки

fill_hwp_template

✅

Заполнение нескольких плейсхолдеров, например {{имя}}

set_hwp_paragraph_text

✅

Полная замена текста N-го абзаца

set_hwp_cell_text

✅

Прямая установка текста в ячейке таблицы (строка, столбец)

set_hwp_field_value

✅

Установка значения поля

Запись — Структура (9)

Инструмент

.hwpx

Описание

append_hwp_paragraph

✅

Новый абзац в конце документа

delete_hwp_paragraph

✅

Удаление N-го абзаца

append_hwp_table_row

✅

Новая строка в конце таблицы

delete_hwp_table_row

✅

Удаление строки таблицы

append_hwp_table_column

✅

Новый столбец в конце таблицы (во всех строках)

delete_hwp_table_column

✅

Удаление столбца таблицы

merge_hwp_cells_horizontal

✅

Горизонтальное объединение ячеек (colSpan)

merge_hwp_cells_vertical

✅

Вертикальное объединение ячеек (rowSpan)

replace_hwp_image

✅

Замена встроенного изображения

Запись — Форматирование (2)

Инструмент

.hwpx

Описание

apply_hwp_text_style

✅

Цвет текста, жирный, курсив, подчеркивание, размер (добавление charPr)

apply_hwp_paragraph_style

✅

Выравнивание абзаца, отступы, межстрочный интервал (добавление paraPr)

Запись — Изображения / Таблицы / Новое (4)

Инструмент

.hwpx

Описание

insert_hwp_image

✅

Добавление нового изображения (BinData + manifest + <hp:pic>)

delete_hwp_image

✅

Удаление записи BinData/

insert_hwp_table

⚠️

Вставка новой таблицы OWPML (экспериментально — файл валиден, rhwp распознает не полностью)

create_hwpx_document

✅

Создание нового .hwpx из текста

Матрица извлечения контента

Контент

Извлечение

Примечание

Текст абзацев

✅

read_hwp_text, read_hwp

Таблицы (вкл. объединение)

✅

read_hwp_tables в формате markdown

Встроенные изображения

✅

Извлечение PNG/JPG/BMP и т.д.

Колонтитулы

✅

Блоки --- headers --- / --- footers --- в результате read_hwp_text

Сноски (footnote)

✅

Блок --- footnotes --- в конце результата, вид [1] Текст…

Формулы (equation)

✅

Вид скрипта OWPML (например, TIMES LEFT ( {a} over {b} RIGHT )), блок --- equations ---

Рендеринг страницы SVG

✅

render_hwp_page

Текст в текстовых полях

❌

createShapeControl в rhwp создает их, но паттерн возврата getTextBoxControlIndex неявный — отследим в v0.3

Концевые сноски (endnote)

–

Не поддерживается в самом rhwp (только footnote)

Диаграммы (chart)

❌

После v0.3

Матрица записи

Задача

.hwp

.hwpx

Примечание

Одиночная замена текста

❌

✅

replace_hwp_text

Заполнение плейсхолдеров

❌

✅

fill_hwp_template

Полная замена текста абзаца

❌

✅

set_hwp_paragraph_text

Прямое редактирование ячеек

❌

✅

set_hwp_cell_text (указание строки/столбца)

Установка значения поля

❌

✅

set_hwp_field_value

Добавление / удаление абзаца

❌

✅

append_hwp_paragraph / delete_hwp_paragraph

Добавление / удаление строки таблицы

❌

✅

append_hwp_table_row / delete_hwp_table_row

Замена / удаление изображения

❌

✅

replace_hwp_image / delete_hwp_image

Создание нового документа (текст)

–

✅

create_hwpx_document

Создание нового документа (таблица)

–

⚠️

Выравнивание в текстовые строки (настоящая таблица OWPML в v0.3)

Вставка нового изображения

❌

✅

insert_hwp_image

Добавление / удаление столбца таблицы

❌

✅

append_hwp_table_column / delete_hwp_table_column

Объединение ячеек (гор./верт.)

❌

✅

merge_hwp_cells_horizontal / merge_hwp_cells_vertical

Форматирование текста (цвет/жирный/и т.д.)

❌

✅

apply_hwp_text_style

Форматирование абзаца (выравнивание/отступы)

❌

✅

apply_hwp_paragraph_style

Вставка новой таблицы (настоящая OWPML)

❌

⚠️

insert_hwp_table (экспериментально)

Вставка новых колонтитулов

❌

❌

v0.3

Диаграммы·закладки·определения стилей

❌

❌

v0.3

Запись бинарных файлов .hwp не поддерживается в v0.2 из-за ограничений exportHwp в rhwp 0.7.7. Пожалуйста, сохраните файл как .hwpx в Hancom Office перед использованием инструментов записи или дождитесь релиза v0.3.


Примеры использования

Чтение правительственного документа Hangul

나: /Users/me/2026년_시행계획.hwpx 읽어줘

AI: # 2026년_시행계획.hwpx
    형식: .HWPX | 문단: 153개 | 표: 15개 | 이미지: 2개

    Ⅰ. 추진 배경
    □ (글로벌 현황) 전세계 AI 솔루션 시장 규모는 ...

    ### 표 9 (7행 x 4열)
    | 도메인 | 입력 데이터 | 학습 내용 | 산업AI 솔루션 적용 기능 예시 |
    | --- | --- | --- | --- |
    | 기계 | · 센서 데이터 로그 ... | ... | ... |

Заполнение шаблона

나: /path/to/form.hwpx 에서 {{이름}}=남대현, {{회사}}=포텐랩 으로 채워줘

AI: 저장 완료 (saved): form_filled.hwpx
    총 2건 치환 (2 replacements)
      '{{이름}}' → 1건
      '{{회사}}' → 1건

Замена текста

나: /path/to/doc.hwpx 의 "산업AI" 를 "산업-AI" 로 바꿔줘

AI: '산업AI' → '산업-AI': 18건 교체 (replaced 18)
    저장 (saved): doc_modified.hwpx

Создание нового .hwpx

나: employees.hwpx 에 "사원 명부" 와 "두 번째 줄" 두 줄을 가진 문서 만들어줘

AI: HWPX 문서 생성 완료 (created): employees.hwpx

Извлечение изображений

나: /path/to/document.hwpx 에서 이미지 빼줘

AI: 이미지 2개를 추출했습니다 (extracted 2 images):
    저장 위치: /path/to/document_images
      - image_001.bmp
      - image_002.bmp

Рендеринг страницы в SVG (для визуального анализа)

나: /path/to/document.hwpx 의 첫 페이지를 SVG로 보여줘

AI: <svg xmlns="..." width="793" height="1122" viewBox="...">
    <defs>...</defs>
    ...
    </svg>

Или сохранение на диск:

나: /path/to/document.hwpx 모든 페이지 SVG로 저장해줘

AI: 9/9 페이지 SVG 저장 (rendered 9/9 pages):
    저장 위치: /path/to/document_pages
      - page_001.svg
      - page_002.svg ...

Ограничения

Известные ограничения hwp-mcp v0.2:

  • Запись .hwp не поддерживается — чтение работает для обоих форматов. Запись — только для .hwpx. При вызове инструментов записи для .hwp будет возвращено понятное сообщение об ошибке. Пожалуйста, сохраните файл как .hwpx в Hancom Office или дождитесь релиза v0.3.

  • Отказ от кросс-форматного сохранения — ввод .hwpx сохраняется только как .hwpx.

  • Колонтитулы/сноски извлекаются, текстовые поля/концевые сноски/формулы — в v0.3 — в результате read_hwp_text колонтитулы отображаются как блоки --- headers ---, --- footers ---, сноски — как --- footnotes ---. Извлечение текста из текстовых полей, концевых сносок и формул запланировано на v0.3.

  • Поиск не работает, если поисковый запрос разбит между двумя текстовыми узлами — например, если один <hp:t> заканчивается на "пром", а следующий начинается с "ышленность", то "промышленность" не будет найдено. Это ограничение такое же, как в hwpctl от Hancom.

  • Таблицы в create_hwpx_document в v0.2 выравниваются в текстовые строки — настоящие таблицы OWPML будут в v0.3.


Как это работает?

  • Чтение: @rhwp/core (Rust+WASM парсер rhwp) обходит разделы, абзацы, таблицы (включая объединенные ячейки) и изображения.

  • Запись (.hwpx): Парсит Contents/section*.xml внутри ZIP-архива напрямую, выполняет поиск/замену текстовых узлов <hp:t> и перепаковывает (mimetype остается согласно спецификации). Это слой для обхода проблем с round-trip exportHwpx() в rhwp.

  • Новый документ: Создается с помощью createBlankDocument + insertText в rhwp, затем сохраняется через exportHwpx (текстовый round-trip стабилен).

Кредиты

rhwp (@edwardkim) — основной парсер, рендерер, Field API. Вся работа по открытию закрытого формата Hangul является фундаментом этого проекта. Если есть возможность, поддержите и этот проект: https://github.com/edwardkim/rhwp

hwp-mcp — тонкий MCP-адаптер поверх rhwp, позволяющий ИИ-агентам вызывать функции на естественном языке. Все ключевые возможности принадлежат rhwp, мы лишь обеспечили связь с LLM.

Покрытие

Область

Покрытие

Чтение/извлечение

~90%

Рендеринг

~85% (SVG · HTML · SVG формул · Canvas исключен, так как для браузера)

Запись — Текст

~95%

Запись — Структура

~90% (строки·столбцы·объединение·4 типа изображений)

Запись — Форматирование

~70% (текст + абзац)

Мета / Поля

~85%

Общий вес

~85%

Оставшиеся крупные пункты для v0.3: запись бинарных .hwp, диаграммы, определение·применение стилей, извлечение текста из текстовых полей, 30 действий hwpctl (исключены намеренно).

English

hwp-mcp is an MCP server for reading and writing Korean Hangul (.hwp / .hwpx) documents from Claude / Cursor / ChatGPT and any MCP-compatible client. Read works for both formats; write currently supports .hwpx (find/replace, template fill, create new doc) — .hwp write is planned for v0.3. Built on top of rhwp (Rust + WebAssembly HWP engine by Edward Kim, MIT). Install: claude mcp add hwp-mcp -- npx -y hwp-mcp.

License

MIT.

Available Tools

34 tools
append_hwp_paragraphA

Append a new paragraph to the end of an .hwpx document body. Clones the last paragraph's structure (paraPr/charPr/style refs) and replaces text. Args: file_path, text, output_path (optional).

Inputs: file_path (required), text (required), output_path.

append_hwp_table_columnB

Append a new column to the Nth table in an .hwpx. cells is a JSON string array of cell texts (one per row, top-to-bottom). Args: file_path, table_index, cells, output_path (optional).

Inputs: file_path (required), table_index (required), cells (required), output_path.

append_hwp_table_rowB

Append a new row to the Nth table (0-based) in an .hwpx. cells is a JSON string array of cell texts (length should match table column count). Args: file_path, table_index, cells, output_path (optional).

Inputs: file_path (required), table_index (required), cells (required), output_path.

apply_hwp_paragraph_styleA

Apply paragraph formatting (alignment·indent·line_spacing) to the Nth paragraph in an .hwpx. Adds a new paraPr to header.xml and retargets the paragraph's paraPrIDRef. align: LEFT|CENTER|RIGHT|JUSTIFY|DISTRIBUTE. Args: file_path, paragraph_index, align/indent/line_spacing (any subset), output_path (optional).

Inputs: file_path (required), paragraph_index (required), align, indent, +2 more.

apply_hwp_text_styleA

Apply formatting (color/bold/italic/underline/font_size) to the first run that contains target_text. Adds a new charPr to header.xml and retargets the matching hp:run. Color is a 6-digit hex (e.g. 'FF0000'). Args: file_path, target_text, color/bold/italic/underline/font_size (any subset), output_path (optional).

Inputs: file_path (required), target_text (required), color, bold, +4 more.

create_hwpx_documentA

Create a new .hwpx file from a JSON content list of {type:'text',text} items. Tables (type:'table',headers,rows) are rendered as flat text rows in v0.2. Args: output_path (must end with .hwpx), content (JSON string of items).

Inputs: output_path (required), content (required).

delete_hwp_imageB

Delete a BinData/ ZIP entry inside an .hwpx (effectively removes the embedded image bytes). Args: file_path, target (basename or full entry), output_path (optional).

Inputs: file_path (required), target (required), output_path.

delete_hwp_paragraphB

Delete the Nth paragraph (0-based) from an .hwpx body. Args: file_path, index, output_path (optional).

Inputs: file_path (required), index (required), output_path.

delete_hwp_table_columnB

Delete the Mth column (0-based) from the Nth table in an .hwpx (removes one hp:tc from every row). Args: file_path, table_index, col_index, output_path (optional).

Inputs: file_path (required), table_index (required), col_index (required), output_path.

delete_hwp_table_rowC

Delete the Mth row (0-based) from the Nth table (0-based) in an .hwpx. Args: file_path, table_index, row_index, output_path (optional).

Inputs: file_path (required), table_index (required), row_index (required), output_path.

extract_hwp_imagesA

Save every embedded image to disk. Args: file_path, output_dir (optional; defaults to _images/).

Inputs: file_path (required), output_dir.

fill_hwp_templateC

Fill multiple placeholders in an HWPX template. replacements is a JSON object string, e.g. {"{{name}}":"Kim","{{company}}":"Acme"}. v0.2: .hwpx only. Args: file_path, replacements, output_path (optional).

Inputs: file_path (required), replacements (required), output_path.

get_hwp_field_valueB

Get a Hancom field's current value by name. Args: file_path, name.

Inputs: file_path (required), name (required).

get_hwp_infoC

Get document metadata (version, page count, section count, fonts used, totals for tables/images/footnotes/equations/headers/footers). Args: file_path.

Inputs: file_path (required).

get_hwp_page_defB

Get per-section page definition (paper size, margins, columns) and section properties. Useful for understanding document layout. Args: file_path.

Inputs: file_path (required).

insert_hwp_imageA

Insert a new image into an .hwpx — adds the file to BinData/, registers it in content.hpf, and appends a paragraph with an inline hp:pic. Args: file_path, source_path, ext (png/jpg/bmp/gif; auto from source_path if omitted), output_path (optional).

Inputs: file_path (required), source_path (required), ext, output_path.

insert_hwp_tableB

Insert a real OWPML table at the end of an .hwpx body (proper hp:tbl/hp:tr/hp:tc). headers and rows are both JSON string arrays — headers is a single-row array of strings, rows is an array of row arrays. Args: file_path, headers, rows, output_path (optional).

Inputs: file_path (required), headers (required), rows (required), output_path.

list_hwp_bindataA

List ZIP entries under BinData/ inside an .hwpx (image and binary attachments). Useful before replace_hwp_image. Args: file_path.

Inputs: file_path (required).

list_hwp_fieldsA

List Hancom-style fields (<hp:fldBegin>/end pairs) in the document, with name and type when available. Useful before fill_hwp_template. Args: file_path.

Inputs: file_path (required).

list_hwp_imagesC

List embedded images (mime, byte length, locator) in an HWP/HWPX file. Args: file_path.

Inputs: file_path (required).

merge_hwp_cells_horizontalB

Merge horizontal cells in a row of a table by setting colSpan on the first cell and removing the absorbed cells. Args: file_path, table_index, row, col_start, col_count (>=2), output_path (optional).

Inputs: file_path (required), table_index (required), row (required), col_start (required), +2 more.

merge_hwp_cells_verticalC

Merge vertical cells across rows in a single column by setting rowSpan on the first cell and removing absorbed cells in following rows. Args: file_path, table_index, col, row_start, row_count (>=2), output_path (optional).

Inputs: file_path (required), table_index (required), col (required), row_start (required), +2 more.

read_hwpA

Read full HWP/HWPX document content as text + tables (markdown) + image listing. Args: file_path (absolute path).

Inputs: file_path (required).

read_hwp_tablesC

Extract every table from an HWP/HWPX file as GitHub-flavored markdown. Args: file_path.

Inputs: file_path (required).

read_hwp_textB

Extract plain body text from an HWP/HWPX file (no tables, no images). Args: file_path.

Inputs: file_path (required).

render_hwp_all_pagesA

Render every page of an HWP/HWPX as SVG files in a directory. Args: file_path, output_dir (default _pages/), max_pages (optional limit).

Inputs: file_path (required), output_dir, max_pages.

render_hwp_equation_svgA

Render an OWPML equation script (e.g. 'TIMES LEFT ( {a} over {b} RIGHT )') to SVG. Args: script, font_size (HWP units, default 1300), color (default 0).

Inputs: script (required), font_size, color.

render_hwp_htmlA

Render a single page of an HWP/HWPX as HTML. Useful for AI consumption when SVG isn't ideal. Args: file_path, page (0-based, default 0), output_path (optional).

Inputs: file_path (required), page, output_path.

render_hwp_pageA

Render a single page of an HWP/HWPX document as SVG. If output_path is omitted, the raw SVG string is returned inline (useful for direct LLM consumption). Args: file_path, page (0-based, default 0), output_path (optional).

Inputs: file_path (required), page, output_path.

replace_hwp_imageB

Replace an embedded image inside an .hwpx by overwriting its BinData/ ZIP entry with new file contents. target accepts either basename ('image1.bmp') or full entry path ('BinData/image1.bmp'). Args: file_path, target, source_path, output_path (optional).

Inputs: file_path (required), target (required), source_path (required), output_path.

replace_hwp_textB

Find and replace text in an HWPX file. v0.2: only .hwpx is supported as input/output. Args: file_path, old_text, new_text, output_path (optional).

Inputs: file_path (required), old_text (required), new_text (required), output_path.

set_hwp_cell_textC

Replace a single cell's text in a table inside an .hwpx. Args: file_path, table_index, row, col (all 0-based), text, output_path (optional).

Inputs: file_path (required), table_index (required), row (required), col (required), +2 more.

set_hwp_field_valueA

Set a Hancom field's value by name in an .hwpx (writes the new text between the matching <hp:fldBegin name=...> and <hp:fldEnd>). Use list_hwp_fields first to discover names. Args: file_path, name, value, output_path (optional).

Inputs: file_path (required), name (required), value (required), output_path.

set_hwp_paragraph_textA

Replace the entire text of the Nth paragraph (0-based) in an .hwpx body with new text. The paragraph attributes (paraPr/style refs) are preserved; runs are collapsed into a single hp:run with the new text. Args: file_path, index, text, output_path (optional).

Inputs: file_path (required), index (required), text (required), output_path.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 34 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, targeting specific aspects of HWP/HWPX manipulation (paragraphs, tables, images, fields, etc.). Overlaps like read_hwp, read_hwp_text, and read_hwp_tables are clearly differentiated by their output focus.

    Naming Consistency5/5

    All tools follow a consistent verb_noun (or verb_noun_noun) snake_case pattern, such as append_hwp_paragraph, extract_hwp_images, set_hwp_cell_text. No mixing of conventions.

    Tool Count4/5

    34 tools is a large set, but given the complexity of the HWP format and the need for granular control over paragraphs, tables, images, fields, and rendering, the count is justified and not excessive.

    Completeness4/5

    The tool surface covers CRUD-like operations for paragraphs, tables, images, and fields, plus reading and rendering. Minor gaps exist (e.g., no explicit delete document), but the core workflow is well-supported.

    Maintenance

    ActivityMaintained
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      An MCP server that enables LLMs to convert HWP and HWPX documents into Markdown for analysis and processing. It supports document conversion via local file paths or Base64 content across various MCP-compatible clients.
      2
      -
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that enables AI models to control Hancom Office Hanword (HWP) documents on Windows. It allows for the automated creation, editing, and management of Korean word processor files, including text formatting and table manipulation.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for reading, editing, and creating Hangul Word Processor (.hwpx) files. It enables users to extract text, perform find-and-replace operations, and modify font styles through automated XML patching.
      -