home / mcp / hwpx mcp server

HWPX MCP Server

Provides automated access to HWPX documents for viewing, searching, editing, and saving using MCP clients.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "airmang-hwpx-mcp-server": {
      "command": "uvx",
      "args": [
        "hwpx-mcp-server"
      ],
      "env": {
        "LOG_LEVEL": "INFO",
        "HWPX_MCP_HARDENING": "0",
        "HWPX_MCP_AUTOBACKUP": "1",
        "HWPX_MCP_PAGING_PARA_LIMIT": "200"
      }
    }
  }
}

You can run an MCP server for HWPX documents that lets you open, search, edit, and save HWPX files directly without a Hangul word processor. Connect it to MCP clients like Gemini or Claude Desktop to automate document creation, editing, and exploration.

How to use

You will connect an MCP client to the local HWPX MCP server so you can open documents, navigate sections, edit text and objects, manage tables and styles, and save backups automatically. Start the server from your development workspace and use the client’s MCP configuration to point to this server. Use the provided document locators to open local files or reference remote documents when you run operations. When the hardening editing pipeline is enabled, you gain additional safety checks and review steps for edits. Use search and context tools to locate content and extract surrounding text for review while preserving privacy.

How to install

Prerequisites: you should have Python installed and ready, and you will use a local MCP controller to start the server. You also need the uv package manager and its command-line interface to run the MCP server. The server runs in the current working directory by default, so you can start immediately after installation.

Step by step setup you can follow in your environment is as follows.

uvx hwpx-mcp-server

Additional sections

Configuration at a glance shows how to define the MCP server for your client. You can add environment variables to tune paging, enable automatic backups, and control log verbosity. The server interpretation of document paths is based on the current working directory, so no extra directory configuration is required in most cases.

Security and hardening options offer two modes. By enabling the hardening flag, you activate a three-step edit workflow (Plan β†’ Preview β†’ Apply) and expanded tools for search and contextual review. When the flag is off or not set, you keep the original tool surface while still benefiting from the schema sanitization.

If you want to quickly verify all capabilities, you can exercise end-to-end tests that run the server tools, edit text, tables, and memo fields, read OPC package parts, and confirm backup creation.

The server integrates with a Python-based stack and uses the pure Python HwpxDocument API. You can run the test suite to validate core functionality before deploying to production.

Notes on usage patterns

Use the discriminated union document locator when issuing tool inputs. Local files can be targeted by path, while HTTP backends allow URIs when you run the server in HTTP storage mode. Pre-registered handles let you reference documents loaded by the hardening pipeline for subsequent search, context, and editing tasks.

Troubleshooting and tips

If you encounter issues with large document dumps, adjust the paging limit via HWPX_MCP_PAGING_PARA_LIMIT or by specifying limit when you call read_text. For safety during edits, enable HWPX_MCP_AUTOBACKUP to create a .bak backup before saving changes. If you enable hardening, you can expect detailed plan, preview, and apply feedback, including potential ambiguous targets or unsafe operations that you must resolve before applying changes.

Available tools

open_info

Retrieve document metadata and a summary of paragraphs and headers.

list_sections

List document sections to understand structure.

list_headers

List headers within the document.

read_text

Extract text with pagination and support for highlights and footnotes.

read_paragraphs

Fetch specific paragraphs by index for targeted review.

find

Search text with optional context radius for surrounding content.

hwpx.search

Regex or keyword search across the document with stable node identifiers.

hwpx.get_context

Retrieve surrounding context for a given paragraph or node.

replace_text_in_runs

Replace text while preserving styles; use dryRun for preview.

add_paragraph

Append new paragraphs to the document.

insert_paragraphs_bulk

Insert multiple paragraphs in a single operation.

add_table

Create a new table within the document.

get_table_cell_map

Serialize the full table grid with cell ownership and spans.

set_table_cell_text

Set text in a table cell with options for merging and auto-fit.

replace_table_region

Replace a table region with new content.

split_table_cell

Split a merged cell to reveal the original grid.

add_shape

Insert graphical shapes into the document.

add_control

Insert controls or interactive elements.

add_memo

Add a memo annotation to the document.

attach_memo_field

Attach a memo field to a specific location.

add_memo_with_anchor

Add a memo attached to a specific anchor within the text.

remove_memo

Remove a memo annotation from the document.

hwpx.plan_edit

Create a validated edit plan with a planId.

hwpx.preview_edit

Preview an edit plan and review diffs, warnings, and safety scores.

hwpx.apply_edit

Apply an approved edit plan to the document.

ensure_run_style

Ensure required run styles exist in the document.

list_styles_and_bullets

List or create text styles and bullet lists.

apply_style_to_text_ranges

Apply styles to specific text ranges.

apply_style_to_paragraphs

Apply styles to entire paragraphs.

save

Save the current document.

save_as

Save the document under a new name.

make_blank

Create a new blank document.

object_find_by_tag

Find XML elements by tag name.

object_find_by_attr

Find XML elements by attribute value.

validate_structure

Check the document structure for validity.

lint_text_conventions

Lint text for style and conventions.

package_parts

List all OPC parts inside the HWPX package (read-only).

package_get_text

Read a specific OPC part as text with encoding support.

package_get_xml

Return a part's XML as a string.