Skip to main content

Model Context Protocol server for local HWPX document automation.

Project description

๐Ÿ“„ hwpx-mcp-server

ํ•œ๊ธ€(HWPX) ๋ฌธ์„œ๋ฅผ AI๋กœ ์ž๋™ํ™”ํ•˜๋Š” MCP ์„œ๋ฒ„

ํ•œ๊ธ€ ์›Œ๋“œํ”„๋กœ์„ธ์„œ ์—†์ด ยท ์ˆœ์ˆ˜ ํŒŒ์ด์ฌ ยท ํฌ๋กœ์Šค ํ”Œ๋žซํผ

PyPI Python License Tests


hwpx-mcp-server๋Š” Model Context Protocol(MCP) ํ‘œ์ค€์„ ๋”ฐ๋ฅด๋Š” ์„œ๋ฒ„๋กœ, python-hwpx ๊ธฐ๋ฐ˜์—์„œ HWPX ๋ฌธ์„œ์˜ ์—ด๋žŒ ยท ๊ฒ€์ƒ‰ ยท ํŽธ์ง‘ ยท ์ €์žฅ์„ AI ํด๋ผ์ด์–ธํŠธ์—์„œ ์ง์ ‘ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

Note โ€” ์ด ์„œ๋ฒ„๋Š” Open XML ๊ธฐ๋ฐ˜ .hwpx ํฌ๋งท์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ๋ ˆ๊ฑฐ์‹œ ๋ฐ”์ด๋„ˆ๋ฆฌ .hwp ํฌ๋งท์€ ์ง์ ‘ ํŽธ์ง‘ ๋Œ€์ƒ์ด ์•„๋‹™๋‹ˆ๋‹ค.


Why?

๊ตญ๋‚ด ๊ณต๊ณต๊ธฐ๊ด€ยทํ•™๊ตยท๊ธฐ์—…์—์„œ๋Š” ํ•œ๊ธ€ ๋ฌธ์„œ ๊ธฐ๋ฐ˜ ์—…๋ฌด๊ฐ€ ๋งค์šฐ ๋งŽ์ง€๋งŒ, ์ž๋™ํ™”๋Š” ์˜ค๋žซ๋™์•ˆ OS/ํ”„๋กœ๊ทธ๋žจ ์˜์กด์„ฑ์ด ์ปธ์Šต๋‹ˆ๋‹ค.

hwpx-mcp-server๋Š” ์ด ์ œ์•ฝ์„ ์ค„์ด๋Š” ๋ฐ ์ดˆ์ ์„ ๋งž์ถฅ๋‹ˆ๋‹ค.

  • โœ… OS ๋ฌด๊ด€ โ€” Windows, macOS, Linux์—์„œ ๋™์ž‘
  • โœ… ํ•œ๊ธ€ ์›Œ๋“œํ”„๋กœ์„ธ์„œ ๋ถˆํ•„์š” โ€” ์ˆœ์ˆ˜ ํŒŒ์ด์ฌ ๊ธฐ๋ฐ˜ ์ฒ˜๋ฆฌ
  • โœ… AI ๋„ค์ดํ‹ฐ๋ธŒ โ€” Claude Desktop, VS Code, Gemini CLI ๋“ฑ MCP ํด๋ผ์ด์–ธํŠธ์™€ ์ง์ ‘ ์—ฐ๊ฒฐ
  • โœ… Stateless ๊ธฐ๋ณธ ์„ค๊ณ„ โ€” ๋„๊ตฌ ํ˜ธ์ถœ๋งˆ๋‹ค filename์„ ๋ช…์‹œํ•ด ์ผ๊ด€์ ์œผ๋กœ ์‹คํ–‰

Use Cases


Quick Start

1. ์„ค์น˜ & ์‹คํ–‰

uv ๊ธฐ์ค€:

uvx hwpx-mcp-server

๋˜๋Š” pip ์„ค์น˜:

pip install hwpx-mcp-server
hwpx-mcp-server

์š”๊ตฌ์‚ฌํ•ญ:

  • Python >= 3.10
  • python-hwpx >= 2.6

ํ˜„์žฌ ๊ฒ€์ฆ ๊ธฐ์ค€ upstream ๋ฒ„์ „: python-hwpx 2.7.1

2. MCP ํด๋ผ์ด์–ธํŠธ ์„ค์ •

Claude Desktop

claude_desktop_config.json:

{
  "mcpServers": {
    "hwpx": {
      "command": "uvx",
      "args": ["hwpx-mcp-server"]
    }
  }
}
Gemini CLI

