https://github.com/ildunari/enhanced-word

https://github.com/ildunari/enhanced-word

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: ildunari
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 1.04 MB
Statistics
  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • Open Issues: 3
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

Enhanced Word Document MCP Server

smithery badge

A powerful, consolidated Model Context Protocol (MCP) server for creating, reading, and manipulating Microsoft Word documents. This enhanced version provides 22 optimized tools (reduced from 47) for comprehensive Word document operations through a standardized interface.

Office Word Server MCP server

Overview

Enhanced-Word-MCP-Server implements the Model Context Protocol with a focus on consolidation and efficiency. It provides 22 powerful tools that replace 47 individual functions, offering:

  • 53% tool reduction while preserving all functionality
  • Consolidated operations for better usability
  • Enhanced functionality with regex support and advanced formatting
  • Academic and professional workflow optimization
  • Comprehensive error handling and validation

Example Usage

Creating Academic Documents

```python

Create document with proper structure

create_document("thesis.docx", title="AI in Healthcare", author="John Doe")

Add structured content

addtextcontent("thesis.docx", "Introduction", contenttype="heading", level=1) addtextcontent("thesis.docx", "This paper explores...", contenttype="paragraph")

Add references and notes

addnote("thesis.docx", paragraphindex=0, notetext="See methodology section", notetype="footnote") ```

Features Overview

🎯 Consolidated Tools (6 Tools)

Unified operations that replace multiple individual functions:

  • get_text - Unified text extraction (replaces 3 tools)
  • manage_track_changes - Track changes management (replaces 2 tools)
  • add_note - Footnote/endnote creation (replaces 2 tools)
  • add_text_content - Paragraph/heading creation (replaces 2 tools)
  • get_sections - Section extraction (replaces 2 tools)
  • manage_protection - Document protection (replaces 2 tools)

📄 Essential Document Tools (7 Tools)

Core document management functionality:

  • Document Lifecycle: create_document, copy_document, merge_documents
  • Content Operations: enhanced_search_and_replace, add_table, add_picture
  • Export: convert_to_pdf

🔧 Advanced Features (5 Tools)

Specialized functionality for professional workflows:

  • Collaboration: manage_comments, extract_track_changes, generate_review_summary
  • Document Structure: generate_table_of_contents
  • Security: add_digital_signature, verify_document

Key Enhancements

🚀 Enhanced Search & Replace

  • Regex support for complex pattern matching
  • Case-insensitive search options
  • Whole word matching
  • Advanced formatting application to replaced text
  • Group substitutions for regex patterns

```python

Regex date format conversion

enhancedsearchandreplace("doc.docx", findtext=r"(\d{4})-(\d{2})-(\d{2})", replacetext=r"$2/$3/$1", useregex=True)

Case-insensitive formatting

enhancedsearchandreplace("doc.docx", findtext="important", replacetext="CRITICAL", matchcase=False, apply_formatting=True, bold=True, color="red") ```

📝 Unified Text Extraction

```python

Extract full document with formatting

gettext("doc.docx", scope="document", includeformatting=True)

Search within document

gettext("doc.docx", scope="search", searchterm="methodology", match_case=False)

Extract specific paragraph

gettext("doc.docx", scope="paragraph", paragraphindex=5) ```

📑 Flexible Section Management

```python

Extract all sections with formatting

getsections("doc.docx", extractiontype="all", include_formatting=True)

Get specific section content

getsections("doc.docx", extractiontype="specific", section_title="Results") ```

🔒 Advanced Protection Management

```python

Password protection

manageprotection("doc.docx", action="protect", protectiontype="password", password="secure123")

Read-only protection with exceptions

manageprotection("doc.docx", action="protect", protectiontype="editing", allowed_editing="comments", password="review123") ```

Installation

NPX Installation (Recommended)

```bash

Install via NPX (latest version)

npx enhanced-word-mcp-server

Or install globally

npm install -g enhanced-word-mcp-server ```

