Skip to content
Back to search

office-editor-mcp

基于MCP(Model Context Protocol)的Office文档处理助手,支持在MCP Client中创建和编辑Word、Excel、Powerpoint文档。

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/thewdy--office-editor-mcp/badge.svg)](/listings/thewdy--office-editor-mcp)

HTML

<a href="/listings/thewdy--office-editor-mcp"><img src="/api/listings/thewdy--office-editor-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Prerequisites

- Python 3.10 or higher - pip package manager - Microsoft Office is only required for Windows COM features such as PDF export, animations, transitions, and legacy Office formats - Tesseract OCR is required when using `ocr_recognize_text`

Basic Installation

# Clone the repository
git clone https://github.com/theWDY/office-editor-mcp.git
cd office-editor-mcp

# Install dependencies
pip install -r requirements.txt

The repository exposes four independent MCP servers: `word_server.py`, `excel_server.py`, `powerpoint_server.py`, and `general_server.py`. Configure only the servers you need. The checked-in `.cursor/mcp.json` contains a complete four-server example.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 308 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Office Document Processing MCP Server
  2. [![EN](https://img.shields.io/badge/Language-English-blue)](README.md)
  3. [![CN](https://img.shields.io/badge/语言-中文-red)](README_CN.md)
  4. ![MCP Server](https://img.shields.io/badge/MCP-Server-blue)
  5. ![Python](https://img.shields.io/badge/Python-3.7+-green)
  6. ![License](https://img.shields.io/badge/License-MIT-yellow)
  7. An MCP (Model Context Protocol) server for Office document processing, enabling creation and editing of Word, Excel, and PowerPoint documents within MCP Clients without leaving the AI assistant environment.
  8. ## Overview
  9. Office-Editor-MCP implements the [Model Context Protocol](https://modelcontextprotocol.io/) standard to expose Office document operations as tools and resources. It serves as a bridge between AI assistants and Microsoft Office documents, allowing you to create, edit, format, and analyze various Office documents through AI assistants.
  10. <!-- Suggestion: Add usage screenshots here -->
  11. ## Features
  12. ### Word Document Operations
  13. #### Document Management
  14. - Create new Word documents with metadata (title, author, etc.)
  15. - Extract text content and analyze document structure
  16. - View document properties and statistics
  17. - List available documents in a directory
  18. - Create document copies
  19. #### Content Creation
  20. - Add headings with different levels
  21. - Insert paragraphs with optional styling
  22. - Create tables with custom data
  23. - Add images with proportional scaling
  24. - Insert page breaks
  25. #### Text Formatting
  26. - Format specific text sections (bold, italic, underline)
  27. - Change text color and font properties
  28. - Apply custom styles to text elements
  29. - Search and replace text throughout documents
  30. ### Excel Operations
  31. #### Workbook Management
  32. - Create new Excel workbooks
  33. - Open existing Excel files
  34. - Add/delete/rename worksheets
  35. #### Data Processing
  36. - Read and write cell contents
  37. - Insert/delete rows and columns
  38. - Sort and filter data
  39. - Apply formulas and functions
  40. ### PowerPoint Operations
  41. #### Presentation Management
  42. - Create new PowerPoint presentations
  43. - Add/delete/rearrange slides
  44. - Set slide themes and backgrounds
  45. #### Content Editing
  46. - Add text and graphic elements
  47. - Insert tables and charts
  48. - Add animations and transitions
  49. ### Advanced Features
  50. - OCR recognition (extract text from images)
  51. - Document comparison (compare differences between documents)
  52. - Document translation
  53. - Document encryption and decryption
  54. - Table data import/export (database interaction)
  55. ## Installation Guide
  56. ### Prerequisites
  57. - Python 3.10 or higher
  58. - pip package manager
  59. - Microsoft Office is only required for Windows COM features such as PDF export,
  60. animations, transitions, and legacy Office formats
  61. - Tesseract OCR is required when using `ocr_recognize_text`
  62. ### Basic Installation
  63. ```bash
  64. # Clone the repository
  65. git clone https://github.com/theWDY/office-editor-mcp.git
  66. cd office-editor-mcp
  67. # Install dependencies
  68. pip install -r requirements.txt
  69. ```
  70. The repository exposes four independent MCP servers: `word_server.py`,
  71. `excel_server.py`, `powerpoint_server.py`, and `general_server.py`. Configure
  72. only the servers you need. The checked-in `.cursor/mcp.json` contains a complete
  73. four-server example.
  74. ## Configuration
  75. ### Configuration in Cursor
  76. #### Method 1: UI Configuration
  77. 1. Open Cursor
  78. 2. Go to Settings > Features > MCP
  79. 3. Click "+ Add New MCP Server"
  80. 4. Fill in the configuration information:
  81. - Name: `Office Assistant` (modify as preferred)
  82. - Type: Select `stdio`
  83. - Command: Enter the full path to run the server, for example:
  84. ```
  85. python /path/to/office-editor-mcp/word_server.py
  86. ```
  87. Note: Replace with your actual file path
  88. #### Method 2: JSON Configuration File (Recommended)
  89. 1. Create a `.cursor` folder in the project directory (if it doesn't exist)
  90. 2. Create an `mcp.json` file in that folder with the following content:
  91. ```json
  92. {
  93. "mcpServers": {
  94. "office-assistant": {
  95. "command": "python",
  96. "args": ["/path/to/office-editor-mcp/word_server.py"],
  97. "env": {"OFFICE_EDIT_PATH": "/path/to/output"}
  98. }
  99. }
  100. }
  101. ```
  102. ### Configuration in Claude for Desktop
  103. 1. Edit the Claude configuration file:
  104. - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
  105. - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
  106. 2. Add the following configuration:
  107. ```json
  108. {
  109. "mcpServers": {
  110. "office-document-server": {
  111. "command": "python",
  112. "args": [
  113. "/path/to/office-editor-mcp/word_server.py"
  114. ]
  115. }
  116. }
  117. }
  118. ```
  119. 3. Restart Claude to apply the configuration.
  120. All paths handled by `general_server.py` must stay inside `OFFICE_EDIT_PATH`.
  121. Move and delete operations are disabled unless
  122. `OFFICE_ALLOW_DESTRUCTIVE=true` is explicitly configured.
  123. New encrypted files use a versioned Fernet container with a random salt and
  124. Scrypt password derivation. Existing encrypted files remain readable and can be
  125. re-encrypted to upgrade them. Batch operations are limited to 100 files and 16
  126. workers per request.
  127. ## Usage Examples
  128. After configuration, you can issue commands to your AI assistant like:
  129. ### Word Document Operations
  130. - "Create a new document called 'quarterly_report.docx' with a title page"
  131. - "Add a heading and three paragraphs to the document"
  132. - "Insert a 4x4 table with sales data"
  133. - "Make the word 'important' in paragraph 2 bold and red"
  134. - "Search and replace all instances of 'old term' with 'new term'"
  135. ### Excel Operations
  136. - "Create a new Excel workbook named 'financial_analysis.xlsx'"
  137. - "Insert 'Quarterly Sales' as a title in cell A1"
  138. - "Create a table with department sales data and calculate the sum"
  139. - "Create a bar chart for the sales data"
  140. - "Sort the data in column B in descending order"
  141. ### PowerPoint Operations
  142. - "Create a presentation named 'project_presentation.pptx'"
  143. - "Add a new slide with the title 'Project Overview'"
  144. - "Insert the company logo in slide 2"
  145. - "Add a fly-in animation to the title"
  146. ## API Reference
  147. ### Word Document Operations
  148. ```python
  149. # Document Creation and Properties
  150. create_document(filename, title=None, author=None)
  151. get_document_info(filename)
  152. get_document_text(filename)
  153. get_document_outline(filename)
  154. list_available_documents(directory=".")
  155. copy_document(source_filename, destination_filename=None)
  156. # Content Addition
  157. add_heading(filename, text, level=1)
  158. add_paragraph(filename, text, style=None)
  159. add_table(filename, rows, cols, data=None)
  160. add_picture(filename, image_path, width=None)
  161. add_page_break(filename)
  162. # Text Formatting
  163. format_text(filename, paragraph_index, start_pos, end_pos, bold=None,
  164. italic=None, underline=None, color=None, font_size=None, font_name=None)
  165. search_and_replace(filename, find_text, replace_text)
  166. delete_paragraph(filename, paragraph_index)
  167. create_custom_style(filename, style_name, bold=None, italic=None,
  168. font_size=None, font_name=None, color=None, base_style=None)
  169. ```
  170. ### Excel Operations
  171. ```python
  172. # Workbook Operations
  173. create_workbook(filename)
  174. open_workbook(filename)
  175. save_workbook(filename, new_filename=None)
  176. add_worksheet(filename, sheet_name=None)
  177. list_worksheets(filename)
  178. # Cell Operations
  179. read_cell(filename, sheet_name, cell_reference)
  180. write_cell(filename, sheet_name, cell_reference, value)
  181. format_cell(filename, sheet_name, cell_reference, **format_args)
  182. ```
  183. ### PowerPoint Operations
  184. ```python
  185. # Presentation Operations
  186. create_presentation(filename)
  187. open_presentation(filename)
  188. save_presentation(filename, new_filename=None)
  189. add_slide(filename, layout=None)
  190. ```
  191. ## Troubleshooting
  192. ### Common Issues
  193. 1. **Missing Styles**
  194. - Some documents may lack required styles for heading and table operations
  195. - The server will attempt to create missing styles or use direct formatting
  196. - For best results, use templates with standard Office styles
  197. 2. **Permission Issues**
  198. - Ensure the server has permission to read/write to document paths
  199. - Use the `copy_document` function to create editable copies of locked documents
  200. - Check file ownership and permissions if operations fail
  201. 3. **Image Insertion Problems**
  202. - Use absolute paths for image files
  203. - Verify image format compatibility (JPEG, PNG recommended)
  204. - Check image file size and permissions
  205. ### Debugging
  206. Enable detailed logging by setting the environment variable:
  207. ```bash
  208. export MCP_DEBUG=1 # Linux/macOS
  209. set MCP_DEBUG=1 # Windows
  210. ```
  211. ## Implementation Progress
  212. - ✅ Build MCP server basic framework
  213. - ✅ Successful integration with AI assistants
  214. - ✅ Basic Word document operations
  215. - ✅ Basic Excel workbook operations
  216. - ✅ Basic PowerPoint presentation operations
  217. - ✅ Advanced features enhancement
  218. - ✅ Performance optimization
  219. - ✅ Cross-platform compatibility testing
  220. ## Contributing
  221. Contributions are welcome! Feel free to submit a Pull Request.
  222. 1. Fork the repository
  223. 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
  224. 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
  225. 4. Push to the branch (`git push origin feature/amazing-feature`)
  226. 5. Open a Pull Request
  227. ## License
  228. This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
  229. ## Acknowledgments
  230. - [Model Context Protocol](https://modelcontextprotocol.io/) for protocol specification
  231. - [python-docx](https://python-docx.readthedocs.io/) for Word document processing
  232. - [openpyxl](https://openpyxl.readthedocs.io/) for Excel processing
  233. - [python-pptx](https://python-pptx.readthedocs.io/) for PowerPoint processing
  234. ---
  235. *Note: This server interacts with document files on your system. Always verify that requested operations are appropriate before confirming them in AI assistants or other MCP clients.*

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.