Word Document Reader MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Word Document Reader MCP Server read the quarterly report at /docs/reports/q3-2024.docx and extract all tables"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Word Document Reader MCP Server
A powerful Word document reading MCP server with table extraction, image OCR analysis, large document optimization, and intelligent caching.
๐ Core Features
1. Document Content Extraction
โ Word document (.docx/.doc) text extraction
โ Support for mixed Chinese-English documents
โ Preserve original formatting and structure
2. Table Extraction
โ Automatically identify and extract tables from Word documents
โ Convert to structured data format
โ Preserve table row/column structure information
โ Support complex table parsing
3. Image OCR Analysis
โ Extract embedded images from Word documents
โ High-precision OCR recognition using Tesseract.js v5
โ Support mixed Chinese-English text recognition (95%+ accuracy)
โ Intelligent image preprocessing for better recognition
โ Support multiple image formats (JPG, PNG, GIF, BMP, WebP)
4. Large Document Optimization
โ Automatic detection of large documents (>10MB or >100 pages)
โ Worker thread parallel processing, utilizing multi-core CPUs
โ Chunked processing to avoid memory overflow
โ 60%+ speed improvement
5. Intelligent Caching System
โ File system persistent caching
โ Smart cache invalidation based on file modification time
โ Cache statistics and management support
โ 90%+ speed improvement for repeated document processing
6. Full-text Index Search
โ Millisecond-level search with inverted index
โ Intelligent Chinese-English word segmentation
โ Relevance scoring and sorting
โ Support document type filtering
Related MCP server: Document Reader MCP Server
๐ฆ Installation and Usage
1. Install Dependencies
npm install2. Start Server
# Start full-featured version
npm start
# Or start basic version (without advanced features)
npm run start:basic3. Run Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate test coverage report
npm run test:coverageread_word_document
Read and analyze Word documents
{
"name": "read_word_document",
"arguments": {
"filePath": "path/to/document.docx",
"memoryKey": "my-document",
"documentType": "api-doc",
"extractTables": true,
"extractImages": true,
"useCache": true,
"outputDir": "./output"
}
}search_documents
Full-text index search
{
"name": "search_documents",
"arguments": {
"query": "search keywords",
"documentType": "api-doc",
"limit": 10
}
}get_cache_stats
Get cache statistics
{
"name": "get_cache_stats"
}clear_cache
Clear cache
{
"name": "clear_cache",
"arguments": {
"type": "all" // "all", "document", "index"
}
}list_stored_documents
List stored documents
{
"name": "list_stored_documents",
"arguments": {
"documentType": "api-doc"
}
}get_stored_document
Get specific document content
{
"name": "get_stored_document",
"arguments": {
"memoryKey": "document-key"
}
}clear_memory
Clear memory content
{
"name": "clear_memory",
"arguments": {
"memoryKey": "specific-key" // Optional, clear all if not provided
}
}๐ Project Structure
word-doc-mcp/
โโโ server.js # Main server file (with all features)
โโโ server-basic.js # Basic server (compatibility)
โโโ package.json # Project configuration and dependencies
โโโ config.json # Server configuration file
โโโ tests/ # Test directory
โ โโโ setup.js # Test environment setup
โ โโโ unit/ # Unit tests
โ โ โโโ services/ # Service layer tests
โ โโโ integration/ # Integration tests
โ โ โโโ tools/ # Tool tests
โ โ โโโ cache/ # Cache tests
โ โโโ fixtures/ # Test data
โ โโโ documents/ # Test documents
โ โโโ mock-data.js # Mock data
โโโ .cache/ # Cache directory (auto-created)
โโโ output/ # Output directory (auto-created)
โโโ node_modules/ # Dependenciesโ๏ธ Configuration
Edit the config.json file to customize server behavior:
{
"processing": {
"maxFileSize": 10485760,
"maxPages": 100,
"chunkSize": 1048576,
"parallelProcessing": true
},
"cache": {
"enabled": true,
"defaultTTL": 3600,
"cacheDirectory": "./.cache"
},
"ocr": {
"enabled": true,
"languages": ["chi_sim", "eng"]
}
}๐งช Testing
Test Framework
Using Node.js built-in test framework, following these standards:
Unit Tests: Test individual components and functions
Integration Tests: Test interactions between tools
End-to-End Tests: Test complete workflows
Running Tests
# Run all tests
npm test
# Run specific test file
node --test tests/unit/services/DocumentIndexer.test.js
# Run integration tests
node --test tests/integration/
# Generate coverage report
npm run test:coverageTest Coverage
โ Functional tests for all MCP tools
โ Complete cache system tests
โ Error handling and edge cases
โ Performance and concurrency tests
โ End-to-end workflow tests
๐ Performance Metrics
Large Document Processing: 60%+ speed improvement (parallel processing)
Repeated Document Processing: 90%+ speed improvement (caching)
OCR Recognition Accuracy: 95%+ (image preprocessing)
Memory Usage Optimization: 40% reduction (streaming processing)
Search Response Time: <100ms (full-text index)
๐ก๏ธ Security Considerations
Input file size limits
File type validation
Cache data isolation
Error handling and logging
Automatic temporary file cleanup
๐ Version Compatibility
Backward Compatibility
โ Maintain full compatibility with original API
โ Existing tool functionality unchanged
โ Optional configuration with reasonable defaults
โ Provide basic version to ensure compatibility
System Requirements
Minimum Requirements:
Node.js 16+
4GB RAM
1GB disk space
Recommended Configuration:
Node.js 18+
8GB+ RAM
Multi-core CPU
SSD storage
๐ Troubleshooting
Common Issues
Module Installation Failure
npm cache clean --force npm installOCR Recognition Failure
Ensure sufficient memory (8GB+ recommended)
Check supported image formats
Review error logs
Slow Large Document Processing
Enable parallel processing
Adjust chunkSize configuration
Use SSD storage
Memory Insufficient
node --max-old-space-size=4096 server.js
๐ Changelog
v2.0.0
โ Add table extraction functionality
โ Add image OCR analysis
โ Implement large document parallel processing
โ Add intelligent caching system
โ Implement full-text index search
โ Complete testing framework
v1.0.0
โ Basic Word document reading
โ Memory storage management
โ Simple search functionality
๐ค Contributing
Issues and Pull Requests are welcome!
Development Guidelines
Fork the project
Create feature branch
Write test cases
Ensure all tests pass
Submit Pull Request
๐ License
MIT License
Quick Start: npm install && npm start
Available Tools
7 toolsclear_cacheC
ๆธ ็ฉบๆๆ็ผๅญ
Inputs: type.
clear_memoryC
ๆธ ้คๆๅฎ็ๅ ๅญๅ ๅฎน
Inputs: memoryKey.
get_cache_statsB
่ทๅ็ผๅญ็ป่ฎกไฟกๆฏ
Inputs: no named parameters.
get_stored_documentC
่ทๅๅทฒๅญๅจ็ๆๆกฃๅ ๅฎน
Inputs: memoryKey (required).
list_stored_documentsC
ๅๅบๆๆๅทฒๅญๅจ็ๆๆกฃ
Inputs: documentType.
read_word_documentC
ๅขๅผบ็Wordๆๆกฃ่ฏปๅๅจ๏ผๆฏๆ่กจๆ ผๆๅใๅพ็OCRๅๆๅ็ผๅญไผๅ
Inputs: filePath (required), memoryKey, documentType, extractTables, +3 more.
search_documentsC
ๅ จๆ็ดขๅผๆ็ดข๏ผๆฏๆไธญ่ฑๆๆททๅๆ็ดข
Inputs: query (required), documentType, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 7 tools
Most tools have distinct purposes, but there is some potential overlap between 'clear_cache' and 'clear_memory' as both involve clearing operations, which could cause confusion without clear context in their descriptions. The other tools like 'read_word_document', 'search_documents', and document listing/storage tools are well-differentiated.
All tool names follow a consistent snake_case pattern with clear verb_noun structures (e.g., 'clear_cache', 'get_stored_document', 'list_stored_documents'), making them predictable and easy to understand. There are no deviations in naming conventions.
With 7 tools, the server is well-scoped for a Word Document Reader, covering core operations like reading, searching, listing, storing, and cache management. Each tool appears to serve a specific and necessary function without being overly sparse or bloated.
The tool set covers key document handling workflows, including reading, searching, listing, and storage, with added cache management. A minor gap exists in document modification or deletion tools, but the core functionality for a reader is largely complete, allowing agents to perform essential tasks effectively.
Maintenance
Related MCP Connectors
Convert PDF, Word, Excel and scanned documents to Markdown, tables and RAG chunks. OCR.
Verified OCR with per-value coordinates, plus a workspace agents can file documents into and query.
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
PDF, Word, PowerPoint and Excel to clean Markdown plus every table as JSON rows, OCR for scans.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive document processing, including reading, converting, and manipulating various document formats with advanced text and HTML processing capabilities.1659 npm19MIT
- AlicenseNot gradedqualityDmaintenanceEnables reading and processing various document formats including Word, PDF, RTF, and text files. Supports extracting media elements like images and links, with features for PDF page range selection and automatic text encoding detection.8MIT
- AlicenseBqualityDmaintenanceEnables comprehensive management of Microsoft Word documents with 30+ tools for reading, writing, formatting, template merging, image extraction, equation extraction, and style application.241MIT
- AlicenseAqualityDmaintenanceProvides comprehensive read/write access to Word documents, including comments, track changes, and reply threads.91MIT