# ๐ Article Quadrant Analyzer MCP Server (Enhanced + OCR)
A powerful Model Context Protocol (MCP) server that extracts core insights from articles with OCR support and generates intelligent Chinese quadrant analysis with direct text matrix visualization.
## โจ Features
- **Multi-Source Content Processing**: URLs, files, screenshots (OCR), and direct text
- **Professional OCR**: Integration with Mistral Document AI API for high-accuracy screenshot analysis
- **4 Powerful Tools**: Content extraction, OCR processing, insights analysis, quadrant generation
- **Chinese Text Matrix Output**: Direct ASCII quadrant visualization in dialogue
- **2x2 Quadrant Analysis**: Automatic generation of insightful quadrant visualizations
- **Agent-Centric Design**: Optimized for AI agent workflows
- **UVX Deployment**: Zero-dependency deployment for minimal cost
## ๐ Quick Start
### 1. Fast Deployment (5 minutes)
```bash
# Deploy to Cursor
./deploy_to_ide_standard.sh cursor
# Deploy to VS Code
./deploy_to_ide_standard.sh vscode
# Deploy to Claude Desktop
./deploy_to_ide_standard.sh claude
# Validate deployment
./deploy_to_ide_standard.sh validate
```
### 2. Manual Setup
```bash
# Install dependencies
uvx --quiet --python 3.12 --with fastmcp python test_simple_server.py
# Start MCP Inspector for testing
fastmcp dev test_simple_server.py
```
## ๐ Project Structure
```
mcp-server-article-quadrant/
โโโ test_simple_server.py # Main MCP server (3 tools)
โโโ deploy_to_ide_standard.sh # Automated deployment script
โโโ config/ # IDE configurations
โ โโโ config_cursor_standard.json
โ โโโ config_vscode_standard.json
โ โโโ config_claude_desktop_standard.json
โ โโโ config_emacs.el
โ โโโ config_neovim.lua
โโโ src/mcp_server_article_quadrant/ # Modular source code
โ โโโ server.py # FastMCP server setup
โ โโโ tools/ # MCP tools
โ โ โโโ extract_content.py
โ โ โโโ analyze_insights.py
โ โ โโโ generate_quadrant.py
โ โโโ models/ # Pydantic models
โ โ โโโ content.py
โ โ โโโ analysis.py
โ โ โโโ quadrant.py
โ โโโ utils/ # Utilities
โ โโโ content_extractor.py
โ โโโ quadrant_generator.py
โ โโโ image_processor.py
โโโ .trae/specs/article-quadrant-analyzer/ # Technical specifications
โ โโโ spec.md (24KB) # Complete MCP server specification
โ โโโ api-research.md (25KB) # API research and content sources
โโโ pyproject.toml # Project configuration
โโโ .env.example # Environment variables template
โโโ 2X2ๅๆprompt.md # Original analysis prompt
โโโ DOCUMENTATION_SUMMARY.md # Documentation cleanup summary
```
## ๐ง Configuration
### Environment Variables
```bash
# Mistral Document AI API (for OCR)
MISTRAL_API_KEY=your_api_key_here
# Content Processing
CONTENT_MAX_LENGTH=50000
OCR_MAX_FILE_SIZE=10485760
```
### IDE Configuration Examples
**Cursor:**
```json
{
"mcpServers": {
"article-quadrant-analyzer": {
"command": "uvx",
"args": [
"--quiet", "--python", "3.12", "--with", "fastmcp",
"python", "/Users/vincent/Library/CloudStorage/SynologyDrive-vincent/My.create/Developer/MCP/test_simple_server.py"
]
}
}
}
```
More configuration examples in `config/` directory.
## ๐ ๏ธ MCP Tools
### 1. `extract_article_content_simple`
**Enhanced content extraction with AI-friendly interface**
**Intelligent Processing:**
- Automatic HTML/XML tag removal
- Language detection (Chinese/English/Mixed)
- Content quality analysis
- URL and format detection
- Comprehensive metrics (characters, words, sentences, paragraphs)
**Universal Input Support:**
- URLs (news websites, WeChat public accounts)
- Text files and documents
- Direct text input
- OCR processed content
- Mixed-format content
**Smart Output:**
- Content preview with truncation
- Complexity assessment
- Processing recommendations
- Next-step guidance
### 2. `analyze_article_insights_simple`
**Advanced content insights extraction**
**Keyword Analysis:**
- Frequency-based keyword extraction
- Topic identification and clustering
- Content summarization
- Trend detection
**Intelligence Features:**
- Automatic topic categorization
- Insight relevance scoring
- Content structure analysis
- Actionable insight generation
### 3. `extract_text_from_image`
**Professional OCR with Mistral Document AI API**
**Advanced OCR Processing:**
- High-accuracy text extraction from images and screenshots
- Support for multiple image formats (PNG, JPG, WEBP)
- Automatic language detection (Chinese/English/Mixed)
- Mistral Document AI API integration for best results
**Smart Error Handling:**
- Graceful fallback when API key not configured
- Detailed error messages and troubleshooting guidance
- Image validation and preprocessing
- Network timeout and retry logic
**Input/Output Support:**
- File paths to local images
- Base64 encoded image data
- Real-time confidence scoring
- Extracted text ready for quadrant analysis
### 4. `generate_quadrant_analysis_simple`
**Enhanced Chinese quadrant analysis engine**
**Smart Content Processing:**
- Intelligent Chinese language detection and analysis
- Context-aware content preprocessing
- Flexible axis labeling (supports Chinese labels)
- Robust error handling and parameter validation
**Advanced Classification Logic:**
- **Collaboration Analysis**: Detects team work, coordination, and group activities
- **Textual Analysis**: Identifies documentation, writing, and formal communication
- **Pattern Recognition**: Maps content to appropriate quadrants based on actual text patterns
- **Chinese Context Support**: Specifically trained for Chinese business and work scenarios
**Direct Matrix Output:**
- **Real-time ASCII Visualization**: Matrix appears directly in dialogue
- **Chinese Quadrant Names**: ้็นๆๅ
ฅๅบ, ไธไธๅๆๅบ, ๅบ็ก็ปดๆคๅบ, ๅๆๅไฝๅบ
- **Content-Specific Mapping**: Analyzes your actual content for accurate placement
- **No Conversion Needed**: Instant results without SVG/PNG conversion steps
**Rich Output Format:**
- Professional quadrant mapping
- Detailed content metrics
- Strategic insights and recommendations
- **Direct text matrix visualization** (Chinese)
- **Smart content classification** based on actual text analysis
**AI-Friendly Features:**
- Automatic XML/HTML tag cleanup
- Flexible parameter format support
- Comprehensive error handling
- Context-aware response generation
- **Chinese language support** with intelligent content analysis
**๐จ Enhanced Visualization Capabilities:**
- **Intelligent Text Matrix**: Direct ASCII quadrant display in dialogue
- **Chinese Content Analysis**: Smart classification based on collaboration vs text levels
- **Context-Aware Mapping**: Analyzes content patterns for accurate quadrant placement
- **Real-time Results**: No SVG conversion needed - matrix appears immediately
- **Dynamic Naming**: Quadrants named in Chinese (้็นๆๅ
ฅๅบ, ไธไธๅๆๅบ, ๅบ็ก็ปดๆคๅบ, ๅๆๅไฝๅบ)
## ๐ Supported Content Sources
- **News Websites**: Major news platforms and online publications
- **WeChat Public Accounts**: Articles from WeChat official accounts
- **Screenshots**: OCR processing via Mistral Document AI API
- **Text Files**: Direct file content extraction
- **Direct Input**: Manual text entry for analysis
## ๐ฏ Use Cases
- **Work Process Analysis**: Analyze team collaboration workflows and documentation patterns
- **Project Management**: Visualize task distribution and work flow efficiency
- **Team Coordination**: Identify collaboration bottlenecks and optimization opportunities
- **Content Strategy**: Map content types across collaboration and formality dimensions
- **Decision Making**: Framework for resource allocation and task prioritization
## ๐ Sample Output
**Input:**
```
ๅทฅไฝ็ๆตๅจๆง: ๆฒกๆไปปไฝไธไธชๅฒไฝๅชๅญๅจไบไธไธช่ฑก้...
ไพๅฆๅผๅๆฐๅ่ฝ: ๅข้ๅคด่้ฃๆด๏ผๆฐๅPRDๆๆกฃ๏ผๅทฅ็จๅธ็ฌ็ซ็ผๅไปฃ็ ...
```
**Direct Matrix Output:**
```
๐ฏ ๅ่ฑก้็ฉ้ตๅพ
โ ๆๆฌๅ็จๅบฆ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Q1: ้็นๆๅ
ฅๅบ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข ๅข้ๅไฝๆๆกฃ โ โ
โ โ โข ้ไฝ่ฎจ่ฎบ่ฎฐๅฝ โ โ
โ โ โข ๅ
ฑไบซๆๆๅฑ็คบ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Q2: ไธไธๅๆๅบ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข ็ฌ็ซๆทฑๅบฆๆ่ โ โ
โ โ โข ไธชไบบไธไธๅๆ โ โ
โ โ โข ๆ ธๅฟๆๆฏๅฎ็ฐ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๅไฝ็จๅบฆ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ๅไฝ็จๅบฆ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Q3: ๅบ็ก็ปดๆคๅบ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข ๅบ็ก็ปดๆคๅทฅไฝ โ โ
โ โ โข ๅธธ่งๆไฝๆต็จ โ โ
โ โ โข ๆ ๅ่ง่ๆง่ก โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Q4: ๅๆๅไฝๅบ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข ๅๆๅคด่้ฃๆด โ โ
โ โ โข ่ง่งๅ่กจ่พพ โ โ
โ โ โข ไบๅจๅไฝๅฑ็คบ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## ๐ Testing & Validation
```bash
# Test MCP Inspector
fastmcp dev test_simple_server.py
# Opens: http://127.0.0.1:6274
# Validate UVX deployment
./deploy_to_ide_standard.sh validate
# Test individual tools via MCP Inspector interface
```
## ๐ Documentation
- **[Technical Specification](.trae/specs/article-quadrant-analyzer/spec.md)** - Complete MCP server design (24KB)
- **[API Research](.trae/specs/article-quadrant-analyzer/api-research.md)** - Content source analysis (25KB)
- **[Documentation Summary](DOCUMENTATION_SUMMARY.md)** - Project organization and cleanup history
## โก Performance
- **Startup Time**: <2 seconds with UVX
- **Memory Usage**: ~50MB baseline
- **Processing**: 1-5 seconds for typical articles
- **OCR Processing**: 3-10 seconds via Mistral API
## ๐จ Generated Output Examples
The server generates professional quadrant analyses in SVG format showing:
- **Strategic Positioning**: Content mapped across two axes
- **Visual Clarity**: Clean, professional quadrants with labels
- **Actionable Insights**: Recommendations based on positioning
- **Contextual Analysis**: Tailored to content type and goals
---
**๐ Ready to transform your article analysis workflow!**
*Generated with FastMCP Spec-Driven Development Guide*