eFax to JSON MCP Server
Converts eFax documents (PDF, TIFF, CCD XML) from OpenText Fax Server Software into structured JSON format with OCR support, metadata extraction, and batch processing capabilities.
README
eFax to JSON MCP Server
A Model Context Protocol (MCP) server that converts eFax documents from OpenText Fax Server Software into structured JSON format. Supports PDF, TIFF, and CCD XML document formats with advanced OCR and metadata extraction capabilities.
Features
Supported Formats
- PDF Documents - Text extraction and OCR for scanned PDFs
- TIFF Images - Multi-page TIFF support with OCR processing
- CCD XML - Clinical Document Architecture parsing
Processing Capabilities
- Intelligent OCR - Tesseract-based text recognition with confidence scoring
- Metadata Extraction - Preserve document properties and fax information
- Batch Processing - Convert multiple documents simultaneously
- Format Validation - Comprehensive document structure validation
- Error Recovery - Robust error handling with detailed reporting
Installation
Prerequisites
- Node.js 18+
- System-level Tesseract OCR installation:
- Ubuntu/Debian:
sudo apt-get install tesseract-ocr - macOS:
brew install tesseract - Windows: Download from UB Mannheim releases
- Ubuntu/Debian:
Setup Steps
-
Create project directory
mkdir efax-mcp-server cd efax-mcp-server -
Initialize and install dependencies
npm init -y npm install @modelcontextprotocol/sdk pdf-parse sharp tesseract.js xml2js npm install -D @types/node @types/pdf-parse @types/xml2js typescript ts-node -
Create directory structure
mkdir -p src/{types,processors,utils} mkdir -p tests/test-files mkdir -p docs -
Add source files (paste the provided code into respective files)
-
Build the project
npm run build
Usage
MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"efax-converter": {
"command": "node",
"args": ["/path/to/efax-mcp-server/dist/server.js"]
}
}
}
Available Tools
1. Convert Single Document
convert_efax_document --filePath "/path/to/document.pdf" --performOCR true
Parameters:
filePath(required) - Path to eFax documentoutputPath(optional) - Custom output JSON pathextractMetadata(default: true) - Extract document metadataperformOCR(default: true) - Enable OCR processingocrLanguage(default: "eng") - OCR language codeincludeRawData(default: false) - Include raw document data
2. Batch Convert Documents
batch_convert_efax --inputDirectory "/path/to/docs" --outputDirectory "/path/to/json"
Parameters:
inputDirectory(required) - Source document directoryoutputDirectory(required) - JSON output directoryfilePattern(default: "*") - File matching patterncontinueOnError(default: true) - Continue on individual failures
3. Validate JSON Output
validate_efax_json --jsonPath "/path/to/output.json"
4. Get File Information
get_file_info --filePath "/path/to/document.pdf"
5. List Supported Formats
list_supported_formats
JSON Output Structure
{
"id": "efax_document_1234567890_abc123",
"source": "efax",
"format": "pdf|tiff|ccd_xml",
"timestamp": "2025-08-04T12:00:00.000Z",
"metadata": {
"originalFileName": "fax_document.pdf",
"fileSize": 2048576,
"pages": 3,
"sender": "John Doe",
"recipient": "Jane Smith",
"faxNumber": "+1-555-123-4567",
"resolution": "1200x1800",
"ocrConfidence": 95.5,
"processingTime": 3500
},
"content": {
"text": "Full extracted text content...",
"pages": [
{
"pageNumber": 1,
"text": "Page 1 text content...",
"confidence": 96.2,
"metadata": {
"width": 1200,
"height": 1800,
"resolution": "1200x1800"
}
}
],
"sections": [
{
"title": "Patient Information",
"content": "Patient details...",
"type": "patient",
"pageNumbers": [1]
}
]
},
"rawData": {
"pdfInfo": {},
"imageMetadata": {}
}
}
Architecture
Modular Design
- Processors: Format-specific conversion logic
- Utilities: Shared validation and file handling
- Types: Comprehensive TypeScript definitions
Processing Pipeline
- File Validation - Format and size checks
- Format Detection - Automatic type identification
- Content Extraction - Text and metadata processing
- OCR Processing - Image-to-text conversion when needed
- Structure Validation - Output quality assurance
- JSON Serialization - Standardized output format
Development
Build Commands
npm run build # Compile TypeScript
npm run dev # Development mode with hot reload
npm run test # Run test suite
npm run clean # Clean build directory
Testing
Place sample documents in tests/test-files/ and run:
npm test
Adding New Formats
- Create processor in
src/processors/ - Add type definitions in
src/types/ - Register in main server
- Update documentation
Performance Considerations
- OCR Processing: CPU-intensive, consider batch size limits
- Memory Usage: Large TIFF files may require significant RAM
- Processing Time: Varies by document complexity and OCR requirements
- Concurrent Processing: Single-threaded OCR worker per instance
Error Handling
The server provides comprehensive error handling:
- File Validation Errors - Invalid paths, unsupported formats
- Processing Errors - OCR failures, corrupted documents
- System Errors - Memory issues, disk space problems
- Validation Errors - Output structure problems
Troubleshooting
Common Issues
OCR Not Working
- Verify Tesseract installation:
tesseract --version - Check language pack availability
- Ensure sufficient system memory
Large File Processing
- Monitor memory usage during conversion
- Consider breaking large batches into smaller chunks
- Verify available disk space for output
Permission Errors
- Check read permissions on input files
- Verify write permissions on output directory
- Ensure MCP server has appropriate file system access
License
MIT License - see LICENSE file for details.
Support
For issues and feature requests, please use the project's issue tracker.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。