Skip to content

Conversation

codegen-sh[bot]
Copy link

@codegen-sh codegen-sh bot commented Jun 10, 2025

📄 PDF Document Translator MCP Server

A complete MCP (Model Context Protocol) server implementation that translates PDF documents using AI vision models, built following the Hugging Face MCP course guidelines.

🚀 Key Features

  • PDF Processing: Converts PDF pages to high-quality images (300 DPI)
  • AI Vision OCR: Extracts text using Hugging Face vision models
  • Multi-language Translation: Supports 12+ languages (EN, ES, FR, DE, IT, PT, RU, ZH, JA, KO, AR, HI)
  • MCP Server: Functions as both web interface and MCP server for AI assistants
  • Gradio Integration: Uses mcp_server=True for automatic MCP tool generation
  • HF Spaces Ready: Complete deployment configuration included

🛠️ Technical Implementation

  • Framework: Gradio with MCP support
  • PDF Processing: PyMuPDF for high-quality conversion
  • AI Models: Hugging Face transformers for vision and translation
  • Architecture: Follows MCP course best practices
  • Error Handling: Comprehensive error handling and validation

📁 Project Structure

├── app.py                 # Main MCP server application
├── requirements.txt       # Dependencies
├── config.json           # HF Spaces configuration
├── README.md             # Comprehensive documentation
├── DEPLOYMENT.md         # Deployment guide
├── test_app.py           # Test suite
├── examples/
│   └── sample_usage.py   # Usage examples
└── .gitignore           # Git ignore rules

🌐 Usage

Web Interface: Upload PDF → Select languages → Get translations
MCP Tool: document_translator(pdf_file, source_lang, target_lang)

🚀 Deployment

Ready for immediate deployment to Hugging Face Spaces:

  1. Create new Gradio Space
  2. Upload project files
  3. MCP endpoint: https://your-space.hf.space/gradio_api/mcp/sse

🧪 Testing

Includes comprehensive test suite covering:

  • PDF processing functionality
  • Text extraction and translation
  • Error handling scenarios
  • MCP server integration

📚 Documentation

  • Complete README with usage examples
  • Detailed deployment guide
  • Sample configurations for Claude Desktop
  • Language code reference

This implementation demonstrates practical application of the HuggingFace MCP course concepts with a real-world document translation use case.


💻 View my workAbout Codegen

- Complete MCP server implementation with Gradio
- PDF to image conversion using PyMuPDF
- AI-powered text extraction and translation
- Support for 12+ languages
- Ready for Hugging Face Spaces deployment
- Comprehensive documentation and examples
- Test suite included
- Following HuggingFace MCP course guidelines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants