Content
# Office Document Processing Assistant MCP Server
This is a powerful MCP (Model Context Protocol) server designed to provide comprehensive Microsoft Office document processing capabilities. By integrating with MCP Clients (such as Claude Desktop, Cursor, etc.), it enables the creation, editing, and management of documents like Word, Excel, and PowerPoint without leaving the Client environment.
## Project Background and Objectives
During the software development process, developers often need to handle both code and documentation simultaneously. Traditional workflows require constant switching between IDEs and Office applications, which reduces efficiency. This project aims to integrate Office document processing capabilities into Cursor through the MCP protocol, allowing developers to complete all tasks within the same environment.
## Functional Requirements
### 1. Word Document Operations
#### 1.1 Document Creation and Management
- Create new Word documents, supporting specified file names and save locations
- Open existing Word documents
- Save documents (save as different formats such as .docx, .doc, .pdf)
- Close documents
#### 1.2 Content Editing
- Insert text content (supporting insertion at specified positions)
- Insert headings (supporting multi-level headings H1-H6)
- Edit existing content (find and replace, delete content)
- Format settings (font, size, color, bold, italic, underline, etc.)
- Paragraph settings (alignment, line spacing, spacing before and after)
#### 1.3 Advanced Features
- Insert images (supporting local and online images)
- Insert tables (create tables, edit cell content)
- Insert table of contents (automatically generate and update table of contents)
- Add headers and footers
- Set page layout (paper size, margins, orientation)
- Add comments and revisions
- Document merging
### 2. Excel Spreadsheet Operations
#### 2.1 Spreadsheet Creation and Management
- Create new Excel workbooks
- Open existing Excel files
- Save workbooks (supporting .xlsx, .xls, .csv formats)
- Add/delete/rename worksheets
#### 2.2 Content Editing
- Read cell content
- Write cell content (supporting text, numbers, dates, etc.)
- Clear cell content
- Set cell formatting (font, background color, borders, alignment, etc.)
- Merge/split cells
#### 2.3 Data Processing
- Insert/delete rows and columns
- Data sorting (ascending/descending)
- Data filtering
- Create pivot tables
- Set data validation
- Set conditional formatting
- Batch data processing (bulk fill, bulk replace)
#### 2.4 Formulas and Functions
- Insert basic calculation formulas (addition, subtraction, multiplication, division)
- Insert advanced functions (SUM, AVERAGE, COUNT, IF, VLOOKUP, etc.)
- Create and edit charts (bar charts, line charts, pie charts, etc.)
### 3. PowerPoint Presentation Operations
#### 3.1 Presentation Creation and Management
- Create new PowerPoint presentations
- Open existing presentations
- Save presentations (supporting .pptx, .ppt, .pdf formats)
#### 3.2 Slide Operations
- Add new slides (supporting different layouts)
- Delete slides
- Adjust slide order
- Set slide themes and backgrounds
#### 3.3 Content Editing
- Add text boxes and edit text content
- Insert images and shapes
- Insert tables and charts
- Add animation effects (entrance, emphasis, exit)
- Set slide transition effects
- Add notes
### 4. General Features
#### 4.1 File Management
- Batch create documents
- Rename files
- Copy and move files
- File format conversion (interconversion between Office formats, convert to PDF, etc.)
#### 4.2 Template Functionality
- Provide commonly used document templates (resumes, reports, forms, etc.)
- Save custom templates
- Create new documents based on templates
#### 4.3 Advanced Features
- OCR recognition (extract text from images)
- Document comparison (compare differences between two documents)
- Document translation
- Document encryption and decryption
- Import and export table data (interact with databases)
## Technical Requirements
### 1. System Compatibility
- Supports Windows operating system
- Supports macOS operating system (optional)
- Supports Linux operating system (optional)
### 2. Dependency Conditions
- Microsoft Office or compatible components must be installed locally by the user
- Python 3.7+
- MCP Python SDK
### 3. Security and Permissions
- Document operations require explicit user authorization
- Sensitive operations require confirmation mechanisms
- Supports read-only mode operations
### 4. Performance Requirements
- Response time: routine operations ≤ 1 second
- Large document processing ≤ 5 seconds
- Batch operation progress visualization
## User Experience
### 1. Interaction Methods
- Operate through natural language commands (e.g., "Create a Word document named 'Quarterly Report' on the desktop")
- Support compound commands (e.g., "Create an Excel spreadsheet, insert sales data, and generate a bar chart")
- Support context-related operations (e.g., "Insert a new row below the previous cell")
### 2. Error Handling
- Provide clear error messages
- Suggest solutions
- Support operation undo
### 3. Accessibility Features
- Operation history
- Common operation shortcut commands
- Batch processing script support
## Implementation Phases
### Phase One: Basic Framework (Completed)
- ✅ Built the basic framework for the MCP server
- ✅ Achieved successful integration with Cursor
- ✅ Verified basic functionality (simple TXT file creation)
### Phase Two: Basic Word Document Functions (Completed)
- ✅ Implemented creation, opening, and saving of Word documents
- ✅ Basic text editing functions
- ✅ Simple formatting settings
### Phase Three: Basic Excel Functions
- ✅ Implemented creation, opening, and saving of Excel workbooks
- ✅ Read and write cell content
- ✅ Basic formatting settings
### Phase Four: Basic PowerPoint Functions
- ✅ Implemented creation, opening, and saving of PowerPoint presentations
- ✅ Slide management
- ✅ Basic content editing
### Phase Five: Advanced Features and Optimization
- ✅ Implemented advanced features for each application
- ✅ Performance optimization
- ✅ Enhanced user experience
## Configuration Method
### Configure in Cursor (Method 1: UI Configuration)
1. Open Cursor
2. Go to Settings > Features > MCP
3. Click "+ Add New MCP Server"
4. Fill in the configuration information:
- Name: `Office Assistant` (modifiable as per preference)
- Type: Select `stdio`
- Command: Enter the full path to run the server, for example:
```
python /path/to/office_server.py
```
Make sure to replace it with your actual file path.
### Configure in Cursor (Method 2: JSON Configuration File, Recommended)
1. Create a `.cursor` folder in the project directory (if it doesn't exist)
2. Create a `mcp.json` file in that folder with the following content:
```json
{
"mcpServers": {
"office-assistant": {
"command": "python",
"args": ["/path/to/office_server.py"],
"env": {}
}
}
}
```
Make sure to replace `/path/to/office_server.py` with your actual file path.
3. Restart Cursor to apply the configuration.
## License
[MIT License](LICENSE)