Office Word MCP Server
The Office Word MCP Server enables AI assistants to comprehensively create, manage, and manipulate Microsoft Word documents through a standardized protocol.
Document Management: Create new documents with metadata, copy existing documents, list documents in directories, merge documents, and convert Word files to PDF format.
Content Creation: Add headings, paragraphs, tables, images with scaling, numbered lists, page breaks, footnotes, and endnotes. Insert content before/after specific text or at paragraph indices.
Text and Formatting: Apply bold, italic, underline, font size, color, and custom styles to text. Format tables with borders, shading, and headers. Create custom document styles with comprehensive formatting properties.
Content Manipulation: Delete paragraphs or tables, replace content blocks beneath headers or between anchor texts, modify table cell content, and perform search and replace operations with case sensitivity options.
Document Protection: Add or remove password protection and digital signatures, verify document integrity.
Content Extraction and Analysis: Extract full text content, retrieve specific paragraph text by index, get document outlines or raw XML structure, and find text occurrences with flexible matching options.
Advanced Features: Customize footnote/endnote numbering and formatting, replace paragraph blocks, and access comprehensive document information including structure and metadata.
Implemented as a Python-based MCP server that uses python-docx library for Word document manipulation and provides tools for comprehensive document operations
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 document with a title and a table of contents"
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
This repo is a fork from:
https://github.com/GongRzhe/Office-Word-MCP-Server.gitadapted to be deployed as a microservice.
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
Prompt
Output
Related MCP server: Doc/docx-MCP
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
Insert paragraphs with optional styling
Create tables with custom data
Add images with proportional scaling
Insert page breaks
Add footnotes and endnotes to documents
Convert footnotes to endnotes
Customize footnote and endnote styling
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
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
Advanced Document Manipulation
Delete paragraphs
Create custom document styles
Apply consistent formatting throughout documents
Format specific ranges of text with detailed control
Document Protection
Add password protection to documents
Implement restricted editing with editable sections
Add digital signatures to documents
Verify document authenticity and integrity
Installation
Clone to your Coolify server:
git clone https://github.com/franlealp1/mcp-word
cd Office-Word-MCP-ServerInstalling via Smithery (only original repo, not this one)
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 (A)
cd Office-Word-MCP-Server
Install dependencies
pip install -r requirements.txt
### Using 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
```bash
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"
"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"
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)
add_paragraph(filename, text, style=None)
add_table(filename, rows, cols, data=None)
add_picture(filename, image_path, width=None)
add_page_break(filename)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)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
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.
Updated Fri Aug 22 11:39:21 PM CEST 2025
Available Tools
32 toolsadd_endnote_to_documentC
Add an endnote to a specific paragraph in a Word document.
Inputs: endnote_text (required), filename (required), paragraph_index (required).
add_footnote_to_documentC
Add a footnote to a specific paragraph in a Word document.
Inputs: filename (required), footnote_text (required), paragraph_index (required).
add_headingC
Add a heading to a Word document.
Inputs: filename (required), text (required), level.
add_page_breakC
Add a page break to the document.
Inputs: filename (required).
add_paragraphC
Add a paragraph to a Word document.
Inputs: filename (required), text (required), style.
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: cols (required), filename (required), rows (required), data.
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), base_style, bold, +4 more.
create_documentC
Create a new Word document with optional metadata.
Inputs: filename (required), author, title.
customize_footnote_styleC
Customize footnote numbering and formatting in a Word document.
Inputs: filename (required), font_name, font_size, numbering_format, +1 more.
delete_paragraphC
Delete a paragraph from a document.
Inputs: filename (required), paragraph_index (required).
delete_tableC
Delete a table from a document.
Inputs: filename (required), table_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), border_style, has_header_row, +1 more.
format_textC
Format a specific range of text within a paragraph.
IMPORTANT: When specifying the color parameter, use a hex code WITHOUT the leading # (e.g., '0070C0', not '#0070C0').
Inputs: end_pos (required), filename (required), paragraph_index (required), start_pos (required), +6 more.
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_xmlB
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).
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), header_style, header_title, position, +2 more.
insert_line_or_paragraph_near_textC
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), line_style, line_text, position, +2 more.
insert_numbered_list_near_textA
Insert a 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).
Inputs: filename (required), list_items, position, target_paragraph_index, +1 more.
list_available_documentsB
List all .docx files in the specified directory.
Inputs: directory.
modify_table_cellC
Modify or add content to a specific table cell, following the style of existing non-header cells.
Inputs: column (required), content (required), filename (required), row (required), +1 more.
protect_documentC
Add password protection to a Word document.
Inputs: filename (required), password (required).
replace_block_between_manual_anchorsB
Replace all content between start_anchor_text and end_anchor_text (or next logical header if not provided).
Inputs: filename (required), new_paragraphs (required), start_anchor_text (required), end_anchor_text, +1 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).
unprotect_documentC
Remove password protection from a Word document.
Inputs: filename (required), password (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 32 tools
Most tools have distinct purposes, but there is some overlap that could cause confusion. For example, 'add_paragraph' and 'insert_line_or_paragraph_near_text' both handle paragraph insertion, and 'find_text_in_document' and 'search_and_replace' both involve text searching. The descriptions help clarify differences, but an agent might misselect between similar tools.
The naming is mostly consistent with a verb_noun pattern, such as 'add_paragraph', 'format_text', and 'create_document'. However, there are minor deviations like 'list_available_documents' (which fits) and 'replace_block_between_manual_anchors' (which is verbose but follows the pattern). No chaotic mixing of styles is present.
With 32 tools, this server feels overly heavy for a Word document manipulation scope. While Word has many features, the tool set includes numerous specialized operations that could be consolidated or omitted, leading to potential complexity and confusion for agents. A more streamlined set of 15-20 tools would be more appropriate.
The tool surface is highly complete for Word document operations, covering creation, editing, formatting, conversion, protection, and metadata handling. It includes CRUD-like actions for paragraphs, tables, and styles, as well as advanced features like footnotes, headers, and XML access. No obvious gaps are present for the domain.
Related MCP Connectors
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Create and manage documents, spreadsheets, and presentations from your AI assistant.
Document editing, AI writing, saved documents, DOCX downloads, PDF, STT, TTS and watermarking
Online office suite for AI agents: edit docs, sheets, slides and PDFs in browser or via MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive document processing, including reading, converting, and manipulating various document formats with advanced text and HTML processing capabilities.1659 npm19MIT
- FlicenseNot gradedqualityDmaintenanceA powerful Word document processing service based on FastMCP, enabling AI assistants to create, edit, and manage docx files with full formatting support. Preserves original styles when editing content.193-
- AlicenseCqualityDmaintenanceWord document reading and writing MCP implemented in Node.js774 npm10MIT
- AlicenseCqualityFmaintenanceA Model Context Protocol server that enables AI assistants to create, read, edit, and format Microsoft Word documents through standardized tools and resources.5428,163 PyPI2,114MIT