by airmang
Enables AI agents to read, search, edit, fill forms, and generate HWPX documents directly via a Model Context Protocol server, running on pure Python across Windows, macOS, and Linux without requiring Hancom Word Processor.
Hwpx Mcp Server provides a standard MCP endpoint that exposes a rich set of tools for manipulating HWPX (Hancom Word Processor) documents. It sits on top of the python‑hwpx core library and lets AI‑driven clients perform reading, searching, editing, form‑filling, validation, and document generation in a stateless, file‑based workflow.
pip install hwpx-mcp-server (or use the uvx installer: uvx hwpx-mcp-server).hwpx-mcp-server command.{
"mcpServers": {
"hwpx": {
"command": "uvx",
"args": ["hwpx-mcp-server"],
"env": {
"HWPX_MCP_MAX_CHARS": "12000",
"HWPX_MCP_ADVANCED": "0",
"LOG_LEVEL": "INFO"
}
}
}
}
get_document_text, search_and_replace, add_table, apply_edits, etc., passing the target file name in each request.filename parameter, making it safe for concurrent use.get_document_info, get_document_outline, get_table_map).find_text, search_and_replace).add_heading, add_paragraph, apply_edits with atomic rollback).render_preview, hwpx_to_markdown).HWPX_MCP_ADVANCED=1 is set.hwpx-plugins bundle can launch the server in development mode.inspect_official_document_style, inspect_reference_consistency) on government or corporate paperwork.[ingest] extra.apply_edits.hwpx-mcp-server in CI pipelines to validate generated HWPX assets before publishing.Q: Do I need Hancom Word Processor installed?
A: No. All operations are performed by the pure‑Python python‑hwpx engine.
Q: Which operating systems are supported? A: Windows, macOS, and Linux.
Q: How are changes persisted?
A: Mutating tools write directly to the supplied file. Use copy_document first to work on a safe copy, and rely on the built‑in backup (.bak) for undo.
Q: Can I limit the server to a specific directory?
A: Yes. Set HWPX_MCP_SANDBOX_ROOT to restrict file access to that path.
Q: What if I need advanced validation?
A: Enable the advanced mode by setting HWPX_MCP_ADVANCED=1; additional inspection and edit‑planning tools become available.
Q: How do I control the amount of text returned?
A: Adjust HWPX_MCP_MAX_CHARS; the default is 10 000 characters per call.
Q: Is there a health check endpoint?
A: Yes. Call mcp_server_health to get version, capability handshake, and self‑diagnostics.
| 계층 | 레포 | 역할 |
|---|---|---|
| 📦 라이브러리 | python-hwpx |
순수 파이썬 HWPX 파싱·편집·생성 코어 |
| 🔌 MCP 서버 | hwpx-mcp-server |
MCP 클라이언트(Claude Desktop, VS Code 등)에서 HWPX 조작 |
| 🎯 에이전트 스킬 | hwpx-plugins |
에이전트가 HWPX를 바로 쓰게 해주는 공식 스킬/플러그인 번들 |
hwpx-mcp-server는 모델 컨텍스트 프로토콜(MCP) 표준 서버로, python-hwpx 위에서 HWPX 문서의 열람·검색·편집·양식채움·생성·추출을 AI 클라이언트에서 직접 수행하게 합니다.
filename을 명시하는 일관된 방식참고 이 서버는 Open XML 기반
.hwpx포맷을 지원합니다. 바이너리.hwp는 직접 편집 대상이 아닙니다.
uv 기준:
uvx hwpx-mcp-server
또는 pip 설치 후 실행:
pip install hwpx-mcp-server
hwpx-mcp-server
비-HWPX 문서(PDF/DOCX/XLSX/HTML/TXT)를 document_to_markdown 경로로 읽으려면 MarkItDown adapter extra를 함께 설치합니다.
pip install "hwpx-mcp-server[ingest]"
요구 사항: Python >= 3.10 · python-hwpx >= 2.23.0
설정 파일에 아래 블록 하나만 넣으면 hwpx 서버를 바로 잡습니다.
claude_desktop_config.json~/.gemini/settings.json.vscode/mcp.json (키가 mcpServers 대신 servers){
"mcpServers": {
"hwpx": {
"command": "uvx",
"args": ["hwpx-mcp-server"]
}
}
}
환경 변수를 넘길 때는 env 블록을 추가합니다.
{
"mcpServers": {
"hwpx": {
"command": "uvx",
"args": ["hwpx-mcp-server"],
"env": {
"HWPX_MCP_MAX_CHARS": "12000",
"HWPX_MCP_ADVANCED": "0",
"LOG_LEVEL": "INFO"
}
}
}
}
hwpx-plugins번들의 런처(plugins/<host>/hwpx-plugin/scripts/hwpx-mcp-server)로도 실행할 수 있습니다. 로컬 개발 시 레포가 공통 부모 아래에 없으면HWPX_MCP_SERVER_REPO,PYTHON_HWPX_REPO를 절대경로로 지정하세요.
처음부터 모든 도구를 외울 필요는 없습니다. 보통 아래 하나로 시작합니다.
get_document_info → get_document_outline / get_document_text → find_text, get_table_map 등으로 필요한 부분만. (저장하지 않음)copy_document로 사본 생성 → 읽기 도구로 대상 확인 → search_and_replace, set_table_cell_text, apply_edits 등 가장 작은 변경 → 다시 읽어 확인 → 검토가 끝난 복사본을 handoff.핵심은 copy first · smallest edit · re-read after edits입니다.
기본 모드에서 다수의 HWPX 도구를 제공하며, 고급 모드(HWPX_MCP_ADVANCED=1)에서 점검·검증용 도구가 추가됩니다. 아래는 테마별 대표 하이라이트입니다. 전체 도구 목록·시그니처는 docs/use-cases.md와 docs/skill-first-workflows.md를 참고하세요.
get_document_info, get_document_text, get_document_outline, find_text, get_table_text, get_table_map, find_cell_by_label, list_styles. get_document_map은 아웃라인·표 지도·누름틀·앵커를 한 호출로 반환(왕복 최소화). (저장하지 않음)document_to_markdown, document_extract_json, markdown_to_document_plan이 로컬 문서를 Markdown/JSON/document plan으로 변환합니다. HWPX는 python-hwpx 엔진을 우선 사용하고, 비-HWPX는 [ingest] extra 설치 시 MarkItDown adapter로 처리합니다.search_and_replace, batch_replace, replace_in_paragraph, replace_by_anchor. (find_text 외 즉시 저장)add_heading, add_paragraph/insert_paragraph/delete_paragraph, add_page_break, add_memo 계열. apply_edits는 연산 목록 원자 적용(중간 실패 시 전체 롤백·dry_run·expected_revision 동시성 가드·idempotency_key), undo_last_edit는 .bak 복원, byte_preserving_patch는 미수정 영역 바이트 보존, add_tracked_edit는 변경 추적(redline).add_table, set_table_cell_text, merge_table_cells/split_table_cell, format_table, table_compute(합계·평균·소계), fill_by_path(성명 > right 경로 구문). 바이트 보존 구조적 양식채움: 셀 바이트 채움(빈/다중 문단)·행/열/표 삭제·복제 삽입·열 너비 자동맞춤·폰트 축소맞춤을 양식 서식을 재구성하지 않고 그대로 보존하며 수행하고 실제 한컴으로 검증(verify_fill). analyze_template_formfit/apply_template_formfit은 승인된 양식을 원본과 다른 destination에만 반영.list_form_fields, fill_form_field(서식 보존), analyze_form_fill(라벨 매칭 신뢰도 등급).hwpx.document_plan.v1로 OWPML을 직접 만지지 않고 선언: validate_document_plan/analyze_document_plan(파일 미생성) → create_document_from_plan(생성+검증), inspect_document_authoring_quality, inspect_operating_plan_quality, create_proposal_document. compose_exam은 양식 HWPX+마크다운 → 시험지 재조판(verify_question_splits).inspect_official_document_style(행정업무 규정 lint: 항목기호 위계·"끝."·붙임·날짜), inspect_reference_consistency, doc_diff/create_comparison_table_document(신구대조표), mail_merge(템플릿+CSV/JSON → N부·파일명 패턴·zip), inspect_mail_merge_placeholders.set_paragraph_format, set_page_setup, set_header_footer, set_page_number, set_list_format, format_text, create_custom_style(입력은 pt/mm/% 인간 단위); insert_picture(manifest 자동 등록)/replace_picture; build_image_grid(사진대지)·build_meeting_nameplates·build_organization_chart.render_preview(HTML/PNG 시각 자기검증), hwpx_to_markdown/hwpx_to_html/hwpx_extract_json(payload·URL 입력, 파일 미수정), repair_hwpx(원본 보존·mimetype-first 재패킹, recover=true로 손상 ZIP LFH scan 복구; 응답 crcOk/validatePackage.ok/recovered 확인), mcp_server_health(배포 스큐 자기진단·capability handshake).HWPX_MCP_ADVANCED=1) — package_parts, package_get_xml/package_get_text, object_find_by_tag/object_find_by_attr, plan_edit/preview_edit/apply_edit, validate_structure, lint_text_conventions.위치 계약 —
paragraph_index는 본문 직속 문단의 0-based 인덱스입니다. 표 안 문단은 이 인덱스에 섞지 않고{"kind":"table_cell_paragraph","table_index":0,"row":0,"col":1,"cell_paragraph_index":0}같은location객체로 지정하며,get_table_map/find_text가 반환한 값을 그대로 넘길 수 있습니다.
이 서버의 공개 표면은 위 MCP 도구 집합입니다. 워크플로 문서나 스킬 예시는 이 도구들의 조합 패턴이지 별도 계약이 아닙니다.
copy_document를 먼저 호출한다.HWPX_MCP_ADVANCED=1일 때만 쓰고 기본 흐름과 섞지 않는다.모델은 operation/plan만 보내고 raw XML을 직접 편집하지 않습니다. raw_xml_replace, arbitrary_xpath_mutation 같은 원시 XML 표면은 public 도구로 노출되지 않습니다. 모든 쓰기는 python-hwpx의 단일 SavePipeline 게이트(VisualComplete)를 통과하며 우회 경로가 없습니다(무결성·XML·OPC/ID·열림안전·FormFit·레이아웃·시각 오라클 → 하나의 리포트).
visualComplete 블록이 실립니다: ok, status(verified/unverified/failed), errorCodes, warnings, suggestedRetry.quality 블록으로 게이트를 올립니다(생략 시 transparent = 열림안전만). 예: apply_edits(..., quality="strict") 또는 quality={"mode":"strict","overflowPolicy":"fail","layoutLint":"strict"}.ok=false), 구조화된 오류 코드(FIELD_OVERFLOW, STALE_LINESEG_DETECTED, VISUAL_COMPLETE_FAILED, …)와 suggestedRetry로 재시도합니다.mcp_server_health.capability). 진단/우회는 HWPX_MCP_REQUIRE_CAPABILITY=0.
visual_review_required=true는 구조/파일 기반 검증은 통과했지만 렌더링된 시각 레이아웃은 아직 증명되지 않았다는 뜻입니다. 운영 계획서·template-formfit 결과를 최종 제출 가능(submission-ready)으로 주장하려면 열린 문서를 검토해hwpx.visual-review.v1증거를 남기고current.status="observed_pass"여야 합니다.
| 변수 | 설명 | 기본값 |
|---|---|---|
HWPX_MCP_MAX_CHARS |
텍스트 반환 도구 기본 최대 길이 | 10000 |
HWPX_MCP_AUTOBACKUP |
1이면 저장 전 .bak 백업 생성 |
1 |
HWPX_MCP_ADVANCED |
1이면 고급 도구 활성화 |
0 |
HWPX_MCP_SANDBOX_ROOT |
설정 시 이 root 내부 상대/절대경로만 허용 | unset |
HWPX_MCP_FETCH_TIMEOUT_SECONDS |
URL 기반 HWPX fetch timeout | 20.0 |
HWPX_MCP_QUALITY |
전역 기본 저장 게이트 정책(transparent/strict). 도구별 quality가 우선 |
transparent |
HWPX_MCP_REQUIRE_CAPABILITY |
0이면 capability skew fail-closed를 끔(진단/전문가용) |
1 |
LOG_LEVEL |
로그 레벨 | INFO |
docs/use-cases.mddocs/skill-first-workflows.mddocs/hardening_guide_ko.mdtests/hwpx_mcp_report_updated.mdCHANGELOG.mdpython -m pip install -e ".[test]" # 테스트 의존성 설치
python -m pytest -q # 전체 테스트
코어 라이브러리 python-hwpx 위에서 동작하며, 아래 공개 표준·프로젝트에 빚지고 있습니다.
Apache License 2.0. See LICENSE and NOTICE.
고규현 — 광교고등학교 정보·컴퓨터 교사
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.