~/.gemini/settings.json:

{
  "mcpServers": {
    "hwpx": {
      "command": "uvx",
      "args": ["hwpx-mcp-server"]
    }
  }
}
VS Code (Copilot Chat)

.vscode/mcp.json:

{
  "servers": {
    "hwpx": {
      "command": "uvx",
      "args": ["hwpx-mcp-server"]
    }
  }
}
Cursor / Windsurf

๊ฐ ์—๋””ํ„ฐ MCP ์„ค์ • ํŒŒ์ผ์— ๋™์ผํ•œ ๋ธ”๋ก์„ ์ถ”๊ฐ€:

{
  "mcpServers": {
    "hwpx": {
      "command": "uvx",
      "args": ["hwpx-mcp-server"]
    }
  }
}

Features

๊ธฐ๋ณธ ๋ชจ๋“œ์—์„œ 30๊ฐœ ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ, ๊ณ ๊ธ‰ ๋ชจ๋“œ(HWPX_MCP_ADVANCED=1)์—์„œ๋Š” ์ด 40๊ฐœ ๋„๊ตฌ๊นŒ์ง€ ํ™•์žฅ๋ฉ๋‹ˆ๋‹ค.

๐Ÿ“– ์ฝ๊ธฐ & ํƒ์ƒ‰

๋„๊ตฌ ์„ค๋ช…
get_document_info ๋ฌธ์„œ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ/์„น์…˜/๋ฌธ๋‹จ/ํ‘œ ๊ฐœ์ˆ˜ ์กฐํšŒ
get_document_text ๋ฌธ์„œ ์ „์ฒด ํ…์ŠคํŠธ ์ถ”์ถœ (max_chars ์ง€์›)
get_document_outline ์ œ๋ชฉ/๊ฐœ์š” ๊ตฌ์กฐ ์ถ”์ถœ
get_paragraph_text ํŠน์ • ๋ฌธ๋‹จ ํ…์ŠคํŠธ ์กฐํšŒ
get_paragraphs_text ๋ฌธ๋‹จ ๋ฒ”์œ„ ์กฐํšŒ
list_available_documents ํด๋” ๋‚ด .hwpx ํŒŒ์ผ ๋ชฉ๋ก ์กฐํšŒ

๐Ÿ”Ž ๊ฒ€์ƒ‰ & ์น˜ํ™˜

๋„๊ตฌ ์„ค๋ช…
find_text ํ‚ค์›Œ๋“œ ๊ฒ€์ƒ‰ + ์ปจํ…์ŠคํŠธ ๋ฐ˜ํ™˜
search_and_replace ๋‹จ์ผ ์น˜ํ™˜ (split-run ๋ณด๊ฐ•)
batch_replace ๋‹ค์ค‘ ์น˜ํ™˜ ์ผ๊ด„ ์‹คํ–‰

โœ๏ธ ํŽธ์ง‘

๋„๊ตฌ ์„ค๋ช…
add_heading ์ œ๋ชฉ(ํ—ค๋”ฉ) ๋ฌธ๋‹จ ์ถ”๊ฐ€
add_paragraph / insert_paragraph / delete_paragraph ๋ฌธ๋‹จ ์ถ”๊ฐ€/์‚ฝ์ž…/์‚ญ์ œ
add_page_break ํŽ˜์ด์ง€ ๋‚˜๋ˆ„๊ธฐ ์ถ”๊ฐ€
add_memo / remove_memo ๋ฉ”๋ชจ ์ถ”๊ฐ€/์ œ๊ฑฐ
copy_document ๋ฌธ์„œ ์•ˆ์ „ ๋ณต์‚ฌ

๐Ÿ“Š ํ‘œ

๋„๊ตฌ ์„ค๋ช…
add_table / get_table_text ํ‘œ ์ƒ์„ฑ/์กฐํšŒ
set_table_cell_text ์…€ ํ…์ŠคํŠธ ์ˆ˜์ •
merge_table_cells / split_table_cell ์…€ ๋ณ‘ํ•ฉ/๋ถ„ํ• 
format_table ํ‘œ ํ—ค๋” ๋“ฑ ๊ธฐ๋ณธ ์„œ์‹ ์ ์šฉ

๐ŸŽจ ์Šคํƒ€์ผ

๋„๊ตฌ ์„ค๋ช…
format_text ํ…์ŠคํŠธ ๋ฒ”์œ„ ์„œ์‹ ์ ์šฉ(๊ตต๊ธฐ, ๊ธฐ์šธ์ž„, ๋ฐ‘์ค„, ์ƒ‰์ƒ ๋“ฑ)
create_custom_style ์ปค์Šคํ…€ ์Šคํƒ€์ผ ์ƒ์„ฑ
list_styles ๋ฌธ์„œ ์Šคํƒ€์ผ ๋ชฉ๋ก ์กฐํšŒ

๐Ÿ“ค ์ฝ๊ธฐ/์ถ”์ถœ

๋„๊ตฌ ์„ค๋ช…
hwpx_to_markdown HWPX payload๋ฅผ Markdown์œผ๋กœ ๋ณ€ํ™˜
hwpx_to_html HWPX payload๋ฅผ HTML๋กœ ๋ณ€ํ™˜
hwpx_extract_json HWPX payload๋ฅผ ๊ตฌ์กฐํ™” JSON์œผ๋กœ ์ถ”์ถœ

์Šคํƒ€์ผ ์ฐธ์กฐ ํŒ: add_paragraph(..., style=...)์™€ insert_paragraph(..., style=...)๋Š” list_styles์˜ id, create_custom_style์ด ๋ฐ˜ํ™˜ํ•˜๋Š” style_id, ์Šคํƒ€์ผ ์ด๋ฆ„์„ ๋ชจ๋‘ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”ฌ ๊ณ ๊ธ‰ (์˜ต์…˜)

HWPX_MCP_ADVANCED=1์ผ ๋•Œ ํ™œ์„ฑํ™”:

๋„๊ตฌ ์„ค๋ช…
package_parts OPC ํŒŒํŠธ ๋ชฉ๋ก ์กฐํšŒ
package_get_xml / package_get_text ํŒŒํŠธ XML/ํ…์ŠคํŠธ ์กฐํšŒ
object_find_by_tag / object_find_by_attr XML ์š”์†Œ ๊ฒ€์ƒ‰
plan_edit / preview_edit / apply_edit ํŽธ์ง‘ ๊ณ„ํš/๋ฏธ๋ฆฌ๋ณด๊ธฐ/์ ์šฉ
validate_structure / lint_text_conventions ๊ตฌ์กฐ ๊ฒ€์ฆ/ํ…์ŠคํŠธ ๋ฆฐํŠธ

Configuration

๋ณ€์ˆ˜ ์„ค๋ช… ๊ธฐ๋ณธ๊ฐ’
HWPX_MCP_MAX_CHARS ํ…์ŠคํŠธ ๋ฐ˜ํ™˜ ๋„๊ตฌ ๊ธฐ๋ณธ ์ตœ๋Œ€ ๊ธธ์ด 10000
HWPX_MCP_AUTOBACKUP 1์ด๋ฉด ์ €์žฅ ์ „ .bak ๋ฐฑ์—… ์ƒ์„ฑ 1
HWPX_MCP_ADVANCED 1์ด๋ฉด ๊ณ ๊ธ‰ ๋„๊ตฌ ํ™œ์„ฑํ™” 0
LOG_LEVEL ๋กœ๊ทธ ๋ ˆ๋ฒจ INFO

ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ํฌํ•จ MCP ์„ค์ • ์˜ˆ์‹œ:

