Skip to main content

Model Context Protocol server for local HWPX document automation.

Project description

hwpx-mcp-server

Stateless MCP server for reading and editing HWPX documents with python-hwpx.

What Changed in v2

  • Stateless tool design: every tool receives filename (or source_filename) and works in one call.
  • No session/handle IDs in default workflow.
  • Token-safe text responses with max_chars limits.
  • LLM-friendly tool names (get_document_text, find_text, search_and_replace, batch_replace).
  • Advanced XML/pipeline tools are opt-in with HWPX_MCP_ADVANCED=1.

Install

uvx hwpx-mcp-server

Requirements:

  • Python 3.10+
  • python-hwpx >= 1.9

MCP Client Config

Example (claude_desktop_config.json):

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

Core Tool Surface

Document

  • create_document(filename, title?, author?)
  • get_document_info(filename)
  • get_document_text(filename, max_chars?)
  • get_document_outline(filename)
  • list_available_documents(directory?)
  • copy_document(source_filename, destination_filename?)

Content

  • add_heading(filename, text, level?)
  • add_paragraph(filename, text, style?)
  • insert_paragraph(filename, paragraph_index, text, style?)
  • delete_paragraph(filename, paragraph_index)
  • add_table(filename, rows, cols, data?)
  • get_table_text(filename, table_index?)
  • set_table_cell_text(filename, table_index, row, col, text)
  • add_page_break(filename)
  • add_memo(filename, paragraph_index, text)
  • remove_memo(filename, paragraph_index)

Search / Replace

  • find_text(filename, text_to_find, match_case?, max_results?)
  • search_and_replace(filename, find_text, replace_text)
  • batch_replace(filename, replacements)

batch_replace runs in order and saves once after all replacements.

Formatting

  • format_text(filename, paragraph_index, start_pos, end_pos, ...)
  • create_custom_style(filename, style_name, ...)
  • list_styles(filename)
  • format_table(filename, table_index, has_header_row?)
  • merge_table_cells(filename, table_index, start_row, start_col, end_row, end_col)
  • split_table_cell(filename, table_index, row, col)

Advanced Mode (Opt-in)

Set HWPX_MCP_ADVANCED=1 to enable advanced/debug tools:

  • 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

These tools are hidden by default.

Environment Variables

Variable Description Default
HWPX_MCP_MAX_CHARS Default max text size for text-returning tools 10000
HWPX_MCP_AUTOBACKUP Create .bak before save when 1 1
LOG_LEVEL Log level INFO
HWPX_MCP_ADVANCED Enable advanced tools when 1 0

Example: Year Rollover

batch_replace("school_plan.hwpx", [
  {"find": "2026", "replace": "2027"},
  {"find": "2025", "replace": "2026"},
])

Development

Run tests:

pytest -q

Run server (stdio transport):

hwpx-mcp-server

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.0.2.tar.gz (82.3 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.0.2-py3-none-any.whl (74.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hwpx_mcp_server-2.0.2.tar.gz
  • Upload date:
  • Size: 82.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for hwpx_mcp_server-2.0.2.tar.gz
Algorithm Hash digest
SHA256 1c7c1c679bc0887cc8bbac51e4d51987edd0a1a56a379a2ee13422f90ccd15e2
MD5 09b7469472959c2bac224324e33b60ef
BLAKE2b-256 98685c134f682fbd2797025b50552a913436906b62f1e47c8dcf877e930a9b1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hwpx_mcp_server-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c4b8986897abf5c409d655a7c85a0585e75538238f1f5d035912768c64433d23
MD5 d07ed7e351765a946ed6ff001d90f970
BLAKE2b-256 160d5a08ad9f19ffc4b388fc5733336917a1d9578ad33667952cd589e4b98fdf

See more details on using hashes here.

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