Python Dependencies

The server requires Python 3.10+ with the following dependencies:

```bash

Install Python dependencies (including MCP with CLI support)

pip install mcp[cli] python-docx msoffcrypto-tool docx2pdf

Or install from requirements.txt if cloning the repository

pip install -r requirements.txt ```

Add to Claude Desktop

Add to your claude_desktop_config.json:

json { "mcpServers": { "word-mcp": { "command": "npx", "args": ["enhanced-word-mcp-server"] } } }

Manual Installation

```bash

Clone repository

git clone https://github.com/your-username/enhanced-word-mcp-server.git cd enhanced-word-mcp-server

Install dependencies

npm install

Global installation

npm install -g . ```

Usage Examples

Academic Writing Workflow

```python

Create research paper structure

createdocument("researchpaper.docx", title="Machine Learning Analysis", author="Dr. Smith")

Add structured content

addtextcontent("researchpaper.docx", "Abstract", contenttype="heading", level=1) addtextcontent("researchpaper.docx", "This study examines...", contenttype="paragraph", style="Normal", position="end")

Add citations and notes

addnote("researchpaper.docx", paragraphindex=1, notetext="See Smith et al. (2023) for detailed methodology", note_type="footnote")

Format academic terms

formatresearchpaperterms("researchpaper.docx")

Extract sections for review

sections = getsections("researchpaper.docx", extractiontype="all", maxlevel=2) ```

Document Review Workflow

```python

Extract all review elements

comments = extractcomments("draft.docx") changes = extracttrack_changes("draft.docx")

Generate comprehensive review summary

summary = generatereviewsummary("draft.docx")

Manage track changes selectively

managetrackchanges("draft.docx", action="accept", changetype="insertions") managetrackchanges("draft.docx", action="reject", changetype="deletions", author="Reviewer1") ```

Document Security Workflow

```python

Apply comprehensive protection

manageprotection("confidential.docx", action="protect", protectiontype="password", password="secure123")

Add digital signature

adddigitalsignature("contract.docx", signer_name="John Doe", reason="Document approval")

Verify document integrity

verification = verify_document("contract.docx") ```

Tool Reference

Consolidated Tools

get_text(filename, scope, **options)

Unified text extraction with multiple modes: - scope: "document" | "paragraph" | "search" | "range" - include_formatting: Extract formatting information - search_term: Text to search for (when scope="search") - paragraph_index: Specific paragraph (when scope="paragraph")

manage_track_changes(filename, action, **filters)

Comprehensive track changes management: - action: "accept" | "reject" | "extract" - change_type: "all" | "insertions" | "deletions" | "formatting" - author: Filter by specific author - date_range: Filter by date range

add_note(filename, paragraph_index, note_text, note_type, **options)

Unified footnote/endnote creation: - note_type: "footnote" | "endnote" - custom_symbol: Use custom reference symbol - position: Note positioning options

add_text_content(filename, text, content_type, **options)

Unified content creation: - content_type: "paragraph" | "heading" - level: Heading level (1-6) - style: Apply document style - position: "start" | "end" | specific index

get_sections(filename, extraction_type, **options)

Advanced section extraction: - extraction_type: "all" | "specific" | "bylevel" - `sectiontitle: Specific section to extract -maxlevel: Maximum heading level -includeformatting`: Preserve formatting

manage_protection(filename, action, **options)

Document protection management: - action: "protect" | "unprotect" | "check" - protection_type: "password" | "editing" | "readonly" - password: Protection password - allowed_editing: Editing permissions

Error Handling

All tools provide comprehensive error handling:

```python

Typical error responses

{ "status": "error", "message": "Document not found: nonexistent.docx", "error_type": "FileNotFoundError", "suggestions": ["Check file path", "Ensure file exists"] } ```

Development

Project Structure

enhanced-word-mcp-server/ ├── word_document_server/ │ ├── main.py # MCP server entry point │ ├── tools/ # Tool implementations │ │ ├── document_tools.py # Document management │ │ ├── content_tools.py # Content creation │ │ ├── review_tools.py # Review and collaboration │ │ ├── section_tools.py # Document structure │ │ ├── protection_tools.py # Security features │ │ └── footnote_tools.py # Notes and references │ └── utils/ # Utility modules ├── bin/ │ └── enhanced-word-mcp-server.js # NPX entry point ├── package.json └── README.md

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Testing

```bash

Run test suite

python testenhancedfeatures.py

Test specific functionality

python -c "from worddocumentserver.tools.contenttools import enhancedsearchandreplace; print(enhancedsearchand_replace('test.docx', 'old', 'new'))" ```

License

MIT License - see LICENSE file for details.

Version History

v2.0.0 (Enhanced)

  • 🎯 53% tool reduction (47 → 22 tools)
  • 🚀 Enhanced search & replace with regex support
  • 📝 Consolidated operations for better usability
  • 🔧 Improved error handling and validation
  • 📚 Comprehensive documentation with examples

v1.0.0 (Original)

  • Initial release with 47 individual tools
  • Basic Word document operations
  • Simple MCP server implementation

Support

For issues, feature requests, or questions: - 📧 Create an issue on GitHub - 📖 Check the documentation and examples - 🔍 Review error messages for troubleshooting guidance

Owner

  • Login: ildunari
  • Kind: user

GitHub Events

Total
  • Delete event: 7
  • Push event: 29
  • Pull request event: 24
  • Create event: 15
Last Year
  • Delete event: 7
  • Push event: 29
  • Pull request event: 24
  • Create event: 15

Packages

  • Total packages: 1
  • Total downloads:
    • npm 68 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 32
  • Total maintainers: 1
npmjs.org: enhanced-word-mcp-server

Enhanced Word MCP server with comprehensive document operations. Features 24 consolidated tools, regex positioning fixes, and complete Word document manipulation capabilities.

  • Versions: 32
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 68 Last month
Rankings
Dependent repos count: 24.4%
Average: 29.9%
Dependent packages count: 35.3%
Maintainers (1)
Last synced: 10 months ago

Dependencies

Dockerfile docker
  • python 3.11-slim build
package.json npm
pyproject.toml pypi
  • docx2pdf >=0.1.8
  • mcp [cli]>=1.3.0
  • msoffcrypto-tool >=5.4.2
  • python-docx >=0.8.11
requirements.txt pypi
  • docx2pdf *
  • lxml >=4.6.0
  • mcp *
  • msoffcrypto-tool *
  • packaging >=21.0
  • python-docx *
uv.lock pypi
  • annotated-types 0.7.0
  • anyio 4.9.0
  • appscript 1.3.0
  • certifi 2025.1.31
  • cffi 1.17.1
  • click 8.1.8
  • colorama 0.4.6
  • cryptography 44.0.2
  • docx2pdf 0.1.8
  • h11 0.14.0
  • httpcore 1.0.8
  • httpx 0.28.1
  • httpx-sse 0.4.0
  • idna 3.10
  • lxml 5.4.0
  • markdown-it-py 3.0.0
  • mcp 1.6.0
  • mdurl 0.1.2
  • msoffcrypto-tool 5.4.2
  • office-word-mcp-server 1.1.0
  • olefile 0.47
  • pycparser 2.22
  • pydantic 2.11.3
  • pydantic-core 2.33.1
  • pydantic-settings 2.9.1
  • pygments 2.19.1
  • python-docx 1.1.2
  • python-dotenv 1.1.0
  • pywin32 310
  • rich 14.0.0
  • shellingham 1.5.4
  • sniffio 1.3.1
  • sse-starlette 2.3.3
  • starlette 0.46.2
  • tqdm 4.67.1
  • typer 0.15.2
  • typing-extensions 4.13.2
  • typing-inspection 0.4.0
  • uvicorn 0.34.2