DOCX MCP Server
DOCX MCP Server
전체 OOXML을 지원하는 Model Context Protocol (MCP)을 구현한 범용 DOCX 처리 서버입니다.
기능
전체 OOXML 지원: 모든 DOCX 문서 파트(document.xml, styles, numbering, headers/footers 등) 읽기/쓰기
텍스트 작업: 리터럴 또는 정규식 모드로 텍스트 추출, 검색, 바꾸기
표 편집: 행/열 삽입 및 삭제, 셀 병합, 셀 내용 설정
구조화된 데이터 태그(SDT): 태그 또는 별칭으로 콘텐츠 컨트롤 가져오기/설정
이미지: 이미지 나열, 위치/크기 제어가 포함된 인라인 또는 앵커 이미지 삽입
주석 및 변경 사항: 주석 나열, 주석 추가/삭제, 모든 변경 내용 추적 수락
문서 속성: 메타데이터 읽기/쓰기(제목, 작성자, 주제 등)
LRU 캐싱: 문서 파트의 메모리 효율적 캐싱
Stdio 전송: stdin/stdout을 통한 MCP 통신
Related MCP server: InkPaw
설치
npm install
npm run build실행
개발
npm run dev프로덕션
npm startClaude 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- 텍스트 difflru-cache- 메모리 효율적 캐싱uuid- 문서 ID 생성
성능 참고 사항
최대 10MB 문서 지원
100개 파트 제한 및 1GB 메모리 상한의 LRU 캐시
파트는 메모리에 전체 로드하지 않고 필요 시 로드
더티 파트 최적화: 수정된 파트만 ZIP에 저장
XML 구조의 깊은 복사 없음
제한 사항
머리글/바닥글: 기본 지원(복잡한 섹션 구조는 수동 조정 필요할 수 있음)
주석: 기본 나열/추가/삭제(답글 체인은 완전히 지원되지 않음)
변경 내용 추적: 모두 수락 가능, 상세 변경 검사는 제한적
스타일: 전체 XML 가져오기/설정, 선택적 스타일 병합 없음
EMU/크기: 계산되지만 렌더링된 기하 구조는 Word의 레이아웃 엔진에 따라 달라짐
라이선스
MIT
Available Tools
34 toolsdocx.changes_accept_allC
Accept all tracked changes
Inputs: docId (required).
docx.closeC
Close a DOCX document
Inputs: docId (required).
docx.comments_addC
Add a comment
Inputs: text (required), docId (required), author.
docx.comments_deleteC
Delete a comment
Inputs: id (required), docId (required).
docx.comments_listC
List comments
Inputs: docId (required).
docx.copyB
Copy document to new file and open it
Inputs: targetPath (required), sourceDocId (required).
docx.findD
Find text in document
Inputs: docId (required), query (required), mode.
docx.find_empty_table_rowsA
Find all empty rows in tables for MANUAL analysis
Inputs: docId (required).
docx.fix_paragraph_rtlA
Fix RTL direction of paragraph - USE ONLY after manual check
Inputs: docId (required), setLTR (required), paragraphIndex (required).
docx.get_table_contentB
Get content of specific table - all rows with text and empty status
Inputs: docId (required), tableIndex (required).
docx.get_textC
Extract all text
Inputs: docId (required), scope.
docx.images_listC
List all images
Inputs: docId (required).
docx.list_partsC
List document parts
Inputs: docId (required).
docx.metadata_getC
Get document metadata
Inputs: docId (required).
docx.numbering_getC
Get numbering
Inputs: docId (required).
docx.numbering_setD
Set numbering
Inputs: xml (required), docId (required).
docx.openC
Open a DOCX document
Inputs: path, bufferBase64.
docx.part_readC
Read a document part
Inputs: docId (required), partPath (required).
docx.part_writeD
Write a document part
Inputs: xml (required), docId (required), partPath (required).
docx.read_paragraph_rangeC
Read range of paragraphs with formatting info (RTL, style, alignment)
Inputs: count (required), docId (required), startIndex (required).
docx.remove_table_rowC
Remove specific table row by coordinates - USE ONLY after manual analysis
Inputs: docId (required), rowIndex (required), tableIndex (required).
docx.replace_textC
Replace text in document
Inputs: docId (required), match (required), replace (required), mode, +1 more.
docx.saveC
Save a DOCX document
Inputs: docId (required), path, returnBase64.
docx.sdt_getC
Get SDT content
Inputs: docId (required), tagOrAlias (required).
docx.sdt_putD
Set SDT content
Inputs: docId (required), tagOrAlias (required), xmlFragment (required).
docx.styles_getC
Get document styles
Inputs: docId (required).
docx.styles_setD
Set document styles
Inputs: xml (required), docId (required).
docx.table_editC
Edit table content
Inputs: op (required), docId (required), tableXPath (required).
docx.tables_listC
List all tables
Inputs: docId (required).
docx.text_find_locationsA
Find text and return exact coordinates of all occurrences - LLM can see where to edit
Inputs: docId (required), searchText (required), caseSensitive.
docx.text_run_replaceB
Replace text in SPECIFIC run by coordinates (paragraph/run/textNode indices) - precise word-level editing
Inputs: docId (required), newText (required), runIndex (required), textNodeIndex (required), +1 more.
docx.text_runs_analyzeB
Analyze ALL text runs (each <w:t> element) - LLM SEES every word/phrase with formatting
Inputs: docId (required).
docx.validate_structureC
Validate document structure and detect corruption
Inputs: docId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Many tools have distinct targets, but there is meaningful overlap between find and text_find_locations, get_text and text_runs_analyze, and find_empty_table_rows and get_table_content. The descriptions help clarify intent, but an agent could easily select the wrong tool for text or table inspection tasks.
All tools share the docx. prefix, which helps, but the naming pattern is inconsistent: some are verb_noun (list_parts, get_text), some are noun_verb (metadata_get, tables_list), and a few are bare verbs (open, save, find). Synonyms like get/list/read and set/put/write are also mixed.
With 34 tools, this exceeds the 25+ threshold and feels heavy. Several tools are highly granular and could be consolidated, such as find_empty_table_rows versus get_table_content, or find versus text_find_locations, without sacrificing clarity.
The server covers a wide range of DOCX operations: text, tables, comments, styles, headers/footers, SDT content, and validation. However, obvious gaps remain, including no create-from-scratch operation, no paragraph insertion, no table creation, and no image insertion or replacement.
Maintenance
Related MCP Connectors
Document processing over MCP: merge, split and compress PDFs, run OCR, extract document text.
Parse, convert and create Office and PDF documents. OAuth at /mcp/connect/, API key at /mcp/.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Generate, edit, merge, translate and PDF-convert PowerPoint (.pptx) over MCP. 8 tools.
Related MCP Servers
- AlicenseDqualityDmaintenanceEnables reading, writing, editing, and converting Office documents (ODT, DOCX, ODS, XLSX, PDF, etc.) using MCP tools, with no external dependencies.1117 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to generate, edit, validate, and render Word documents programmatically via MCP, ensuring correct OOXML structure and style.3MIT
- AlicenseBqualityCmaintenanceProvides MCP tools for working with Microsoft Word documents, enabling reading, editing with tracked changes, formatting, table manipulation, comments, and PDF conversion via direct OOXML manipulation.37MIT
- AlicenseCqualityDmaintenanceEnables programmatic processing of DOCX/OOXML files through MCP, covering text, tables, images, headers/footers, structured data tags, comments, and track changes.29MIT