Skip to main content
Glama
Mavline

DOCX MCP Server

by Mavline

DOCX MCP Server

전체 OOXML을 지원하는 Model Context Protocol (MCP)을 구현한 범용 DOCX 처리 서버입니다.

기능

  • 전체 OOXML 지원: 모든 DOCX 문서 파트(document.xml, styles, numbering, headers/footers 등) 읽기/쓰기

  • 텍스트 작업: 리터럴 또는 정규식 모드로 텍스트 추출, 검색, 바꾸기

  • 표 편집: 행/열 삽입 및 삭제, 셀 병합, 셀 내용 설정

  • 구조화된 데이터 태그(SDT): 태그 또는 별칭으로 콘텐츠 컨트롤 가져오기/설정

  • 이미지: 이미지 나열, 위치/크기 제어가 포함된 인라인 또는 앵커 이미지 삽입

  • 주석 및 변경 사항: 주석 나열, 주석 추가/삭제, 모든 변경 내용 추적 수락

  • 문서 속성: 메타데이터 읽기/쓰기(제목, 작성자, 주제 등)

  • LRU 캐싱: 문서 파트의 메모리 효율적 캐싱

  • Stdio 전송: stdin/stdout을 통한 MCP 통신

설치

npm install
npm run build

실행

개발

npm run dev

프로덕션

npm start

Claude Code 사용 시

claude mcp add --scope user --transport stdio docx -- node /path/to/dist/index.js

도구

문서 관리

docx.open

파일 또는 base64에서 DOCX 문서 열기

{
  "docId": "uuid",
  "parts": ["word/document.xml", "word/styles.xml", ...],
  "partCount": 42,
  "props": { "core": {...}, "app": {...} }
}

docx.close

문서 닫기 및 언로드

docx.save

문서를 파일로 저장하거나 base64로 반환

파트 관리

docx.list_parts

문서의 모든 파트 나열

docx.part_read

특정 파트의 원시 XML 읽기

docx.part_write

파트의 XML 콘텐츠 쓰기/업데이트

텍스트 작업

docx.get_text

문서에서 모든 텍스트 추출

{
  "docId": "uuid",
  "scope": "document" | "headers" | "footers" | "all"
}

docx.find

컨텍스트와 함께 텍스트 검색

{
  "docId": "uuid",
  "query": "search term",
  "mode": "literal" | "regex"
}

docx.replace_text

문서에서 텍스트 바꾸기

{
  "docId": "uuid",
  "match": "old text",
  "replace": "new text",
  "mode": "literal" | "regex"
}

docx.tables_list

크기와 함께 모든 표 나열

{
  "tables": [
    {
      "xpath": "/w:document/w:body/w:tbl[1]",
      "rows": 3,
      "colsApprox": 4
    }
  ]
}

docx.table_edit

표 구조 및 콘텐츠 수정

{
  "docId": "uuid",
  "tableXPath": "/w:document/w:body/w:tbl[1]",
  "op": {
    "kind": "setCellText",
    "row": 0,
    "col": 1,
    "text": "new value"
  }
}

작업:

  • setCellText(row, col, text) - 셀 내용 설정

  • insertRow(at) - 위치에 행 삽입

  • deleteRow(at) - 행 삭제

  • insertCol(at) - 열 삽입

  • deleteCol(at) - 열 삭제

구조화된 데이터(SDT)

docx.sdt_get

태그 또는 별칭으로 콘텐츠 컨트롤 콘텐츠 가져오기

docx.sdt_put

콘텐츠 컨트롤 업데이트

이미지

docx.images_list

메타데이터와 함께 모든 이미지 나열

docx.image_add

인라인 또는 앵커 이미지 삽입

스타일 및 번호 매기기

docx.styles_get / docx.styles_set

styles.xml 읽기/쓰기

docx.numbering_get / docx.numbering_set

numbering.xml 읽기/쓰기

머리글/바닥글

docx.headers_footers_list

모든 머리글/바닥글 파트 나열

주석

docx.comments_list

모든 주석 나열

docx.comments_add

새 주석 추가

docx.changes_accept_all

문서의 모든 변경 내용 추적 수락

메타데이터

docx.metadata_get

문서 속성 가져오기(제목, 작성자, 생성일, 수정일 등)

테스트 시나리오

1. 기본 읽기/쓰기

# Open document
docx.open: { "path": "/path/to/document.docx" }

# Get text
docx.get_text: { "docId": "returned-id" }

# Replace text
docx.replace_text: {
  "docId": "returned-id",
  "match": "old text",
  "replace": "new text"
}

# Save
docx.save: { "docId": "returned-id", "returnBase64": true }

2. 표 조작

# List tables
docx.tables_list: { "docId": "id" }

# Edit cell
docx.table_edit: {
  "docId": "id",
  "tableXPath": "/w:document/w:body/w:tbl[1]",
  "op": { "kind": "setCellText", "row": 0, "col": 0, "text": "Hello" }
}

3. 이미지

# List images
docx.images_list: { "docId": "id" }

4. 변경 내용 추적

# Accept all changes
docx.changes_accept_all: { "docId": "id" }

아키텍처

src/
  index.ts                    # Entry point
  errors.ts                   # Error definitions
  logger.ts                   # Logging utilities
  ooxml/
    namespaces.ts            # XML namespace definitions
    emu.ts                    # EMU conversion utilities
    dom.ts                    # XML DOM utilities (xmldom + fontoxpath)
    xmlParser.ts              # fast-xml-parser wrapper
    parts.ts                  # DOCX ZIP part management
    rels.ts                   # Relationships management
    text.ts                   # Text extraction & replacement
    tables.ts                 # Table operations
    sdt.ts                    # Structured Data Tags
    drawings.ts               # Images & DrawingML
    headersFooters.ts         # Headers/Footers
    styles.ts                 # Style operations
    numbering.ts              # Numbering operations
    changes.ts                # Track changes
    comments.ts               # Comments
  store/
    types.ts                  # Type definitions
    docStore.ts               # Document store + LRU cache
  mcp/
    schemas.ts                # Tool input schemas
    tools.ts                  # Tool implementations
    server.ts                 # MCP server setup

종속성

  • @modelcontextprotocol/sdk - MCP 구현

  • jszip - ZIP 아카이브 처리

  • fast-xml-parser - 무손실 XML 파싱

  • @xmldom/xmldom - DOM 구현

  • fontoxpath - XPath 쿼리

  • diff-match-patch - 텍스트 diff

  • lru-cache - 메모리 효율적 캐싱

  • uuid - 문서 ID 생성

성능 참고 사항

  • 최대 10MB 문서 지원

  • 100개 파트 제한 및 1GB 메모리 상한의 LRU 캐시

  • 파트는 메모리에 전체 로드하지 않고 필요 시 로드

  • 더티 파트 최적화: 수정된 파트만 ZIP에 저장

  • XML 구조의 깊은 복사 없음

제한 사항

  • 머리글/바닥글: 기본 지원(복잡한 섹션 구조는 수동 조정 필요할 수 있음)

  • 주석: 기본 나열/추가/삭제(답글 체인은 완전히 지원되지 않음)

  • 변경 내용 추적: 모두 수락 가능, 상세 변경 검사는 제한적

  • 스타일: 전체 XML 가져오기/설정, 선택적 스타일 병합 없음

  • EMU/크기: 계산되지만 렌더링된 기하 구조는 Word의 레이아웃 엔진에 따라 달라짐

라이선스

MIT

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

  • MCP-native collaborative markdown editor with real-time AI document editing

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mavline/docx-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server