MCP Hub
Back to servers

che-word-mcp

Swift-native MCP server for Word (.docx) manipulation with 148 tools

Registryglama
Stars
3
Forks
2
Updated
Mar 13, 2026
Validated
Mar 15, 2026

che-word-mcp

A Swift-native MCP (Model Context Protocol) server for Microsoft Word document (.docx) manipulation. This is the first Swift OOXML library that directly manipulates Office Open XML without any third-party Word dependencies.

中文說明

Features

  • Pure Swift Implementation: No Node.js, Python, or external runtime required
  • Direct OOXML Manipulation: Works directly with XML, no Microsoft Word installation needed
  • Single Binary: Just one executable file
  • 146 MCP Tools: Comprehensive document manipulation capabilities
  • Dual-Mode Access: Direct Mode (read-only, one step) and Session Mode (full lifecycle)
  • Complete OOXML Support: Full support for tables, styles, images, headers/footers, comments, footnotes, and more
  • Cross-platform: Works on macOS (and potentially other platforms supporting Swift)

Version History

VersionDateChanges
v1.17.02026-03-11Session state management: dirty tracking, autosave, finalize_document, get_document_session_state, shutdown flush (contributed by @ildunari)
v1.16.02026-03-10Dual-Mode: 15 read-only tools now support source_path (Direct Mode); MCP server instructions added
v1.15.22026-03-07Improve list_all_formatted_text tool description for better LLM parameter handling
v1.15.12026-03-01Fix heading heuristic style fallback (resolve fontSize from style inheritance chain)
v1.15.02026-03-01Practical Mode: EMF→PNG auto-conversion + heading heuristic for style-less documents
v1.14.02026-03-01Embed word-to-md-swift library: no external macdoc binary needed, restore doc_id support
v1.13.02026-03-01Upgrade ooxml-swift to v0.5.0: parallel multi-core parsing (~0.64s for large docs)
v1.12.12026-03-01Upgrade ooxml-swift to v0.4.0: large document performance fix (>30s → ~2.3s)
v1.12.02026-02-28export_markdown uses source_path only, removes doc_id, adds lock file check
v1.11.12026-02-28Fix export_markdown stdout mode (pipe fsync issue)
v1.11.02026-02-28export_markdown delegates to macdoc CLI; removed word-to-md-swift dependency
v1.9.02026-02-28export_markdown upgraded to use word-to-md-swift for high-quality output (145 total)
v1.8.02026-02-03Remove hard diff limit, add max_results & heading_styles params to compare_documents
v1.7.02026-02-03Add compare_documents tool for server-side document diff (105 total)
v1.2.12026-01-16Fix MCP SDK compatibility (actor→class, add capabilities)
v1.2.02026-01-16Add 12 new tools (95 total): search, hyperlinks, bookmarks, footnotes, endnotes, revisions, properties
v1.1.02026-01-16Fix MCPB manifest.json format for Claude Desktop
v1.0.02026-01-16Initial release with 83 tools, refactored to use ooxml-swift

Installation

Option 1: Download from Release (Recommended)

Download the latest release from GitHub Releases:

  • CheWordMCP - Universal Binary (arm64 + x86_64)
  • che-word-mcp.mcpb - MCPB package
# Download and install
curl -L https://github.com/PsychQuant/che-word-mcp/releases/latest/download/CheWordMCP -o ~/bin/CheWordMCP
chmod +x ~/bin/CheWordMCP

Option 2: Build from Source

Prerequisites

  • macOS 13.0+ (Ventura or later)
  • Swift 5.9+
git clone https://github.com/PsychQuant/che-word-mcp.git
cd che-word-mcp
swift build -c release

The binary will be located at .build/release/CheWordMCP

Add to Claude Code

claude mcp add che-word-mcp /path/to/che-word-mcp/.build/release/CheWordMCP

Add to Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "che-word-mcp": {
      "command": "/path/to/che-word-mcp/.build/release/CheWordMCP"
    }
  }
}

Two Modes of Operation

Direct Mode (source_path) — Read-only, no state

Pass a file path directly. No need to call open_document first. Best for quick inspection.

# Just pass source_path — one step
list_images: { "source_path": "/path/to/file.docx" }
search_text: { "source_path": "/path/to/file.docx", "query": "keyword" }
get_document_info: { "source_path": "/path/to/file.docx" }

18 tools support Direct Mode:

CategoryTools
Read contentget_text, get_document_text, get_paragraphs, get_document_info, search_text
List elementslist_images, list_styles, get_tables, list_comments, list_hyperlinks, list_bookmarks, list_footnotes, list_endnotes, get_revisions
Propertiesget_document_properties, get_section_properties, get_word_count_by_section
Exportexport_markdown

Session Mode (doc_id) — Full read/write lifecycle

Call open_document first, then use doc_id for all subsequent operations. Required for editing.

open_document: { "path": "/path/to/file.docx", "doc_id": "mydoc" }
insert_paragraph: { "doc_id": "mydoc", "text": "Hello World" }
save_document: { "doc_id": "mydoc", "path": "/path/to/output.docx" }
close_document: { "doc_id": "mydoc" }

Dual-mode tools accept both source_path and doc_id. If you already have a document open, use doc_id to avoid re-reading from disk.

Usage with AI Agents

Just ask the agent

Use che-word-mcp to read all images from ~/Documents/report.docx

The agent will automatically use Direct Mode (no need to open/close).

AGENTS.md / CLAUDE.md

## Word Document Manipulation

Use `che-word-mcp` for reading and writing Microsoft Word (.docx) files.

**Read-only** (Direct Mode — one step):
- `get_document_text` / `get_paragraphs` — read content
- `list_images` / `search_text` — inspect elements
- `export_markdown` — convert to Markdown

**Edit** (Session Mode — open→edit→save):
1. `open_document` → get doc_id
2. `insert_paragraph` / `replace_text` / `format_text` — modify
3. `save_document` → write to disk
4. `close_document` → release memory

Claude Code Skill

mkdir -p .claude/skills/che-word-mcp
curl -o .claude/skills/che-word-mcp/SKILL.md \
  https://raw.githubusercontent.com/PsychQuant/che-word-mcp/main/skills/che-word-mcp/SKILL.md

Available Tools (83 Total)

Document Management (6 tools)

ToolDescription
create_documentCreate a new Word document
open_documentOpen an existing .docx file
save_documentSave document to .docx file
close_documentClose an open document
list_open_documentsList all open documents
get_document_infoGet document statistics

Content Operations (6 tools)

ToolDescription
get_textGet plain text content
get_paragraphsGet all paragraphs with formatting
insert_paragraphInsert a new paragraph
update_paragraphUpdate paragraph content
delete_paragraphDelete a paragraph
replace_textSearch and replace text

Formatting (3 tools)

ToolDescription
format_textApply text formatting (bold, italic, color, font)
set_paragraph_formatSet paragraph formatting (alignment, spacing)
apply_styleApply built-in or custom styles

Tables (6 tools)

ToolDescription
insert_tableInsert a table with optional data
get_tablesGet all tables information
update_cellUpdate cell content
delete_tableDelete a table
merge_cellsMerge cells horizontally or vertically
set_table_styleSet table borders and shading

Style Management (4 tools)

ToolDescription
list_stylesList all available styles
create_styleCreate custom style
update_styleUpdate style definition
delete_styleDelete custom style

Lists (3 tools)

ToolDescription
insert_bullet_listInsert bullet list
insert_numbered_listInsert numbered list
set_list_levelSet list indentation level

Page Setup (5 tools)

ToolDescription
set_page_sizeSet page size (A4, Letter, etc.)
set_page_marginsSet page margins
set_page_orientationSet portrait or landscape
insert_page_breakInsert page break
insert_section_breakInsert section break

Headers & Footers (5 tools)

ToolDescription
add_headerAdd header content
update_headerUpdate header content
add_footerAdd footer content
update_footerUpdate footer content
insert_page_numberInsert page number field

Images (6 tools)

ToolDescription
insert_imageInsert inline image (PNG, JPEG)
insert_floating_imageInsert floating image with text wrap
update_imageUpdate image properties
delete_imageDelete image
list_imagesList all images
set_image_styleSet image border and effects

Export (2 tools)

ToolDescription
export_textExport as plain text
export_markdownExport as Markdown

Hyperlinks & Bookmarks (6 tools)

ToolDescription
insert_hyperlinkInsert external hyperlink
insert_internal_linkInsert link to bookmark
update_hyperlinkUpdate hyperlink
delete_hyperlinkDelete hyperlink
insert_bookmarkInsert bookmark
delete_bookmarkDelete bookmark

Comments & Revisions (10 tools)

ToolDescription
insert_commentInsert comment
update_commentUpdate comment text
delete_commentDelete comment
list_commentsList all comments
reply_to_commentReply to existing comment
resolve_commentMark comment as resolved
enable_track_changesEnable track changes
disable_track_changesDisable track changes
accept_revisionAccept revision
reject_revisionReject revision

Footnotes & Endnotes (4 tools)

ToolDescription
insert_footnoteInsert footnote
delete_footnoteDelete footnote
insert_endnoteInsert endnote
delete_endnoteDelete endnote

Field Codes (7 tools)

ToolDescription
insert_if_fieldInsert IF conditional field
insert_calculation_fieldInsert calculation (SUM, AVERAGE, etc.)
insert_date_fieldInsert date/time field
insert_page_fieldInsert page number field
insert_merge_fieldInsert mail merge field
insert_sequence_fieldInsert auto-numbering sequence
insert_content_controlInsert SDT content control

Repeating Sections (1 tool)

ToolDescription
insert_repeating_sectionInsert repeating section (Word 2012+)

Advanced Features (9 tools)

ToolDescription
insert_tocInsert table of contents
insert_text_fieldInsert form text field
insert_checkboxInsert form checkbox
insert_dropdownInsert form dropdown
insert_equationInsert math equation
set_paragraph_borderSet paragraph border
set_paragraph_shadingSet paragraph background color
set_character_spacingSet character spacing
set_text_effectSet text animation effect

Usage Examples

Create a Document with Headings and Text

Create a new Word document called "report" with:
- Title: "Quarterly Report"
- Heading: "Introduction"
- A paragraph explaining the report purpose
Save it to ~/Documents/report.docx

Create a Document with Table and Images

Create a document with:
- A title "Product Catalog"
- Insert an image from ~/images/logo.png
- A 4x3 table with product information
- Apply borders to the table
Save it to ~/Documents/catalog.docx

Create a Professional Report

Create a document with:
- Custom page margins (1 inch all around)
- A header with company name
- A footer with page numbers
- Table of contents
- Multiple sections with headings
- Footnotes for references
Save it as ~/Documents/annual_report.docx

Technical Details

OOXML Structure

The server generates valid Office Open XML documents with complete structure:

document.docx (ZIP)
├── [Content_Types].xml
├── _rels/
│   └── .rels
├── word/
│   ├── document.xml      # Main content
│   ├── styles.xml        # Style definitions
│   ├── settings.xml      # Document settings
│   ├── fontTable.xml     # Font definitions
│   ├── numbering.xml     # List definitions
│   ├── comments.xml      # Comments
│   ├── footnotes.xml     # Footnotes
│   ├── endnotes.xml      # Endnotes
│   ├── header1.xml       # Header content
│   ├── footer1.xml       # Footer content
│   ├── media/            # Embedded images
│   │   └── image*.{png,jpeg}
│   └── _rels/
│       └── document.xml.rels
└── docProps/
    ├── core.xml          # Metadata
    └── app.xml           # Application info

Dependencies

Comparison with Other Solutions

FeatureAnthropic Word MCPpython-docxdocx npmche-word-mcp
LanguageNode.jsPythonNode.jsSwift
BackendAppleScriptOOXMLOOXMLOOXML
Requires WordYesNoNoNo
RuntimeNode.jsPythonNode.jsNone
Single BinaryNoNoNoYes
Tools Count~10N/AN/A146
ImagesLimitedYesYesYes
CommentsNoLimitedLimitedYes
Track ChangesNoNoNoYes
TOCNoLimitedNoYes
Form FieldsNoNoNoYes

Performance

Benchmarks on Apple Silicon (M4 Max, 128GB RAM):

Read Performance

File SizeTime
40 KB (thesis outline)72 ms
431 KB (complex document)31 ms

Write Performance

OperationContentTime
Basic writeCreate + 3 paragraphs + Save19 ms
Complex documentTitle + Paragraphs + Table + List21 ms
Bulk write50 paragraphs + Save28 ms

Why So Fast?

  • Native Swift binary - No interpreter startup overhead
  • Direct OOXML manipulation - No Microsoft Word process
  • Efficient ZIP handling - ZIPFoundation for compression
  • In-memory operations - Only writes to disk on save

Compared to python-docx (~200ms startup) or docx npm (~150ms startup), che-word-mcp is 10-20x faster.

License

MIT License

Author

Che Cheng (@kiki830621)

Related Projects

Reviews

No reviews yet

Sign in to write a review