# Kubeflow Spark AI Toolkit

> Help AI agents analyze and investigate Apache Spark applications.

- **URL**: https://followmcp.com/en/servers/mcp-apache-spark-history-server
- **Category**: Dev Tools
- **Origin**: Community
- **Stars**: 210
- **FMRS Score**: 58/100 (Grade C)
- **Source**: https://github.com/kubeflow/mcp-apache-spark-history-server
- **Transports**: stdio (local process), Streamable HTTP
- **Runtimes**: Python 3.12+
- **Auth**: No credential needed

## Overview
Kubeflow Spark AI Toolkit provides an MCP server that connects to Apache Spark History Server so MCP-compatible clients can query application, job, stage, executor, SQL, and resource data, then compare performance and investigate failures. It supports multiple configured History Servers and can also connect to a running Spark UI. The repository also includes a standalone command-line tool, shs; that tool is separate from the MCP server.

## Best for
- Engineers and data teams who analyze Apache Spark applications through MCP clients.
- Users with an accessible Spark History Server or Spark UI who need multi-step investigations.

## Not for
- Users who do not use Apache Spark or cannot access a Spark History Server or Spark UI.
- Users who only need a terminal or scripting interface; the repository provides a separate shs CLI.

## Required permissions
- Network access to the configured Spark History Server or Spark UI.
- If the server requires authentication, provide the corresponding username and password; token authentication is also configurable.
- AWS troubleshooting tools require configured AWS credentials and region.

## Risks
- Results may include operational data such as application configuration, system properties, classpath, exception details, and thread dumps; handle them as sensitive information.
- Protect configured authentication details and AWS credentials.
- Cached RDD visibility from the History Server depends on block updates being enabled in event logs; thread dumps are available only from a driver UI.

## Client config (JSON)
```json
{"mcpServers":{"spark-history":{"command":"uvx","args":["--from","mcp-apache-spark-history-server","spark-mcp"],"env":{"SHS_MCP__TRANSPORT":"stdio","SHS_SERVERS__LOCAL__URL":"http://localhost:18080"}}}}
```

## Tools (20)
- `list_applications`: Filter applications by status, date, and limit; pass app_id for application details and attempts.
- `list_jobs`: List jobs with status or job ID filters and optional sorting.
- `list_stages`: List stages with status filtering and optional sorting.
- `get_stage`: Get stage details, attempts, and task metric distributions.
- `list_stage_task_failures`: List failed tasks for a stage with exception or stack trace details.
- `list_executors`: Filter and sort executors and their metrics.
- `get_executor_summary`: Aggregate metrics across all executors.
- `get_resource_usage_timeline`: Show executor additions and removals with resource totals over time.
- `get_executor_thread_dump`: Get a JVM thread dump for a driver or executor; available only from a running Spark UI.
- `list_cached_rdds`: List cached RDDs and DataFrames with storage, partition, memory, and disk metrics.
- `get_environment`: Get Spark configuration, JVM information, system properties, and classpath.
- `list_sql_executions`: List curated SQL execution summaries with filtering, sorting, and a limit.
- `get_sql_execution`: Get SQL execution details, with optional plan, node metrics, job summaries, and stage data.
- `compare_sql_executions`: Compare aggregate performance metrics for two SQL executions, with an optional plan structure diff.
- `get_job_bottlenecks`: Identify bottlenecks across stages, tasks, and executors.
- `compare_job_environments`: Diff Spark configurations between two applications.
- `compare_job_performance`: Compare performance metrics between two applications.
- `compare_stages`: Compare two stages using stage metrics and per-task quantiles.
- `aws_analyze_spark_workload`: Run one-shot root cause analysis for a failed or slow Spark workload; requires AWS credentials and region.
- `aws_spark_code_recommendation`: Get code fix recommendations for identified Spark issues; requires AWS credentials and region.
