npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

enhanced-word-mcp-server-live

v1.0.1

Published

Enhanced Word MCP server with live editing capabilities. Features real-time Word document collaboration via WebSocket, Office Add-in integration, and comprehensive document operations with regex positioning fixes.

Readme

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 24 optimized tools (reduced from 47) for comprehensive Word document operations through a standardized interface.

Overview

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

  • 48% 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

# Create document with proper structure
create_document("thesis.docx", title="AI in Healthcare", author="John Doe")

# Add structured content
add_text_content("thesis.docx", "Introduction", content_type="heading", level=1)
add_text_content("thesis.docx", "This paper explores...", content_type="paragraph")

# Add references and notes
add_note("thesis.docx", paragraph_index=0, note_text="See methodology section", note_type="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 (10 Tools)

Core document management functionality:

  • Document Lifecycle: create_document, copy_document, merge_documents
  • Document Analysis: get_document_info, get_document_outline, list_available_documents
  • Content Operations: enhanced_search_and_replace, add_table, add_picture
  • Export: convert_to_pdf

🔧 Advanced Features (8 Tools)

Specialized functionality for professional workflows:

  • Academic Formatting: format_specific_words, format_research_paper_terms
  • Collaboration: extract_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
# Regex date format conversion
enhanced_search_and_replace("doc.docx", 
    find_text=r"(\d{4})-(\d{2})-(\d{2})", 
    replace_text=r"$2/$3/$1", 
    use_regex=True)

# Case-insensitive formatting
enhanced_search_and_replace("doc.docx", 
    find_text="important", 
    replace_text="CRITICAL",
    match_case=False, 
    apply_formatting=True, 
    bold=True, color="red")

📝 Unified Text Extraction

# Extract full document with formatting
get_text("doc.docx", scope="document", include_formatting=True)

# Search within document
get_text("doc.docx", scope="search", search_term="methodology", match_case=False)

# Extract specific paragraph
get_text("doc.docx", scope="paragraph", paragraph_index=5)

📑 Flexible Section Management

# Extract all sections with formatting
get_sections("doc.docx", extraction_type="all", include_formatting=True)

# Get specific section content
get_sections("doc.docx", extraction_type="specific", section_title="Results")

🔒 Advanced Protection Management

# Password protection
manage_protection("doc.docx", action="protect", protection_type="password", password="secure123")

# Read-only protection with exceptions
manage_protection("doc.docx", action="protect", protection_type="editing", 
                 allowed_editing="comments", password="review123")

Installation

NPX Installation (Recommended)

# Install via NPX (latest version)
npx enhanced-word-mcp-server

# Or install globally
npm install -g enhanced-word-mcp-server

Add to Claude Desktop

Add to your claude_desktop_config.json:

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

Manual Installation

# 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

# Create research paper structure
create_document("research_paper.docx", title="Machine Learning Analysis", author="Dr. Smith")

# Add structured content
add_text_content("research_paper.docx", "Abstract", content_type="heading", level=1)
add_text_content("research_paper.docx", "This study examines...", content_type="paragraph", 
                style="Normal", position="end")

# Add citations and notes
add_note("research_paper.docx", paragraph_index=1, 
         note_text="See Smith et al. (2023) for detailed methodology", 
         note_type="footnote")

# Format academic terms
format_research_paper_terms("research_paper.docx")

# Extract sections for review
sections = get_sections("research_paper.docx", extraction_type="all", max_level=2)

Document Review Workflow

# Extract all review elements
comments = extract_comments("draft.docx")
changes = extract_track_changes("draft.docx")

# Generate comprehensive review summary
summary = generate_review_summary("draft.docx")

# Manage track changes selectively
manage_track_changes("draft.docx", action="accept", change_type="insertions")
manage_track_changes("draft.docx", action="reject", change_type="deletions", author="Reviewer1")

Document Security Workflow

# Apply comprehensive protection
manage_protection("confidential.docx", action="protect", 
                 protection_type="password", password="secure123")

# Add digital signature
add_digital_signature("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" | "by_level"
  • section_title: Specific section to extract
  • max_level: Maximum heading level
  • include_formatting: 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:

# 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

# Run test suite
python test_enhanced_features.py

# Test specific functionality
python -c "from word_document_server.tools.content_tools import enhanced_search_and_replace; print(enhanced_search_and_replace('test.docx', 'old', 'new'))"

License

MIT License - see LICENSE file for details.

Version History

v2.0.0 (Enhanced)

  • 🎯 48% tool reduction (47 → 24 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