Document-handler

sendsta/Document-handler

3.2

If you are the rightful owner of Document-handler and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

FastMCP 2.0 server for parsing, analyzing, importing, OCR processing, and managing tender documents for tri-tender.

Tools
5
Resources
0
Prompts
0

Tender Documents Handler MCP

A FastMCP 2.0 server for parsing, analyzing, importing, OCR processing, and managing tender documents for tri-tender.

FastMCP Python

🚀 Quick Deploy to FastMCP Cloud

Step 1: Fork/Clone this Repository

git clone https://github.com/your-username/tender-docs-mcp.git

Step 2: Deploy to FastMCP Cloud

  1. Visit fastmcp.cloud
  2. Sign in with your GitHub account
  3. Create a new project from your repository
  4. Set entrypoint: server.py:mcp
  5. Click Deploy

Your server will be available at:

https://your-project-name.fastmcp.app/mcp

Step 3: Connect to Your MCP Client

Add this to your Claude Desktop or Cursor configuration:

{
  "mcpServers": {
    "tender-docs": {
      "url": "https://your-project-name.fastmcp.app/mcp"
    }
  }
}

📋 Features

Document Parsing

  • Multi-format support: PDF, DOCX, DOC, TXT, HTML, RTF, ODT
  • Text extraction with layout preservation
  • Table extraction from PDF documents
  • Metadata extraction (author, title, dates, page count)

OCR (Optical Character Recognition)

  • Process scanned documents and images
  • Support for PNG, JPG, JPEG, TIFF, BMP
  • Automatic detection of image-only PDFs

Tender Document Analysis

  • Section extraction: Automatically identify document structure
  • Requirements extraction: Find mandatory and optional requirements
  • Deadline detection: Extract important dates and deadlines
  • Contact extraction: Find emails and phone numbers
  • Evaluation criteria: Identify scoring and evaluation methods
  • Compliance items: Extract checklist and compliance requirements

Document Management

  • Import from base64
  • Document validation
  • Content search
  • Structure analysis

🔧 Available Tools

ToolDescription
parse_documentExtract text from PDF, DOCX, TXT, HTML files
analyze_tenderComprehensive tender analysis - sections, requirements, deadlines, contacts, criteria
extract_metadataGet file info, page count, author, title, dates
extract_tablesExtract structured tables from PDFs
extract_requirementsFind mandatory/optional requirements with categorization
extract_sectionsParse document structure and hierarchy
extract_deadlinesFind important dates and submission deadlines
perform_ocrOCR for scanned documents and images
validate_documentCheck if document is readable and valid
search_documentSearch for text patterns within documents
get_document_structureGet table of contents and section hierarchy
list_documentsList available documents
import_documentImport from base64

📚 Available Resources

Resource URIDescription
tender://config/versionCurrent server version
tender://config/supported-formatsList of supported document formats
tender://config/requirement-categoriesRequirement classification categories
tender://uploads/{filename}Get info about uploaded documents

💡 Available Prompts

PromptDescription
analyze_tender_promptComprehensive tender analysis workflow
compare_requirements_promptCompare requirements between two tenders
extract_compliance_checklist_promptGenerate compliance checklist from tender

🖥️ Local Development

Installation

# Clone the repository
git clone https://github.com/your-username/tender-docs-mcp.git
cd tender-docs-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Running Locally

# Using FastMCP CLI
fastmcp run server.py

# Or directly with Python
python server.py

Testing with MCP Inspector

fastmcp dev server.py

This opens the MCP Inspector at http://localhost:5173 where you can test all tools.

Claude Desktop Configuration (Local)

{
  "mcpServers": {
    "tender-docs": {
      "command": "python",
      "args": ["/path/to/tender-docs-mcp/server.py"]
    }
  }
}

📊 Example Usage

Analyzing a Tender Document

# The LLM will call the analyze_tender tool
result = analyze_tender(file_path="/path/to/tender.pdf")

# Returns:
{
    "document_id": "DOC-ABC12345",
    "metadata": {
        "file_name": "tender.pdf",
        "page_count": 45,
        "word_count": 12500
    },
    "sections": [
        {"title": "Scope of Work", "content": "..."}
    ],
    "requirements": [
        {
            "requirement_id": "REQ-001",
            "description": "Must have ISO certification",
            "category": "qualification",
            "is_mandatory": true
        }
    ],
    "deadlines": [
        {"date": "December 31, 2024", "type": "deadline"}
    ],
    "evaluation_criteria": [...],
    "compliance_items": [...],
    "summary": "This tender seeks proposals for..."
}

Using Prompts

Ask Claude:

"Use the analyze_tender_prompt for /uploads/tender.pdf"

Claude will receive a structured workflow prompt and execute the analysis step by step.

🏗️ Project Structure

tender-docs-mcp/
├── server.py              # Main FastMCP server (entrypoint)
├── pyproject.toml         # Project configuration
├── requirements.txt       # Dependencies
├── README.md              # This file
├── LICENSE                # MIT License
└── .gitignore            # Git ignore rules

⚙️ Environment Variables

VariableDescriptionDefault
TENDER_UPLOAD_DIRDirectory for uploaded documentsSystem temp directory
TENDER_PROCESSED_DIRDirectory for processed documentsSystem temp directory
TENDER_CACHE_DIRCache directorySystem temp directory

📦 Requirement Categories

The MCP automatically categorizes extracted requirements:

  • technical: System, software, hardware specifications
  • financial: Pricing, payment, budget requirements
  • legal: Compliance, regulatory, contractual items
  • qualification: Experience, certifications, capacity
  • timeline: Deadlines, schedules, milestones
  • documentation: Reports, certificates, submissions
  • personnel: Staff, team, resource requirements
  • general: Other requirements

🔐 Authentication (FastMCP Cloud)

For private servers, add authentication headers:

{
  "mcpServers": {
    "tender-docs": {
      "url": "https://your-project.fastmcp.app/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

🤝 Integration with tri-tender

This MCP server integrates with the tri-tender document generation system:

  1. Document Upload: Users upload tender documents via tri-tender
  2. Processing: MCP server parses and analyzes the documents
  3. Analysis: Extracted data (requirements, deadlines, criteria) feeds into the tender response generator
  4. Output: Generated tender responses are based on comprehensive document analysis

📄 License

MIT License - see file for details.

🆘 Support

🔄 CI/CD

FastMCP Cloud automatically:

  • Monitors your repo for changes
  • Deploys on push to main branch
  • Creates preview deployments for PRs
  • Provides unique URLs for testing