A newer version of the Gradio SDK is available:
6.1.0
title: MCP File Processor Tool
emoji: π
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
license: mit
tags:
- mcp-server-track
- mcp
- file-processing
- document-analysis
- data-extraction
- hackathon
- gradio
python_version: 3.11.8
π MCP File Processor Tool
An AI-powered file processing tool that provides both a user-friendly Gradio interface and an MCP (Model Context Protocol) server endpoint for integration with AI assistants and other applications.
β¨ Features
- π Multi-Format Support: Process CSV, JSON, TXT, and other document formats
- π Smart Analysis: Extract content, structure, and metadata from uploaded files
- π Data Insights: Provide statistical analysis and content summaries
- π MCP Server: Compliant with Model Context Protocol for AI assistant integration
- π¨ Interactive UI: Modern Gradio interface with drag-and-drop file upload
- β‘ Fast Processing: Efficient file parsing and analysis capabilities
π Quick Start
Using the Web Interface
- Visit this Space and interact with the web interface directly
- Upload your file using the drag-and-drop interface
- View analysis results including content extraction and insights
- Download processed data in various formats
Supported File Types
- π CSV Files: Data analysis, column profiling, statistical summaries
- π JSON Files: Structure analysis, key exploration, validation
- π Text Files: Content extraction, word counts, encoding detection
- π Documents: Basic text extraction and metadata analysis
π MCP Server Integration
This tool implements the Model Context Protocol (MCP) for integration with AI assistants, allowing programmatic file processing capabilities.
MCP Endpoint Details
- Endpoint URL:
https://[this-space-url]/gradio_api/mcp/sse - HTTP Method:
POST - Content-Type:
application/json
Request Format
Send a POST request with the following JSON payload:
{
"data": [
"<file_content_or_path>",
"<processing_type>"
]
}
Parameters:
data[0](string): File content or file path to processdata[1](string): Processing type ("analyze", "extract", "summarize")
Response Format
Successful responses return:
{
"data": [
{
"status": "success",
"file_type": "csv",
"analysis": {
"rows": 1000,
"columns": 5,
"summary": "Data analysis results..."
},
"content": "Processed content or insights..."
}
]
}
π― Use Cases for AI Assistants
When integrated with AI assistants via MCP, this tool enables:
- Data Analysis: "Analyze this CSV file and provide insights"
- Content Extraction: "Extract text content from this document"
- File Validation: "Check if this JSON file is properly formatted"
- Data Summary: "Summarize the key information in this file"
- Batch Processing: "Process multiple files and compare results"
π οΈ Technical Details
Processing Capabilities
- CSV Analysis: Column types, statistics, missing values, correlations
- JSON Validation: Structure validation, key analysis, nested object exploration
- Text Processing: Encoding detection, word count, language detection
- Metadata Extraction: File size, creation date, format details
API Configuration
- Timeout: 60 seconds for large file processing
- Size Limits: 50MB maximum file size
- Rate Limiting: Standard Gradio Space limits
- Error Handling: Comprehensive error messages and recovery
π Hackathon Submission
This tool is submitted for the MCP Server Track of the hackathon, demonstrating:
- β MCP Protocol Compliance: Full implementation of MCP server specification
- β Production Ready: Robust error handling and file validation
- β User Experience: Intuitive file upload interface with previews
- β Documentation: Comprehensive API documentation and examples
- β Integration Ready: Easy to integrate with AI assistants and workflows
π§ Local Development
Prerequisites
- Python 3.11+
- Required packages for file processing (pandas, json, csv)
Installation
# Clone this repository
git clone [repository-url]
cd mcp_file_processor_gradio
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
Testing MCP Endpoint Locally
# Test with curl
curl -X POST http://localhost:7860/gradio_api/mcp/sse \
-H "Content-Type: application/json" \
-d '{"data": ["sample_data.csv", "analyze"]}'
π Performance & Limitations
Strengths
- Fast file processing and analysis
- Multi-format support
- Comprehensive error handling
- MCP protocol compliance
Limitations
- 50MB file size limit
- Processing time depends on file size
- Limited to common file formats
- Requires well-formatted input files
π License
MIT License - Feel free to use and modify for your projects.
π€ Contributing
This is a hackathon submission, but feedback and suggestions are welcome!
π·οΈ Tags
#mcp-server-track #file-processing #data-analysis #gradio #ai-assistant #model-context-protocol
Built with β€οΈ for the MCP Hackathon