hwp-mcp
hwp-mcp
这是一个允许在 Claude、Cursor、ChatGPT 等 MCP 兼容 AI 中读取、修改和创建韩文文档 (.hwp / .hwpx) 的服务器。
hwp-mcp 是一个 MCP (Model Context Protocol) 服务器,使 AI 代理能够直接处理韩文办公文档。不仅支持读取,还支持文本修改、模板填充以及创建新文档。
这是什么项目?
该项目分为两个部分:
🔧 rhwp 的工作(核心引擎) — Edward Kim 的 rhwp 是一个开源引擎,通过逆向工程解析了封闭的韩文格式(HWP 5.0 二进制、HWPX/OWPML),并使用 Rust + WebAssembly 实现。解析、表格/图像/公式/页眉提取、SVG 渲染、韩文兼容 Field API 等所有核心能力均由 rhwp 提供。没有 rhwp,就没有这个项目。
🤝
hwp-mcp的工作(代理适配器) — 构建在@rhwp/core之上的轻量级 MCP 服务器层。我们添加了:read_hwp、fill_hwp_template、replace_hwp_text等代理友好型工具签名 — 使 Claude/Cursor 等 LLM 能够用自然语言调用一次性转储正文、表格、图像、页眉、页脚、脚注、公式的以场景为中心的遍历器
自动处理表格单元格合并、脚注/公式自动合并等易用性层
为绕过 rhwp 0.7.7
exportHwpx往返限制的.hwpxZIP 级变异层(实现实际写入的核心)npm
hwp-mcp包(一键安装)+ Node.js WASM 引导程序
总结:这是一个让 AI 真正能够读写韩文文档的适配器。请将对所有韩文处理能力的感谢发送给 rhwp 项目 🙏
Related MCP server: HWP-MCP
安装
Claude Code
claude mcp add hwp-mcp -- npx -y hwp-mcpClaude Desktop / Cursor / VS Code (settings JSON)
{
"mcpServers": {
"hwp-mcp": {
"command": "npx",
"args": ["-y", "hwp-mcp"]
}
}
}需要 Node.js 20 或更高版本。
工具列表
这是 hwp-mcp v0.2 暴露的 34 个 MCP 工具。读取/渲染支持 .hwp/.hwpx,写入仅支持 .hwpx。
读取 (5)
工具 |
|
| 说明 |
| ✅ | ✅ | 一次性获取正文 + 表格 (Markdown) + 图像列表 |
| ✅ | ✅ | 正文 + 页眉 + 页脚 + 脚注 + 公式集成文本 |
| ✅ | ✅ | 将表格转换为 GitHub Markdown (处理单元格合并) |
| ✅ | ✅ | 嵌入式图像列表 (mime, bytes) |
| ✅ | ✅ | 将图像提取到磁盘 |
元数据 / 查询 (5)
工具 |
|
| 说明 |
| ✅ | ✅ | 版本、页数、字体、表格/图像/脚注/公式统计 |
| ✅ | ✅ | 各节的纸张大小、页边距、分栏、页眉/页脚边距 |
| ✅ | ✅ | 韩文域 (Field) 列表 |
| ✅ | ✅ | 查询域值 |
| – | ✅ |
|
视觉渲染 (4)
工具 |
|
| 说明 |
| ✅ | ✅ | 指定页面 → SVG (内联/文件) |
| ✅ | ✅ | 所有页面 SVG 批量处理 |
| ✅ | ✅ | 页面 → HTML |
| – | – | OWPML 公式脚本 → SVG |
写入 — 文本 (5)
工具 |
| 说明 |
| ✅ | 查找并替换特定字符串 |
| ✅ | 填充 |
| ✅ | 整体替换第 N 段文本 |
| ✅ | 直接设置表格单元格 (行, 列) 文本 |
| ✅ | 设置域值 |
写入 — 结构 (9)
工具 |
| 说明 |
| ✅ | 在正文末尾添加新段落 |
| ✅ | 删除第 N 段 |
| ✅ | 在表格末尾添加新行 |
| ✅ | 删除表格行 |
| ✅ | 在表格末尾添加新列 (所有行) |
| ✅ | 删除表格列 |
| ✅ | 水平合并单元格 (colSpan) |
| ✅ | 垂直合并单元格 (rowSpan) |
| ✅ | 替换嵌入式图像 |
写入 — 格式 (2)
工具 |
| 说明 |
| ✅ | 字体颜色、加粗、斜体、下划线、大小 (添加 charPr) |
| ✅ | 段落对齐、缩进、行间距 (添加 paraPr) |
写入 — 图像 / 表格 / 新建 (4)
工具 |
| 说明 |
| ✅ | 添加新图像 (BinData + manifest + |
| ✅ | 删除 BinData/ 条目 |
| ⚠️ | 插入新 OWPML 表格 (实验性 — 文件有效,rhwp 识别不完全) |
| ✅ | 用文本创建新的 |
内容提取矩阵
内容 | 提取 | 备注 |
正文段落文本 | ✅ |
|
表格 (含单元格合并) | ✅ |
|
嵌入式图像 | ✅ | 提取 PNG/JPG/BMP 等 |
页眉 / 页脚 | ✅ |
|
脚注 (footnote) | ✅ | 结果末尾包含 |
公式 (equation) | ✅ | OWPML 脚本格式 (例如: |
页面 SVG 渲染 | ✅ |
|
文本框正文 | ❌ | rhwp 的 |
尾注 (endnote) | – | rhwp 本身不支持 (仅支持脚注) |
图表 (chart) | ❌ | v0.3 之后 |
写入矩阵
操作 |
|
| 备注 |
单个文本替换 | ❌ | ✅ |
|
填充多个占位符 | ❌ | ✅ |
|
整体替换段落文本 | ❌ | ✅ |
|
直接修改表格单元格 | ❌ | ✅ |
|
设置域值 | ❌ | ✅ |
|
添加 / 删除新段落 | ❌ | ✅ |
|
添加 / 删除表格行 | ❌ | ✅ |
|
替换 / 删除图像 | ❌ | ✅ |
|
创建新文档 (文本) | – | ✅ |
|
创建新文档 (表格) | – | ⚠️ | 展平为文本行 (v0.3 中实现真正的 OWPML 表格) |
插入新图像 | ❌ | ✅ |
|
添加 / 删除表格列 | ❌ | ✅ |
|
合并单元格 (水平/垂直) | ❌ | ✅ |
|
字体格式 (颜色/加粗/斜体/下划线/大小) | ❌ | ✅ |
|
段落格式 (对齐/缩进/行间距) | ❌ | ✅ |
|
插入新表格 (真正的 OWPML) | ❌ | ⚠️ |
|
新插入页眉/页脚 | ❌ | ❌ | v0.3 |
图表/书签/样式定义 | ❌ | ❌ | v0.3 |
由于 rhwp 0.7.7
exportHwp往返限制,v0.2 不支持.hwp二进制写入。请在韩文办公软件中另存为.hwpx后使用写入工具,或等待 v0.3 版本发布。
使用示例
读取政府韩文文档
나: /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写入 — 读取支持.hwp/.hwpx。写入仅支持.hwpx。如果对.hwp输入调用写入工具,将返回明确的错误消息。请在韩文办公软件中另存为.hwpx后使用,或等待 v0.3 发布。拒绝跨格式保存 —
.hwpx输入只能保存为.hwpx。可提取页眉/页脚/脚注,文本框/尾注/公式待 v0.3 —
read_hwp_text结果中,页眉显示为--- headers ---,页脚为--- footers ---,脚注为--- footnotes ---块。文本框正文、尾注、公式提取计划在 v0.3 实现。搜索词跨越两个文本节点时无法匹配 — 例如:一个
<hp:t>以“产业”结尾,下一个以“AI”开头,则“产业AI”无法匹配。这是与韩文 hwpctl 相同的限制。create_hwpx_document中的表格在 v0.2 中展平为文本行 — 真正的 OWPML 表格将在 v0.3 中实现。
如何工作?
读取:
@rhwp/core(rhwp 的 Rust+WASM 解析器) 遍历节、段落、表格(含合并单元格)、图像。写入 (.hwpx):直接解析 ZIP 归档中的
Contents/section*.xml,搜索/替换<hp:t>文本节点,然后重新打包(mimetype 按规范存储)。这是为了绕过 rhwp 的exportHwpx()往返问题而添加的层。新文档:使用 rhwp 的
createBlankDocument+insertText编写,然后使用exportHwpx保存(文本往返稳定)。
制作人员
rhwp (@edwardkim) — 核心解析器、渲染器、Field API。将封闭的韩文格式开放的所有工作都是该项目的基础。如果可能,请也支持该项目:https://github.com/edwardkim/rhwp
hwp-mcp — 构建在 rhwp 之上的轻量级 MCP 适配器,使 AI 代理能够用自然语言调用。核心能力均属于 rhwp,我们只是将其连接到 LLM 的接线员。
覆盖范围
领域 | 覆盖 |
读取/提取 | ~90% |
渲染 | ~85% (SVG · HTML · 公式 SVG · Canvas 为浏览器专用,故排除) |
写入 — 文本 | ~95% |
写入 — 结构 | ~90% (行·列·合并·图像 4 种) |
写入 — 格式 | ~70% (字体 + 段落) |
元数据 / 域 | ~85% |
整体加权 | ~85% |
剩余 v0.3 的大项:.hwp 二进制写入、图表、样式定义/应用、文本框正文提取、hwpctl 30 Actions(故意排除)。
英文 (English)
hwp-mcp 是一个 MCP 服务器,用于从 Claude / Cursor / ChatGPT 和任何 MCP 兼容客户端读取和写入韩文 (.hwp / .hwpx) 文档。读取适用于两种格式;写入目前支持 .hwpx(查找/替换、模板填充、创建新文档)—— .hwp 写入计划在 v0.3 中实现。 构建在 rhwp(Edward Kim 的 Rust + WebAssembly HWP 引擎,MIT)之上。安装:claude mcp add hwp-mcp -- npx -y hwp-mcp。
许可证
MIT。
Available Tools
34 toolsappend_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
Scored across 34 tools
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.
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.
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.
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
Related MCP Connectors
Create Korean HWPX files from Markdown, fill HWP/HWPX forms, render pages and PDFs
Make, convert and read Korean HWP and HWPX files, and fill in common Korean forms.
Korean hwpx forms held in shape: AI writes the lines, the server keeps the frame and measures each.
Extract text and tables from Korean HWP/HWPX, PDF, Word, Excel and PowerPoint files
Related MCP Servers
- FlicenseAqualityDmaintenanceAn 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-
- FlicenseNot gradedqualityNot gradedmaintenanceAn 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.-
- FlicenseNot gradedqualityDmaintenanceAn 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.-
- AlicenseNot gradedqualityCmaintenanceMCP server for AI-driven editing of HWPX (Korean word processor) documents, providing 132 tools for text, tables, images, and more.MIT