Word MCP Server
A powerful Model Context Protocol (MCP) server for Microsoft Word integration, enabling AI assistants and automation tools to interact with Word documents across Windows and macOS platforms.
🚀 Features
- Cross-platform Support: Works on both Windows and macOS
- Document Automation: Read, write, and manipulate Word documents programmatically
- AI-Powered Workflows: Perfect for document translation, content generation, and editing
- Section-by-Section Processing: Systematically process documents paragraph by paragraph
- State Management: Intelligent tracking of processed content to avoid infinite loops
- Multiple Word Instances: Support for multiple Word documents simultaneously
📦 Installation
pip install word-mcp
Platform-Specific Requirements
Windows:
- Microsoft Word (part of Microsoft Office)
pywin32(automatically installed)
macOS:
- Microsoft Word (part of Microsoft Office)
- AppleScript support (built into macOS)
🛠️ Quick Start
1. Using uvx (Recommended)
Run the server directly without installing:
# Using the main command
uvx wordmcp
# Or the alternative command name
uvx word-mcp
# When published to PyPI, you can also use:
# uvx word-mcp
For development or local testing with a wheel file:
# Build the package first
python -m build
# Run with local wheel
uvx --from ./dist/word_mcp-1.0.0-py3-none-any.whl wordmcp
2. Command Line Usage (After Installation)
Install and run the MCP server:
pip install word-mcp
word-mcp
# or
wordmcp
3. Module Usage
Run as a Python module:
python -m word_mcp
4. Programmatic Usage
import asyncio
from word_mcp import create_server, run_server
# Create a server instance
server = create_server("my-word-server")
# Or run the server directly
run_server("my-word-server")
3. Integration with AI Assistants
The server exposes the following MCP tools that AI assistants can use:
get_selection_text- Get currently selected textreplace_selection_text- Replace selected text with new contentselect_next_section- Move to the next document sectionfind_and_select_section- Find and select text by keywordslist_word_instances- List all open Word documents
📖 Use Cases
Document Translation
Perfect for section-by-section translation workflows:
# AI assistant workflow:
# 1. select_next_section() -> finds next untranslated paragraph
# 2. get_selection_text() -> gets the content
# 3. [AI translates the text]
# 4. replace_selection_text() -> replaces with translation
# 5. Repeat until document is fully translated
Content Generation
Automate content creation and editing:
- Generate documentation from templates
- Apply consistent formatting across documents
- Bulk content updates and modifications
Document Analysis
Extract and analyze document content:
- Parse document structure
- Extract specific sections or data
- Generate summaries and reports
🔧 API Reference
Tools Available via MCP
get_selection_text
Retrieves the currently selected text from the active Word document.
Parameters:
instance_id(optional): Target specific Word instance
Returns:
{
"text": "Selected content...",
"instance_id": "word-instance-1"
}
replace_selection_text
Replaces the currently selected text with new content.
Parameters:
text: New text to insertinstance_id(optional): Target specific Word instance
Returns:
{
"success": true,
"instance_id": "word-instance-1"
}
select_next_section
Finds and selects the next section in the document.
Parameters:
section_type: Type of section ("paragraph", "heading", "any")instance_id(optional): Target specific Word instance
Returns:
{
"found": true,
"section_text": "Next section content...",
"section_type": "paragraph",
"instance_id": "word-instance-1"
}
find_and_select_section
Finds and selects a section containing specific keywords.
Parameters:
keywords: Keywords to search forsection_type: Type of section to search ininstance_id(optional): Target specific Word instance
list_word_instances
Lists all currently running Word instances.
Returns:
{
"instances": [
{
"instance_id": "word-instance-1",
"document_title": "Document1.docx",
"is_active": true
}
]
}
🔒 Security & Permissions
Windows
- Requires Microsoft Word to be installed and accessible
- Uses COM automation (requires appropriate permissions)
macOS
- Requires Microsoft Word to be installed
- Uses AppleScript (may require accessibility permissions for some operations)
- Grant permissions in System Preferences > Security & Privacy > Privacy > Accessibility
🐛 Troubleshooting
Common Issues
"No Word instances found"
- Ensure Microsoft Word is running
- Check that Word documents are open
"Platform not supported"
- Currently supports Windows and macOS only
- Linux support may be added in future versions
AppleScript permission errors (macOS)
- Grant accessibility permissions to your terminal/IDE
- System Preferences > Security & Privacy > Privacy > Accessibility
Debug Mode
Enable detailed logging:
import logging
logging.basicConfig(level=logging.DEBUG)
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/word-mcp/word-mcp.git
cd word-mcp
pip install -e ".[dev]"
Running Tests
pytest tests/
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built on the Model Context Protocol
- Inspired by the need for better AI-document integration
- Thanks to the Microsoft Office automation community
📞 Support
- 📫 Email: support@wordmcp.com
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Made with ❤️ for the AI automation community
Metadata
Release files for word-mcp 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| word_mcp-1.0.3.tar.gz | 26.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| word_mcp-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.5 kB
Release files / word_mcp-1.0.3.tar.gz
| Download URL | word_mcp-1.0.3.tar.gz |
|---|---|
| Size | 26.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3915fa6f8d00a1f4f1cd5aeaa6a0082c3fc87cd3f760d0bb6653145ba06467d
|
|
BLAKE2b-256 checksum How to use checksums |
fead58d7aa65e889e76fe30d20832f8dc9ab47c477c4734f9e4aace6d4fb1c0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / word_mcp-1.0.3-py3-none-any.whl
| Download URL | word_mcp-1.0.3-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13f2d935db00875093dad867730c45fc47c80dda0e688daf744ac2d41498d2b0
|
|
BLAKE2b-256 checksum How to use checksums |
ee44274a7e362e39c57c281a499a56fc721221a029479be8f0dc0423af35ea7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|