{
  "mcpServers": {
    "hwpx": {
      "command": "uvx",
      "args": ["hwpx-mcp-server"],
      "env": {
        "HWPX_MCP_MAX_CHARS": "12000",
        "HWPX_MCP_AUTOBACKUP": "1",
        "HWPX_MCP_ADVANCED": "0",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Advanced

๐Ÿ“ฆ OPC ํŒŒํŠธ ์กฐํšŒ

๊ณ ๊ธ‰ ๋ชจ๋“œ์—์„œ ๋ฌธ์„œ ๋‚ด๋ถ€ ํŒŒํŠธ๋ฅผ ์ง์ ‘ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • package_parts
  • package_get_xml
  • package_get_text
๐Ÿงญ ํŽธ์ง‘ ํŒŒ์ดํ”„๋ผ์ธ

๊ณ ๊ธ‰ ๋ชจ๋“œ์—์„œ plan_edit โ†’ preview_edit โ†’ apply_edit ํ๋ฆ„์œผ๋กœ ๋ณ€๊ฒฝ ๊ณ„ํš์„ ๊ฒ€ํ† ํ•˜๊ณ  ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿงช ๊ตฌ์กฐ/๊ทœ์น™ ๊ฒ€์‚ฌ

๊ณ ๊ธ‰ ๋ชจ๋“œ์—์„œ ๋‹ค์Œ ๊ฒ€์‚ฌ ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • validate_structure
  • lint_text_conventions

Testing

# ํ…Œ์ŠคํŠธ ์˜์กด์„ฑ ์„ค์น˜
python -m pip install -e ".[test]"

# ์ „์ฒด ํ…Œ์ŠคํŠธ
python -m pytest -q

ํšŒ๊ท€ ํ…Œ์ŠคํŠธ๋Š” ์‹ค์ œ HWPX ์ถœ๋ ฅ ๋ณ€๊ฒฝ์„ ๊ฒ€์ฆํ•˜๋„๋ก ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค. ์ตœ์‹  ๊ฒฐ๊ณผ๋Š” python -m pytest -q๋กœ ํ™•์ธํ•˜์„ธ์š”.

  • ์‹ค์ „ ์‚ฌ์šฉ ์‚ฌ๋ก€: docs/use-cases.md
  • ์ข…ํ•ฉ ๋ฆฌํฌํŠธ: tests/hwpx_mcp_report_updated.md
  • ํšŒ๊ท€ ํ…Œ์ŠคํŠธ: tests/test_hwpx_report_regressions.py

Architecture

hwpx-mcp-server
โ”œโ”€โ”€ src/hwpx_mcp_server/
โ”‚   โ”œโ”€โ”€ server.py            # Stateless MCP ์ง„์ž…์ 
โ”‚   โ”œโ”€โ”€ hwpx_ops.py          # ๊ณ ๊ธ‰/๋‚ด๋ถ€ ์—ฐ์‚ฐ ๋ž˜ํผ
โ”‚   โ”œโ”€โ”€ storage.py           # ์ €์žฅ ๋ฐฑ์—”๋“œ (atomic save)
โ”‚   โ”œโ”€โ”€ core/                # ๋ฌธ๋‹จ/ํ‘œ/๊ฒ€์ƒ‰/์„œ์‹ ํ•ต์‹ฌ ๋กœ์ง
โ”‚   โ”œโ”€โ”€ tools.py             # ํ™•์žฅ ๋„๊ตฌ ์Šคํ‚ค๋งˆ/์ •์˜
โ”‚   โ””โ”€โ”€ schema/              # JSON ์Šคํ‚ค๋งˆ ๋นŒ๋”/์ •๋ฆฌ๊ธฐ
โ”œโ”€โ”€ tests/                   # ๋‹จ์œ„ + E2E + ํšŒ๊ท€ ํ…Œ์ŠคํŠธ
โ””โ”€โ”€ pyproject.toml

Comparison

hwpx-mcp-server hwp(๋ฐ”์ด๋„ˆ๋ฆฌ) COM ์ž๋™ํ™” ๊ณ„์—ด
๋Œ€์ƒ ํฌ๋งท .hwpx (Open XML) .hwp (๋ฐ”์ด๋„ˆ๋ฆฌ) ์ค‘์‹ฌ
OS Windows ยท macOS ยท Linux ๋Œ€์ฒด๋กœ Windows ์ค‘์‹ฌ
ํ•œ๊ธ€ ํ”„๋กœ๊ทธ๋žจ ์˜์กด ๋ถˆํ•„์š” ํ•„์š”ํ•œ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Œ
์—ฐ๋™ ๋ฐฉ์‹ MCP + ํŒŒ์ด์ฌ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ฐ์Šคํฌํ†ฑ ์•ฑ ์ž๋™ํ™”

Upstream Compatibility Notes

  • ๋ฌธ์„œํ™”๋œ MCP ๊ธฐ๋Šฅ ๊ธฐ์ค€ ์ตœ์†Œ upstream ๋ฒ„์ „์€ python-hwpx >= 2.6์ž…๋‹ˆ๋‹ค.
  • ํ˜„์žฌ ์ €์žฅ์†Œ๋Š” ๋กœ์ปฌ editable checkout ๊ธฐ์ค€ python-hwpx 2.7.1๊ณผ ํ˜ธํ™˜์„ฑ์„ ๊ฒ€์ฆํ–ˆ์Šต๋‹ˆ๋‹ค.
  • format_text๋Š” ์‹ค์ œ run-level charPrIDRef๋ฅผ ๋ถ„๋ฆฌ/๊ฐฑ์‹ ํ•˜๋ฉฐ ์ €์žฅ ํ›„ ๋‹ค์‹œ ์—ด์–ด๋„ ์„œ์‹ ๋ณ€๊ฒฝ์ด ์œ ์ง€๋ฉ๋‹ˆ๋‹ค.
  • create_custom_style๋Š” ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ style_id๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ, ์„œ์‹ ์˜ค๋ฒ„๋ผ์ด๋“œ๊ฐ€ ์žˆ์œผ๋ฉด ๋ณ„๋„์˜ upstream charPr๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
  • ๋กœ์ปฌ ํŒŒ์ผ ์“ฐ๊ธฐ๋Š” storage.py์˜ atomic save ๊ฒฝ๋กœ๋ฅผ ๊ณตํ†ต ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

Contributing

๊ธฐ์—ฌ๋ฅผ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.

  1. Fork ํ›„ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ
  2. ๋ณ€๊ฒฝ + ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€/์ˆ˜์ •
  3. pytest -q ํ†ต๊ณผ ํ™•์ธ ํ›„ PR

License

MIT ยฉ ๊ณ ๊ทœํ˜„ (Kyuhyun Koh)


Author

๊ณ ๊ทœํ˜„ โ€” ๊ด‘๊ต๊ณ ๋“ฑํ•™๊ต ์ •๋ณดยท์ปดํ“จํ„ฐ ๊ต์‚ฌ


Transport Modes (Stdio + HTTP)

Existing stdio usage is unchanged:

hwpx-mcp-server

Run the same MCP tool set over Streamable HTTP:

hwpx-mcp-server --transport streamable-http --host 127.0.0.1 --port 8000

Environment variables are also supported:

  • HWPX_MCP_TRANSPORT (stdio or streamable-http)
  • HWPX_MCP_HOST (default: 127.0.0.1)
  • HWPX_MCP_PORT (default: 8000)

Note: HTTP auth is intentionally kept simple for now (dev mode). A production auth hook is left as a TODO in the server entrypoint.

New Read/Extract Tools

All three tools accept exactly one input source:

  • hwpx_base64: base64 encoded .hwpx bytes
  • url: downloadable https://... URL

Common options:

  • output: full or chunks
  • chunk_strategy: section or paragraph
  • max_chars_per_chunk: integer, default via server setting

1) hwpx_to_markdown

Response:

{
  "markdown": "# Title\n\nParagraph...",
  "chunks": ["..."],
  "meta": {
    "source_type": "base64",
    "section_count": 2,
    "paragraph_count": 10,
    "table_count": 1,
    "figure_caption_count": 1
  }
}

2) hwpx_to_html

Response:

{
  "html": "<!doctype html><html>...</html>",
  "chunks": ["<section>...</section>"],
  "meta": {
    "source_type": "url",
    "image_policy": "omitted"
  }
}

3) hwpx_extract_json

Response:

{
  "doc": {
    "title": "Title",
    "toc": [{ "level": 1, "text": "Title", "paragraph_index": 0 }],
    "sections": [{ "index": 0, "title": "Title", "paragraphs": [] }],
    "tables": [],
    "figures": []
  },
  "chunks": [{ "chunk_index": 0, "strategy": "section", "section": {} }],
  "meta": {
    "source_type": "base64"
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hwpx_mcp_server-2.2.1.tar.gz (105.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hwpx_mcp_server-2.2.1-py3-none-any.whl (90.6 kB view details)

Uploaded Python 3

File details

Details for the file hwpx_mcp_server-2.2.1.tar.gz.

File metadata

  • Download URL: hwpx_mcp_server-2.2.1.tar.gz
  • Upload date:
  • Size: 105.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hwpx_mcp_server-2.2.1.tar.gz
Algorithm Hash digest
SHA256 81b026ad1c755f90ff94bba641d4b694bef9c5b0d8bc91a71e9d6753e10b6660
MD5 1ccf94d9f3308e6729ed817ff93ef8f8
BLAKE2b-256 74c57ae2392437f5b028507c2ea8b58eb341d48adc79a39e9a3718a0b8a4c8fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpx_mcp_server-2.2.1.tar.gz:

Publisher: release.yml on airmang/hwpx-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpx_mcp_server-2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hwpx_mcp_server-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab2d2377074174eacb51e541938ab188e6e13b6b803d482c4164ad645cf42f0d
MD5 ec2d6e619812e0ff4dfa0e2e635d980c
BLAKE2b-256 25e56007b7097ff4f13821beb52ac2bee1e267d1181c7483cf4d90f76a3cf2d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpx_mcp_server-2.2.1-py3-none-any.whl:

Publisher: release.yml on airmang/hwpx-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page