Enhanced QR Code MCP Server
Generates QR codes and automatically saves them as PNG files with metadata tracking, batch processing capabilities, and organized file management for production workflows.
README
Enhanced QR Code MCP Server
An advanced Model Context Protocol (MCP) server that generates QR codes and automatically saves them as PNG files with comprehensive metadata, batch processing capabilities, and file management tools.
🔗 Dual Implementation Strategy
This Python implementation focuses on reliable file generation and batch processing.
For advanced styling, analysis, and templates, see our TypeScript implementation.
Built upon and enhanced from: @jwalsh/mcp-server-qrcode
This enhanced version adds automatic file generation, metadata tracking, batch processing, and production-ready features while maintaining full compatibility with the MCP protocol.
🚀 Key Enhancements Over Original
| Feature | Original MCP | Enhanced Python MCP | Enhanced TypeScript MCP |
|---|---|---|---|
| PNG File Output | ❌ Chat display only | ✅ Automatic PNG file saving | ✅ Multiple formats (PNG, SVG, PDF) |
| Directory Management | ❌ None | ✅ Custom output directories | ✅ Configurable paths |
| Metadata Tracking | ❌ None | ✅ JSON metadata files | ✅ Comprehensive metadata |
| Batch Processing | ❌ One at a time | ✅ Multiple QR codes per call | ✅ Advanced batch features |
| File Organization | ❌ None | ✅ Structured file management | ✅ Template-based organization |
| Custom Filenames | ❌ None | ✅ User-defined naming | ✅ Smart naming patterns |
| Production Ready | ❌ Basic | ✅ Complete test suite & docs | ✅ Enterprise features |
| Advanced Styling | ❌ None | 🔄 Planned (see ROADMAP) | ✅ Full styling engine |
| QR Analysis | ❌ None | 🔄 Planned (see ROADMAP) | ✅ Decode & quality analysis |
| Templates | ❌ None | 🔄 Planned (see ROADMAP) | ✅ Pre-defined templates |
🛠️ Installation
Prerequisites
- Python 3.8+
- MCP client (Claude Desktop, VS Code extension, etc.)
Quick Setup
git clone https://github.com/myownipgit/enhanced-qrcode-mcp.git
cd enhanced-qrcode-mcp
chmod +x setup.sh
./setup.sh
Manual Setup
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Make server executable
chmod +x src/enhanced_qrcode_server.py
🔧 MCP Client Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"enhanced-qrcode": {
"command": "python3",
"args": ["/path/to/enhanced-qrcode-mcp/src/enhanced_qrcode_server.py"],
"env": {},
"description": "Enhanced QR code generator with automatic PNG file saving"
}
}
}
📚 Available Tools
1. generate_and_save_qrcode
Generate a single QR code and automatically save as PNG file.
Parameters:
content(required): Text content to encodeoutput_directory: Target directory (default:./qr_output/)filename: Custom filename (auto-generated if empty)errorCorrectionLevel: L, M, Q, or H (default: M)size: Size multiplier 1-20 (default: 5)border: Border size 1-20 (default: 4)include_metadata: Generate JSON metadata (default: true)display_in_chat: Show in chat interface (default: true)
Example:
{
"content": "https://github.com/myownipgit/enhanced-qrcode-mcp",
"output_directory": "./qr_codes/",
"filename": "github_repo",
"errorCorrectionLevel": "H",
"size": 6
}
Output:
- PNG file:
github_repo.png - Metadata:
github_repo_metadata.json - Chat display (optional)
2. batch_generate_qrcodes
Generate multiple QR codes from array input.
Example:
{
"qr_codes": [
{
"id": "contact",
"content": "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nORG:Acme Corp\nTEL:555-0123\nEMAIL:john@acme.com\nEND:VCARD",
"type": "vcard"
},
{
"id": "website",
"content": "https://example.com",
"type": "url"
}
],
"output_directory": "./batch_output/",
"size": 5
}
Output:
- PNG files:
qr_contact.png,qr_website.png - Individual metadata files
- Batch manifest:
batch_manifest_YYYYMMDD_HHMMSS.json
3. list_generated_qrcodes
List all QR code files in a directory with metadata.
{
"directory": "./qr_output/"
}
📁 File Structure
Generated Files
output_directory/
├── qr_20250616_143022_hello_world.png
├── qr_20250616_143022_hello_world_metadata.json
├── github_repo.png
├── github_repo_metadata.json
└── batch_manifest_20250616_143500.json
Metadata Format
{
"generated_date": "2025-06-16T14:30:22.123456",
"content": "Hello World!",
"parameters": {
"error_correction": "M",
"size": 5,
"border": 4,
"box_size": 10
},
"png_file": "/path/to/qr_file.png",
"file_size_bytes": 1117
}
🎯 Use Cases
Business Applications
- Event Management: Generate ticket QR codes as ready-to-print PNG files
- Marketing: Create campaign QR codes with tracking metadata
- Inventory: Generate asset labels with automatic file organization
- Contact Sharing: Batch create vCard QR codes for business cards
Technical Integration
- Print Production: Direct PNG output for design workflows
- API Workflows: Batch generate QR codes from database records
- Asset Management: Organized file structure with metadata
- Quality Control: Error correction levels for different environments
🧪 Testing
Run the comprehensive test suite:
# Activate virtual environment
source venv/bin/activate
# Run tests
python3 tests/test_server.py
Expected Output:
🚀 Running Enhanced QR Code MCP Server Tests
✅ QR code generation successful
✅ Filename generation tests passed
✅ File operations tests passed
✅ Integration test passed - 3 files generated
📊 Test Results: 4/4 passed
🎉 All tests passed! Enhanced MCP server is ready to use.
📈 Performance
- Single QR code: ~50ms generation + file save
- Batch processing: ~100ms per code + manifest
- Metadata generation: ~5ms per file
- File listing: ~10ms per 100 files
🔍 Error Correction Levels
- L (Low): ~7% damage recovery - basic indoor use
- M (Medium): ~15% damage recovery - standard use (default)
- Q (Quartile): ~25% damage recovery - industrial environments
- H (High): ~30% damage recovery - outdoor/damaged surfaces
🚀 Future Enhancements
See our comprehensive ROADMAP.md for detailed development plans including:
🔄 Coming Soon (v2.1.0)
- Structured content builders for vCard, WiFi, and events
- SVG and PDF output formats
- Enhanced validation and content optimization
🎨 Advanced Features (Available in TypeScript Version)
Our TypeScript implementation already includes:
- Custom styling with colors, logos, and gradients
- QR code analysis and decoding capabilities
- Template system with pre-defined styles
- Quality assessment tools with recommendations
🔗 Choosing the Right Implementation
| Use Case | Recommended Version |
|---|---|
| File generation & batch processing | 🐍 Python version (this repo) |
| Advanced styling & customization | 🟨 TypeScript version |
| QR code analysis & decoding | 🟨 TypeScript version |
| Production file workflows | 🐍 Python version (this repo) |
| Template-based generation | 🟨 TypeScript version |
| Metadata tracking & organization | 🐍 Python version (this repo) |
🐛 Troubleshooting
Common Issues
ModuleNotFoundError: No module named 'mcp'
pip install mcp
Permission denied on setup.sh
chmod +x setup.sh
QR code not saving
- Check directory permissions
- Verify output path exists
- Check disk space
Testing the Server
# Test dependencies
python3 -c "import qrcode, mcp; print('✅ Dependencies OK')"
# Test server startup
python3 src/enhanced_qrcode_server.py
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development Setup
git clone https://github.com/myownipgit/enhanced-qrcode-mcp.git
cd enhanced-qrcode-mcp
./setup.sh
source venv/bin/activate
python3 tests/test_server.py
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- Original Work: @jwalsh/mcp-server-qrcode - Foundation QR code MCP server
- MCP Protocol: Model Context Protocol - Enabling AI-tool integration
- QR Code Library: qrcode - Core QR code generation
- Pillow: PIL/Pillow - Image processing capabilities
🔗 Related Projects
- Enhanced TypeScript Version - Advanced styling and analysis features
- Original MCP QR Code Server - The foundation this builds upon
- Model Context Protocol - MCP specification and tools
- Claude Desktop - AI assistant with MCP support
📊 Repository Stats
- Language: Python 3.8+
- Dependencies: MCP, qrcode, Pillow
- Test Coverage: 100% (4/4 tests passing)
- Documentation: Complete with examples
- License: MIT
Enhanced QR Code MCP Server v2.0.0
Production-ready QR code generation with automatic PNG file output and comprehensive metadata
Built with ❤️ upon the excellent foundation of @jwalsh/mcp-server-qrcode
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。