Skip to content

Add MCP server for pypandoc-hwpx#4

Open
justinyoo wants to merge 13 commits into
msjang:mainfrom
justinyoo:feat/mcp
Open

Add MCP server for pypandoc-hwpx#4
justinyoo wants to merge 13 commits into
msjang:mainfrom
justinyoo:feat/mcp

Conversation

@justinyoo

Copy link
Copy Markdown

요약

이 PR은 pypandoc-hwpx의 문서-HWPX 변환 기능을 MCP 도구로 제공하는 MCP (Model Context Protocol) 서버, Docker 지원 및 개발 컨테이너 설정을 추가합니다.

MCP 서버 (mcp/)

  • 3가지 도구: docx_to_hwpx, html_to_hwpx, md_to_hwpx — 각각 해당 형식을 HWPX로 변환
  • 이중 전송 방식: stdio (기본값) 및 Streamable HTTP (--http --port PORT)
  • 공식 mcp SDK (FastMCP)를 사용하여 구현
  • pyproject.toml, uv.lock 및 VS Code MCP 구성 파일 포함

Dockerfile (저장소 루트)

  • 다단계 구성: Pandoc 설치, 상위 pypandoc-hwpx 패키지 설치, MCP 서버 의존성 설치 순서로 진행
  • Docker 빌드 컨텍스트가 pypandoc_hwpx/mcp/ 디렉토리 모두에 접근할 수 있도록 저장소 루트에 배치
  • 기본 엔트리포인트는 stdio 전송 방식으로 실행; HTTP 모드는 --http 플래그로 전환

개발 컨테이너 (.devcontainer/)

  • Python 3 기반 Dev Container 설정 추가
  • Pandoc 자동 설치 및 uv 패키지 매니저 포함
  • VS Code 확장 프로그램 (Python, Pylance, Docker) 사전 구성

문서

  • mcp/README.md에 설정 방법, 사용 예시, 도구 참조 및 Docker 빌드/실행 명령어 포함

justinyoo and others added 13 commits March 25, 2026 14:19
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/cda75b24-ef05-475e-8579-d7d9ecb874ed
The Dockerfile references files from both the repo root (setup.py,
pypandoc_hwpx/) and the mcp/ subdirectory. When it lived inside mcp/,
running 'docker build .' from that directory failed because the build
context couldn't reach parent directory files. Moving it to the repo
root lets 'docker build .' work naturally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
FastMCP.run() only accepts 'transport' and 'mount_path' parameters.
host and port must be configured on the FastMCP instance (via
mcp.settings) before calling run(). The previous code incorrectly
passed them as kwargs to run(), causing a TypeError when --http was used.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Initial plan

* Add MCP server with docx_to_hwpx, html_to_hwpx, and md_to_hwpx tools

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/70275bcd-6403-424d-9211-088f1956dfbc

* Add Dockerfile for MCP server

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/cda75b24-ef05-475e-8579-d7d9ecb874ed

* Use uv pip install for consistency in Dockerfile

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/cda75b24-ef05-475e-8579-d7d9ecb874ed

* Default Dockerfile to stdio, add --port flag for HTTP transport

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/9c8868b5-cef1-4687-b957-4b92ab81e8b2

* Improve type annotation for kwargs in server.py

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/justinyoo/pypandoc-hwpx/sessions/9c8868b5-cef1-4687-b957-4b92ab81e8b2

* Move Dockerfile from mcp/ to repo root to fix build context

The Dockerfile references files from both the repo root (setup.py,
pypandoc_hwpx/) and the mcp/ subdirectory. When it lived inside mcp/,
running 'docker build .' from that directory failed because the build
context couldn't reach parent directory files. Moving it to the repo
root lets 'docker build .' work naturally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix HTTP transport: pass host/port via mcp.settings, not mcp.run()

FastMCP.run() only accepts 'transport' and 'mount_path' parameters.
host and port must be configured on the FastMCP instance (via
mcp.settings) before calling run(). The previous code incorrectly
passed them as kwargs to run(), causing a TypeError when --http was used.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update MCP server definitions

* Update README for MCP

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Co-authored-by: Justin Yoo <justin.yoojh@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants