Skip to content

Menu

Apache Spark MCP Server logo

Apache Spark MCP Server

Published · Updated

At a glance

Watch out for
It reads History Server data; it cannot submit, cancel or change jobs.

The real project for this page is the Kubeflow Spark AI Toolkit, kubeflow/mcp-apache-spark-history-server. Its scope is different from what an earlier version of this page described: it does not submit or run Spark jobs. It connects agents to the Spark History Server, so they can analyse jobs that have already run, which is where most Spark debugging and tuning happens.

It has 19 tools covering applications, jobs, stages, executors, environment settings and SQL executions. The analysis tools are the reason to use it: get_job_bottlenecks finds the slowest parts of a job, list_stage_task_failures shows where tasks failed, get_resource_usage_timeline shows how executors were used over time, and an investigate_failure prompt walks from a failed app down to the task exceptions. Comparison tools contrast two job runs' performance or environments, two stages or two SQL executions, and a compare_applications prompt compares two whole applications, which is very useful when a job suddenly gets slower after a change.

There are also AWS-specific tools that analyse a Spark workload and give code recommendations. The project now includes a standalone Go CLI, shs, for engineers and scripts that want the same data without an AI agent. The MCP server can be configured for several History Servers at once.

How it connects

Your AI app

An assistant or agent that supports MCP

Apache Spark MCP Server

Runs as

  • Python (uv / pip)

Gives the agent

  • Application and job inspection
  • Bottlenecks and failures
  • Comparisons
  • Resource usage
  • SQL executions

Apache Spark

The data or system the tools act on

Your AI app talks to Apache Spark MCP Server over the Model Context Protocol, and the server carries out the work. Built from the setup and capability sections on this page.

What it can do

Application and job inspection
list_applications, list_jobs, list_stages, get_stage, list_executors and get_environment read a run's details.
Bottlenecks and failures
get_job_bottlenecks and list_stage_task_failures find what slowed or broke a job, and the investigate_failure prompt guides a root-cause investigation.
Comparisons
compare_job_performance, compare_job_environments, compare_stages and compare_sql_executions, plus a compare_applications prompt.
Resource usage
get_resource_usage_timeline, get_executor_summary and get_executor_thread_dump show how executors behaved.
SQL executions
list_sql_executions and get_sql_execution analyse Spark SQL queries and their plans.

Setting it up

You need a running Spark History Server. Run the MCP server with uvx --from mcp-apache-spark-history-server spark-mcp, or install it with pip. Point it at your History Server with SHS_SERVERS__LOCAL__URL, for example http://localhost:18080, and set SHS_MCP__TRANSPORT=stdio for local clients; in Claude Code that is claude mcp add with those two --env options. A config file supports several History Servers and a custom CA bundle. The README also covers Kubernetes deployment and AWS integrations.

Where each client keeps its MCP config file, and the JSON it expects (cheat sheet)

Where it helps

  • Finding why a nightly Spark job got twice as slow after a code change
  • Investigating which stage and tasks caused a job failure
  • Comparing executor and environment settings between two runs
  • Reviewing Spark SQL execution plans for expensive queries

Limitations and things to watch

  • It reads History Server data; it cannot submit, cancel or change jobs.
  • Only applications recorded by the History Server are visible.
  • Large applications produce lots of data; ask about specific stages or jobs.
  • AWS-specific tools only help on AWS-hosted Spark.

Sources

Written from the project's own documentation, checked November 2026.

How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…