Content
# word_mcp: Word Document MCP Server
## Overview
A Model Context Protocol (MCP) server for operating and processing Word documents.
This server provides a range of tools for creating, editing, and converting Word documents, supporting format conversion, complex text search and replace, document merging, data extraction, document comparison, and document quality assessment functions.

## Example


## Tools
1. `create_txt_file`
- Create a new TXT file
2. `create_word_document`
- Create a new Word document
3. `read_word_document`
- Read content from a Word document
4. `get_word_document_info`
- Query basic information of a Word document
5. `add_text_to_word_document`
- Add text content to a Word document
6. `set_paragraph_format`
- Set the text format of a specified paragraph in a Word document
7. `set_paragraph_spacing`
- Set the spacing of a specified paragraph in a Word document
8. `insert_image_into_word_document`
- Insert an image into a Word document
9. `insert_table_into_word_document`
- Insert a table into a Word document
10. `edit_table_cell`
- Edit the content of a table cell in a Word document
11. `save_word_as_pdf`
- Save a Word document as a PDF file
12. `convert_word_to_format`
- Convert a Word document to a specified format file, supporting formats include ["docx", "pdf", "txt", "html"]
13. `convert_to_word`
- Convert a specified format file to a Word document, supporting formats include ["docx", "pdf", "txt", "html"]
14. `close_word_document`
- Close a Word document, with an option to save changes
15. `edit_paragraph_text`
- Edit the text content of a specified paragraph in a Word document
16. `find_and_replace_text`
- Find and replace text in a Word document
17. `delete_paragraph`
- Delete a specified paragraph in a Word document
18. `insert_table_of_contents`
- Insert a table of contents in a Word document
19. `add_header_and_footer`
- Add headers and footers to a Word document
20. `set_page_layout`
- Set the page layout of a Word document
21. `merge_word_documents`
- Merge multiple Word documents
22. `complex_query_document`
- Perform complex queries on a Word document (not limited to text)
23. `complex_replace_document`
- Perform complex replacements in a Word document
24. `extract_document_info`
- Document extraction function
- Helper functions: `save_to_json`, `save_to_csv`
- Paragraph extraction: Extract various paragraphs from the document and convert them into structured data format
- Table extraction: Extract tables from the document and convert them into structured data format
- Image extraction: Extract images from the document and convert them into structured data format
- Title extraction: Extract various levels of titles from the document
- Text extraction: Extract text content from the document
- Keyword extraction: Extract keywords from the document
25. `compare_documents`
- Document comparison function
- Document comparison: Compare the content differences between two or more documents, identifying additions, deletions, or modifications
- Consistency check: Check the consistency between multiple documents
26. `assess_document_quality`
- Document quality assessment function
- Helper functions: `calculate_readability`, `count_syllables`
- Readability assessment: Assess the readability of the document, identifying complex sentences and paragraphs
- Consistency assessment: Assess the consistency of formatting and content within the document
## Installation
1. Clone the MCP server code repository to your local machine:
```bash
git clone https://github.com/M87shaonv/word_mcp.git
cd word_mcp
```
2. Install dependencies
Use pip/pip3 to install the required Python packages:
```bash
pip install -e project_path
pip3 install -e project_path
```
3. Configure environment variables (optional)
You can configure the following environment variables to customize server behavior:
| Variable Name | Description | Default Value |
|---------------------|--------------------------------------|------------------|
| `WORD_MCP_PATH` | Default directory for file operations (e.g., location to save documents) | User's Desktop |
Linux/Mac
```bash
# Permanently set environment variables
nano ~/.bashrc
# Add the following content at the end of the file
export WORD_MCP_PATH="/path/to/output"
# Refresh environment variables
source ~/.bashrc
```
Windows
```bash
# Set system-level environment variables
set WORD_MCP_PATH="C:\path\to\output" /M
```
4. Start the server
Use the following command to start the MCP server and test if it is running properly:
```bash
# Start the server
python word_mcp.py
# If there is a module import error when starting the server, try updating dependencies with the following command:
uv run word_mcp.py
# Use the mcp command to start the server and access it in the browser to test if it is running properly
mcp dev word_mcp.py
```
Note: If you are using a virtual environment, please ensure to activate it before starting the server.
To configure the mcp server, directly add to the `cline_mcp_setting.json` file:
```bash
#
"wordmcp": {
"command": "uv",
"args": [
"--directory",
"path_to_downloaded_word_mcp_project",
"run",
"word_mcp.py"
]
}
```
Connection Info
You Might Also Like
Time
Obtaining current time information and converting time between different...
bytebot
Bytebot is a self-hosted AI desktop agent that automates computer tasks...
inbox-zero
The world's best AI personal assistant for email. Open source app to help...
DesktopCommanderMCP
This is MCP server for Claude that gives it terminal control, file system...
ClaudeComputerCommander
This is an MCP server that provides terminal control, file system search,...
astron-rpa
Agent-ready RPA suite with out-of-the-box automation tools. Built for...