- Explore MCP Servers
- Office-Word-MCP-Server
Office Word Mcp Server
What is Office Word Mcp Server
Office-Word-MCP-Server is a Model Context Protocol (MCP) server designed for creating, reading, and manipulating Microsoft Word documents. It provides a standardized interface for AI assistants to interact with Word documents, enabling rich document editing capabilities.
Use cases
Use cases include automating report generation, creating educational materials, formatting documents for presentations, and assisting users in document editing tasks through AI-driven interactions.
How to use
To use Office-Word-MCP-Server, integrate it with your AI assistant or application that supports the Model Context Protocol. You can perform operations such as document creation, content addition, and formatting through the provided API.
Key features
Key features include document management (creating, extracting, and analyzing documents), content creation (adding headings, paragraphs, tables, and images), rich text formatting (text styling and search/replace), table formatting (custom borders and shading), and advanced document manipulation (deleting paragraphs and more).
Where to use
Office-Word-MCP-Server can be used in various fields including education, business, and content creation, where document handling and manipulation are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Office Word Mcp Server
Office-Word-MCP-Server is a Model Context Protocol (MCP) server designed for creating, reading, and manipulating Microsoft Word documents. It provides a standardized interface for AI assistants to interact with Word documents, enabling rich document editing capabilities.
Use cases
Use cases include automating report generation, creating educational materials, formatting documents for presentations, and assisting users in document editing tasks through AI-driven interactions.
How to use
To use Office-Word-MCP-Server, integrate it with your AI assistant or application that supports the Model Context Protocol. You can perform operations such as document creation, content addition, and formatting through the provided API.
Key features
Key features include document management (creating, extracting, and analyzing documents), content creation (adding headings, paragraphs, tables, and images), rich text formatting (text styling and search/replace), table formatting (custom borders and shading), and advanced document manipulation (deleting paragraphs and more).
Where to use
Office-Word-MCP-Server can be used in various fields including education, business, and content creation, where document handling and manipulation are essential.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
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
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
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 claude
Prerequisites
- 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.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
python setup_mcp.py
Usage 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.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
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_document
function to create editable copies of locked documents - Check 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 # Windows
Contributing
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.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.