by GongRzhe
A Model Context Protocol (MCP) server for creating, reading, and manipulating Microsoft Word documents, enabling AI assistants to work with Word documents through a standardized interface.
Office-Word-MCP-Server is a Model Context Protocol (MCP) server designed to facilitate the creation, reading, and manipulation of Microsoft Word documents. It acts as a bridge, allowing AI assistants to interact with Word documents via a standardized interface, offering extensive document editing capabilities.
To use Office-Word-MCP-Server, you can install it via Smithery for Claude Desktop or perform a basic installation using pip. After installation, configure Claude for Desktop by adding the server to its configuration file. You can then instruct Claude to perform various Word document operations through natural language prompts.
npx -y @smithery/cli install @GongRzhe/Office-Word-MCP-Server --client claude
git clone https://github.com/GongRzhe/Office-Word-MCP-Server.git
cd Office-Word-MCP-Server
pip install -r requirements.txt
Add the server to your Claude for Desktop configuration file (e.g., ~/Library/Application Support/Claude/claude_desktop_config.json
on macOS) with either a local installation path or by using uvx
.
Office-Word-MCP-Server offers a comprehensive set of features for managing and manipulating Word documents:
This server is ideal for scenarios where AI assistants need to interact with Word documents programmatically. Examples include:
Q: What are the prerequisites for installing Office-Word-MCP-Server? A: You need Python 3.8 or higher and the pip package manager.
Q: How can I debug issues with the server?
A: You can enable detailed logging by setting the environment variable MCP_DEBUG=1
.
Q: What are common issues and their solutions?
A: Common issues include missing styles (server attempts to create or use direct formatting), permission issues (ensure read/write access, use copy_document
), and image insertion problems (use absolute paths, verify format and size).
Q: Can I contribute to the project? A: Yes, contributions are welcome. You can fork the repository, create a feature branch, commit your changes, and open a Pull Request.
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.
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.
To install Office Word Document Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @GongRzhe/Office-Word-MCP-Server --client claude
# 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
Alternatively, you can use the provided setup script which handles:
python setup_mcp.py
{
"mcpServers": {
"word-document-server": {
"command": "python",
"args": ["/path/to/word_mcp_server.py"]
}
}
}
{
"mcpServers": {
"word-document-server": {
"command": "uvx",
"args": ["--from", "office-word-mcp-server", "word_mcp_server"]
}
}
}
Configuration file locations:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude for Desktop to load the configuration.
Once configured, you can ask Claude to perform operations like:
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)
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)
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)
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)
format_table(filename, table_index, has_header_row=None,
border_style=None, shading=None)
Missing Styles
Permission Issues
copy_document
function to create editable copies of locked documentsImage Insertion Problems
Enable detailed logging by setting the environment variable:
export MCP_DEBUG=1 # Linux/macOS
set MCP_DEBUG=1 # Windows
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
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.
Please log in to share your review and rating for this MCP.