Office Word MCP Server
The Office Word MCP Server is a tool that enables AI assistants to create, read, and manipulate Microsoft Word documents programmatically through the Model Context Protocol.
Key capabilities include:
Document Management: Create new documents with metadata, extract text, view properties, list/copy documents, merge multiple documents, and convert to PDF
Content Creation: Add headings, paragraphs, tables, images, page breaks, footnotes, and endnotes
Text Formatting: Apply bold/italic/underline formatting, change text color and font properties, apply custom styles, and search/replace text
Table Manipulation: Format tables with borders, styles, header rows, cell shading, and custom borders
Document Protection: Add password protection, implement restricted editing, apply digital signatures, and verify document integrity
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Office Word MCP Server create a new Word document with a title and two paragraphs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Office-Word-MCP-Server
A Model Context Protocol (MCP) server for creating, reading, and manipulating Microsoft Word documents. This server enables AI assistants to work with Word documents through a standardized interface, providing rich document editing capabilities.
Overview
Office-Word-MCP-Server implements the Model Context Protocol to expose Word document operations as tools and resources. It serves as a bridge between AI assistants and Microsoft Word documents, allowing for document creation, content addition, formatting, and analysis.
The server features a modular architecture that separates concerns into core functionality, tools, and utilities, making it highly maintainable and extensible for future enhancements.
Example
Pormpt
Output
Related MCP server: Claude Document MCP Server
Features
Document Management
Create new Word documents with metadata
Extract text and analyze document structure
View document properties and statistics
List available documents in a directory
Create copies of existing documents
Merge multiple documents into a single document
Convert Word documents to PDF format
Content Creation
Add headings with different levels and direct formatting (font, size, bold, italic, borders)
Insert paragraphs with optional styling and direct formatting (font, size, bold, italic, color)
Create tables with custom data
Add images with proportional scaling
Insert page breaks
Insert bulleted and numbered lists with proper XML formatting
Add footnotes and endnotes to documents
Convert footnotes to endnotes
Customize footnote and endnote styling
Create professional table layouts for technical documentation
Design callout boxes and formatted content for instructional materials
Build structured data tables for business reports with consistent styling
Insert content relative to existing text or paragraph indices
Rich Text Formatting
Format specific text sections (bold, italic, underline)
Change text color and font properties
Apply custom styles to text elements
Search and replace text throughout documents
Individual cell text formatting within tables
Multiple formatting combinations for enhanced visual appeal
Font customization with family and size control
Direct formatting during content creation (paragraphs and headings)
Reduce function calls by combining content creation with formatting
Add section header borders for visual separation
Table Formatting
Format tables with borders and styles
Create header rows with distinct formatting
Apply cell shading and custom borders
Structure tables for better readability
Individual cell background shading with color support
Alternating row colors for improved readability
Enhanced header row highlighting with custom colors
Cell text formatting with bold, italic, underline, color, font size, and font family
Comprehensive color support with named colors and hex color codes
Cell padding management with independent control of all sides
Cell alignment (horizontal and vertical positioning)
Cell merging (horizontal, vertical, and rectangular areas)
Column width management with multiple units (points, percentage, auto-fit)
Auto-fit capabilities for dynamic column sizing
Professional callout table support with icon cells and styled content
Advanced Document Manipulation
Delete paragraphs
Insert content relative to specific text or paragraph indices
Insert bulleted and numbered lists with proper XML numbering structure
Insert headers and paragraphs before or after target locations
Create custom document styles
Apply consistent formatting throughout documents
Format specific ranges of text with detailed control
Flexible padding units with support for points and percentage-based measurements
Clear, readable table presentation with proper alignment and spacing
Document Protection
Add password protection to documents
Implement restricted editing with editable sections
Add digital signatures to documents
Verify document authenticity and integrity
Comment Extraction
Extract all comments from a document
Filter comments by author
Get comments for specific paragraphs
Access comment metadata (author, date, text)
Installation
Installing via Smithery
To install Office Word Document Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @GongRzhe/Office-Word-MCP-Server --client claudePrerequisites
Python 3.8 or higher
pip package manager
Basic Installation
# Clone the repository
git clone https://github.com/GongRzhe/Office-Word-MCP-Server.git
cd Office-Word-MCP-Server
# Install dependencies
pip install -r requirements.txtUsing the Setup Script
Alternatively, you can use the provided setup script which handles:
Checking prerequisites
Setting up a virtual environment
Installing dependencies
Generating MCP configuration
python setup_mcp.pyUsage with Claude for Desktop
Configuration
Method 1: After Local Installation
After installation, add the server to your Claude for Desktop configuration file:
{
"mcpServers": {
"word-document-server": {
"command": "python",
"args": ["/path/to/word_mcp_server.py"]
}
}
}Method 2: Without Installation (Using uvx)
You can also configure Claude for Desktop to use the server without local installation by using the uvx package manager:
{
"mcpServers": {
"word-document-server": {
"command": "uvx",
"args": ["--from", "office-word-mcp-server", "word_mcp_server"]
}
}
}Configuration file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude for Desktop to load the configuration.
Example Operations
Once configured, you can ask Claude to perform operations like:
"Create a new document called 'report.docx' with a title page"
"Add a heading and three paragraphs to my document"
"Add my name in Helvetica 36pt bold at the top of the document"
"Add a section heading 'Summary' in Helvetica 14pt bold with a bottom border"
"Add a paragraph in Times New Roman 14pt with italic blue text"
"Insert a bulleted list after the paragraph containing 'Introduction'"
"Insert a numbered list with items: 'First step', 'Second step', 'Third step'"
"Add bullet points after the 'Summary' heading"
"Insert a 4x4 table with sales data"
"Format the word 'important' in paragraph 2 to be bold and red"
"Search and replace all instances of 'old term' with 'new term'"
"Create a custom style for section headings"
"Apply formatting to the table in my document"
"Extract all comments from my document"
"Show me all comments by John Doe"
"Get comments for paragraph 3"
"Make the text in table cell (1,2) bold and blue with 14pt font"
"Add 10 points of padding to all sides of the header cells"
"Create a callout table with a blue checkmark icon and white text"
"Set the first column width to 50 points and auto-fit the remaining columns"
"Apply alternating row colors to make the table more readable"
API Reference
Document Creation and Properties
create_document(filename, title=None, author=None)
get_document_info(filename)
get_document_text(filename)
get_document_outline(filename)
list_available_documents(directory=".")
copy_document(source_filename, destination_filename=None)
convert_to_pdf(filename, output_filename=None)Content Addition
add_heading(filename, text, level=1, font_name=None, font_size=None,
bold=None, italic=None, border_bottom=False)
add_paragraph(filename, text, style=None, font_name=None, font_size=None,
bold=None, italic=None, color=None)
add_table(filename, rows, cols, data=None)
add_picture(filename, image_path, width=None)
add_page_break(filename)Advanced Content Manipulation
# Insert content relative to existing text or paragraph index
insert_header_near_text(filename, target_text=None, header_title=None,
position='after', header_style='Heading 1',
target_paragraph_index=None)
insert_line_or_paragraph_near_text(filename, target_text=None, line_text=None,
position='after', line_style=None,
target_paragraph_index=None)
# Insert bulleted or numbered lists with proper XML formatting
insert_numbered_list_near_text(filename, target_text=None, list_items=None,
position='after', target_paragraph_index=None,
bullet_type='bullet')
# bullet_type options:
# 'bullet' - Creates bulleted list with bullets (•)
# 'number' - Creates numbered list (1, 2, 3, ...)Content Extraction
get_document_text(filename)
get_paragraph_text_from_document(filename, paragraph_index)
find_text_in_document(filename, text_to_find, match_case=True, whole_word=False)Text Formatting
format_text(filename, paragraph_index, start_pos, end_pos, bold=None,
italic=None, underline=None, color=None, font_size=None, font_name=None)
search_and_replace(filename, find_text, replace_text)
delete_paragraph(filename, paragraph_index)
create_custom_style(filename, style_name, bold=None, italic=None,
font_size=None, font_name=None, color=None, base_style=None)Table Formatting
format_table(filename, table_index, has_header_row=None,
border_style=None, shading=None)
set_table_cell_shading(filename, table_index, row_index, col_index,
fill_color, pattern="clear")
apply_table_alternating_rows(filename, table_index,
color1="FFFFFF", color2="F2F2F2")
highlight_table_header(filename, table_index,
header_color="4472C4", text_color="FFFFFF")
# Cell merging tools
merge_table_cells(filename, table_index, start_row, start_col, end_row, end_col)
merge_table_cells_horizontal(filename, table_index, row_index, start_col, end_col)
merge_table_cells_vertical(filename, table_index, col_index, start_row, end_row)
# Cell alignment tools
set_table_cell_alignment(filename, table_index, row_index, col_index,
horizontal="left", vertical="top")
set_table_alignment_all(filename, table_index,
horizontal="left", vertical="top")
# Cell text formatting tools
format_table_cell_text(filename, table_index, row_index, col_index,
text_content=None, bold=None, italic=None, underline=None,
color=None, font_size=None, font_name=None)
# Cell padding tools
set_table_cell_padding(filename, table_index, row_index, col_index,
top=None, bottom=None, left=None, right=None, unit="points")
# Column width management
set_table_column_width(filename, table_index, col_index, width, width_type="points")
set_table_column_widths(filename, table_index, widths, width_type="points")
set_table_width(filename, table_index, width, width_type="points")
auto_fit_table_columns(filename, table_index)Comment Extraction
get_all_comments(filename)
get_comments_by_author(filename, author)
get_comments_for_paragraph(filename, paragraph_index)Troubleshooting
Common Issues
Missing Styles
Some documents may lack required styles for heading and table operations
The server will attempt to create missing styles or use direct formatting
For best results, use templates with standard Word styles
Permission Issues
Ensure the server has permission to read/write to the document paths
Use the
copy_documentfunction to create editable copies of locked documentsCheck file ownership and permissions if operations fail
Image Insertion Problems
Use absolute paths for image files
Verify image format compatibility (JPEG, PNG recommended)
Check image file size and permissions
Table Formatting Issues
Cell index errors: Ensure row and column indices are within table bounds (0-based indexing)
Color format problems: Use hex colors without '#' prefix (e.g., "FF0000" for red) or standard color names
Padding unit confusion: Specify "points" or "percent" explicitly when setting cell padding
Column width conflicts: Auto-fit may override manual column width settings
Text formatting persistence: Apply cell text formatting after setting cell content for best results
Debugging
Enable detailed logging by setting the environment variable:
export MCP_DEBUG=1 # Linux/macOS
set MCP_DEBUG=1 # WindowsContributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Model Context Protocol for the protocol specification
python-docx for Word document manipulation
FastMCP for the Python MCP implementation
Note: This server interacts with document files on your system. Always verify that requested operations are appropriate before confirming them in Claude for Desktop or other MCP clients.
Available Tools
54 toolsadd_endnote_to_documentC
Add an endnote to a specific paragraph in a Word document.
Inputs: filename (required), paragraph_index (required), endnote_text (required).
add_footnote_after_textC
Add a footnote after specific text with proper superscript formatting. This enhanced function ensures footnotes display correctly as superscript.
Inputs: filename (required), search_text (required), footnote_text (required), output_filename.
add_footnote_before_textC
Add a footnote before specific text with proper superscript formatting. This enhanced function ensures footnotes display correctly as superscript.
Inputs: filename (required), search_text (required), footnote_text (required), output_filename.
add_footnote_enhancedC
Enhanced footnote addition with guaranteed superscript formatting. Adds footnote at the end of a specific paragraph with proper style handling.
Inputs: filename (required), paragraph_index (required), footnote_text (required), output_filename.
add_footnote_robustC
Add footnote with robust validation and Word compliance. This is the production-ready version with comprehensive error handling.
Inputs: filename (required), search_text, paragraph_index, footnote_text, +2 more.
add_footnote_to_documentC
Add a footnote to a specific paragraph in a Word document.
Inputs: filename (required), paragraph_index (required), footnote_text (required).
add_headingA
Add a heading to a Word document with optional formatting.
Args: filename: Path to Word document text: Heading text level: Heading level (1-9) font_name: Font family (e.g., 'Helvetica') font_size: Font size in points (e.g., 14) bold: Make heading bold italic: Make heading italic border_bottom: Add bottom border (for section headers)
Inputs: filename (required), text (required), level, font_name, +4 more.
add_page_breakC
Add a page break to the document.
Inputs: filename (required).
add_paragraphB
Add a paragraph to a Word document with optional formatting.
Args: filename: Path to Word document text: Paragraph text content style: Optional paragraph style name font_name: Font family (e.g., 'Helvetica', 'Times New Roman') font_size: Font size in points (e.g., 14, 36) bold: Make text bold italic: Make text italic color: Text color as hex RGB (e.g., '000000')
Inputs: filename (required), text (required), style, font_name, +4 more.
add_pictureC
Add an image to a Word document.
Inputs: filename (required), image_path (required), width.
add_tableC
Add a table to a Word document.
Inputs: filename (required), rows (required), cols (required), data.
apply_table_alternating_rowsC
Apply alternating row colors to a table for better readability.
Inputs: filename (required), table_index (required), color1, color2.
auto_fit_table_columnsC
Set table columns to auto-fit based on content.
Inputs: filename (required), table_index (required).
convert_to_pdfC
Convert a Word document to PDF format.
Inputs: filename (required), output_filename.
copy_documentC
Create a copy of a Word document.
Inputs: source_filename (required), destination_filename.
create_custom_styleC
Create a custom style in the document.
Inputs: filename (required), style_name (required), bold, italic, +4 more.
create_documentC
Create a new Word document with optional metadata.
Inputs: filename (required), title, author.
customize_footnote_styleC
Customize footnote numbering and formatting in a Word document.
Inputs: filename (required), numbering_format, start_number, font_name, +1 more.
delete_footnote_from_documentC
Delete a footnote from a Word document. Identify the footnote either by ID (1, 2, 3, etc.) or by searching for text near it.
Inputs: filename (required), footnote_id, search_text, output_filename.
delete_footnote_robustC
Delete footnote with comprehensive cleanup and orphan removal. Ensures complete removal from document.xml, footnotes.xml, and relationships.
Inputs: filename (required), footnote_id, search_text, clean_orphans.
delete_paragraphC
Delete a paragraph from a document.
Inputs: filename (required), paragraph_index (required).
find_text_in_documentC
Find occurrences of specific text in a Word document.
Inputs: filename (required), text_to_find (required), match_case, whole_word.
format_tableC
Format a table with borders, shading, and structure.
Inputs: filename (required), table_index (required), has_header_row, border_style, +1 more.
format_table_cell_textC
Format text within a specific table cell.
Inputs: filename (required), table_index (required), row_index (required), col_index (required), +7 more.
format_textC
Format a specific range of text within a paragraph.
Inputs: filename (required), paragraph_index (required), start_pos (required), end_pos (required), +6 more.
get_all_commentsC
Extract all comments from a Word document.
Inputs: filename (required).
get_comments_by_authorC
Extract comments from a specific author in a Word document.
Inputs: filename (required), author (required).
get_comments_for_paragraphC
Extract comments for a specific paragraph in a Word document.
Inputs: filename (required), paragraph_index (required).
get_document_infoC
Get information about a Word document.
Inputs: filename (required).
get_document_outlineC
Get the structure of a Word document.
Inputs: filename (required).
get_document_textC
Extract all text from a Word document.
Inputs: filename (required).
get_document_xmlC
Get the raw XML structure of a Word document.
Inputs: filename (required).
get_paragraph_text_from_documentC
Get text from a specific paragraph in a Word document.
Inputs: filename (required), paragraph_index (required).
highlight_table_headerC
Apply special highlighting to table header row.
Inputs: filename (required), table_index (required), header_color, text_color.
insert_header_near_textA
Insert a header (with specified style) before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), header_title (str), position ('before' or 'after'), header_style (str, default 'Heading 1'), target_paragraph_index (int, optional).
Inputs: filename (required), target_text, header_title, position, +2 more.
insert_line_or_paragraph_near_textB
Insert a new line or paragraph (with specified or matched style) before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), line_text (str), position ('before' or 'after'), line_style (str, optional), target_paragraph_index (int, optional).
Inputs: filename (required), target_text, line_text, position, +2 more.
insert_numbered_list_near_textA
Insert a bulleted or numbered list before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), list_items (list of str), position ('before' or 'after'), target_paragraph_index (int, optional), bullet_type ('bullet' for bullets or 'number' for numbered lists, default: 'bullet').
Inputs: filename (required), target_text, list_items, position, +2 more.
list_available_documentsC
List all .docx files in the specified directory.
Inputs: directory.
merge_table_cellsC
Merge cells in a rectangular area of a table.
Inputs: filename (required), table_index (required), start_row (required), start_col (required), +2 more.
merge_table_cells_horizontalC
Merge cells horizontally in a single row.
Inputs: filename (required), table_index (required), row_index (required), start_col (required), +1 more.
merge_table_cells_verticalC
Merge cells vertically in a single column.
Inputs: filename (required), table_index (required), col_index (required), start_row (required), +1 more.
protect_documentC
Add password protection to a Word document.
Inputs: filename (required), password (required).
replace_block_between_manual_anchorsC
Replace all content between start_anchor_text and end_anchor_text (or next logical header if not provided).
Inputs: filename (required), start_anchor_text (required), new_paragraphs (required), end_anchor_text, +2 more.
replace_paragraph_block_below_headerC
Reemplaza el bloque de párrafos debajo de un encabezado, evitando modificar TOC.
Inputs: filename (required), header_text (required), new_paragraphs (required), detect_block_end_fn.
search_and_replaceC
Search for text and replace all occurrences.
Inputs: filename (required), find_text (required), replace_text (required).
set_table_alignment_allC
Set text alignment for all cells in a table.
Inputs: filename (required), table_index (required), horizontal, vertical.
set_table_cell_alignmentC
Set text alignment for a specific table cell.
Inputs: filename (required), table_index (required), row_index (required), col_index (required), +2 more.
set_table_cell_paddingC
Set padding/margins for a specific table cell.
Inputs: filename (required), table_index (required), row_index (required), col_index (required), +5 more.
set_table_cell_shadingC
Apply shading/filling to a specific table cell.
Inputs: filename (required), table_index (required), row_index (required), col_index (required), +2 more.
set_table_column_widthC
Set the width of a specific table column.
Inputs: filename (required), table_index (required), col_index (required), width (required), +1 more.
set_table_column_widthsC
Set the widths of multiple table columns.
Inputs: filename (required), table_index (required), widths (required), width_type.
set_table_widthC
Set the overall width of a table.
Inputs: filename (required), table_index (required), width (required), width_type.
unprotect_documentC
Remove password protection from a Word document.
Inputs: filename (required), password (required).
validate_document_footnotesC
Validate all footnotes in document for coherence and compliance. Returns detailed report on ID conflicts, orphaned content, missing styles, etc.
Inputs: filename (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 54 tools
Multiple tools have overlapping purposes, especially for footnotes (e.g., add_footnote_to_document, add_footnote_enhanced, add_footnote_robust, add_footnote_before_text, add_footnote_after_text) and table formatting (e.g., set_table_cell_alignment vs. set_table_alignment_all, merge_table_cells vs. merge_table_cells_horizontal/vertical). Descriptions help somewhat, but the boundaries are unclear, leading to potential misselection.
The naming follows a mostly snake_case pattern, but conventions are mixed with inconsistent verb styles (e.g., 'add' vs. 'insert' vs. 'apply' vs. 'set' for similar operations) and some tools have overly verbose names (e.g., replace_block_between_manual_anchors). While readable, it lacks a predictable pattern across all tools.
With 54 tools, the count is excessive for a Word document server, making it heavy and overwhelming. Many tools could be consolidated (e.g., multiple footnote addition/deletion tools, redundant table formatting functions), indicating poor scoping and bloat.
The tool set covers a wide range of Word document operations, including creation, formatting, tables, footnotes, comments, and conversion to PDF. Minor gaps exist (e.g., no direct tool for adding comments or managing sections), but core workflows are well-covered, allowing agents to work around most limitations.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
One MCP server for the services your AI needs: memory, files, Microsoft 365, kanban and more.
Related MCP Servers
- AlicenseAqualityDmaintenanceA server providing tools to read, write, and edit Microsoft Word (docx) files through the Model Context Protocol, allowing operations like complete document reading, content creation, targeted paragraph editing, and text insertion.439MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows Claude Desktop to perform document operations on Microsoft Word, Excel, and PDF files including creation, editing, and format conversion.52MIT
- FlicenseAqualityDmaintenanceA comprehensive Model Context Protocol server that processes Microsoft Word documents with full formatting support, enabling text extraction, HTML/Markdown conversion, structure analysis, and image extraction.52-
- -licenseNot gradedqualityNot gradedmaintenanceA Python server implementing Model Context Protocol for advanced Microsoft Word document manipulation, enabling programmatic automation of complex document processing tasks.-