Spark EventLog MCP Server
中文版本 | English
A comprehensive Spark event log analysis MCP server built on FastMCP 2.0 and FastAPI, providing in-depth performance analysis, resource monitoring, and optimization recommendations.
Features
🌐 FastMCP & FastAPI Integration: MCP protocol support and analysis report APIs powered by FastAPI & FastMCP
📊 Performance Analysis: Shuffle analysis, resource utilization monitoring, task execution analysis
📈 Visual Reports: Auto-generated interactive HTML reports with direct browser access
☁️ Cloud Data Sources: Support for S3 buckets and HTTP URLs with automatic path detection
💡 Intelligent Optimization: Automated optimization recommendations based on analysis results
🔧 Modular Architecture: Clean separation of concerns with specialized modules for tools, middleware, and configuration
📝 Enhanced Logging: Comprehensive request/response logging with detailed debugging information
Quick Start
MCP Client Integration
uvx Mode (Recommended - Direct from GitHub)
stdio Mode (Local Development)
HTTP Mode
1. Start HTTP Server:
2. Configure Remote MCP:
3. Access Services:
API Documentation: http://localhost:7799/docs
Health Check: http://localhost:7799/health
Reports List: http://localhost:7799/api/reports
MCP Endpoint: http://localhost:7799/mcp
Analysis Examples





Project Structure
MCP Tools
Tool Name | Description | Parameters |
| End-to-end report generation - Auto-detects S3/URL, analyzes data, generates HTML reports |
|
| Query current analysis session status and metrics | None |
| Clear session cache and reset server state | None |
Simplified Tool Usage
The refactored MCP tools focus on simplicity and automation:
RESTful API Endpoints
Basic Endpoints
GET /- Service informationGET /health- Health checkGET /docs- API documentation (Swagger UI)
Report Management
GET /api/reports- List all reportsGET /api/reports/{filename}- View HTML reportGET /reports/{filename}- Direct access to report filesDELETE /api/reports/{filename}- Delete report
MCP Tool Calls
POST /mcp- MCP protocol endpoint
Configuration
Environment Variables
Enhanced Logging Features
The refactored architecture provides comprehensive request/response logging:
FastAPI Request Logging:
Application Logging:
Format: Timestamp - Level - [Filename:Line:Function] - Logger Name - Message
Data Source Support
S3
HTTP URL
Local File
Report Features
Generated HTML reports include:
📊 Application Overview (task counts, success rate, duration)
💻 Executor Resource Usage Distribution
🔄 Shuffle Performance Analysis
⚖️ Data Skew Detection
💡 Intelligent Optimization Recommendations
📈 Interactive Visualizations
Troubleshooting
Port Already in Use
Missing Dependencies
AWS Credentials Issues
Debug Logging
Recent Improvements (2025-12-18)
Major Code Refactoring
🎯 Simplified MCP Tools:
generate_reportnow requires only a single string parameter (S3 or URL path)📦 Modular Architecture: Extracted MCP tool implementations from main server to dedicated modules
📝 Enhanced Logging: Added comprehensive request/response logging with client info, headers, and request body
🔧 Centralized Configuration: Moved uvicorn and middleware configuration to separate utility modules
📉 Reduced Complexity: Main server.py reduced from ~1150 to ~370 lines (70% reduction)
Architecture Changes
New Module:
tools/mcp_tools.py- Contains all MCP tool implementationsNew Module:
utils/middleware.py- FastAPI request logging middlewareNew Module:
utils/uvicorn_config.py- Centralized uvicorn logging configurationAuto-Detection: Automatic path type detection (S3 vs URL) in
generate_reporttoolSimplified Interface: Single-parameter MCP tools with internal logic handling complexity
HTTP Transport Fixes
MCP Protocol Compatibility: Fixed HTTP 406 errors by ensuring proper Accept headers
Request Tracing: Added detailed request/response logging for better debugging
Error Handling: Improved error messages and status code handling
Tech Stack
FastMCP 2.0: MCP protocol support
FastAPI: RESTful API framework
Pydantic: Data validation and serialization
Plotly: Interactive charts
boto3: AWS S3 integration
aiofiles: Async file operations
Development
Support
Documentation: Check
/docsAPI documentationIssues: Submit GitHub Issues
Reference: FastMCP Documentation