Spark Connect (gRPC) API + MCP Server for Agentic AI!
pip install spark-mcp==0.4.6 Copy PIP instructions
Documentation — Installation, deployment, and usage across the API, CLI, MCP, and A2A agent interfaces are maintained in the official documentation.
spark-mcp exposes a standardized interface to the live Spark Connect deployment via the Model Context Protocol — SQL/session execution, versioned Transform submission/tracking/rerun against the shared Iceberg lakehouse catalog (scope=lakekeeper, explicit — the same landmine Trino/Lakekeeper hit if dropped), namespace/table catalog reads, OpenLineage config/status reporting, and a Wire-First spark_ingest_run tool that pushes the SparkApplication -> SparkJob -> Transform -> TransformRun -> DatasetVersion chain into the epistemic-graph Knowledge Graph.
Spark Connect is live, confirmed 2026-08-26 against spark-connect.apps.svc:15002 with a real pyspark.sql.connect session — a query against lakehouse.analytics.trino_verify returned the same 3 rows Trino's sibling lane already proved reading/writing (cross-engine Iceberg interop). See docs/architecture.md for the full evidence and this package's AGENTS.md for known gaps (identity-token attach, ActionSpec typed-Actions deferral).
Talks directly to Spark over pyspark-client (the thin Spark Connect client) for SQL, DataFrame and catalog operations, and over the Spark monitoring REST API (/api/v1 on the driver UI and the History Server) for applications, jobs, stages, executors, storage, environment and SQL executions, never bin/spark-shell --remote (does not work on the vanilla Spark image) and never a kubectl exec spark-sql fallback.
Pick the extra that matches what the operator want to run:
uv pip install "spark-mcp[mcp]" Container images (:mcp) One multi-stage docker/Dockerfile builds the MCP-only image (--target mcp):
docker build --target mcp -t spark-mcp:mcp . Both images install a headless JRE at runtime — pyspark[connect]'s gRPC client has a JVM-side dependency, unlike the fleet's pure-Python REST connectors.
python -m spark_mcp MCP Configuration Example (stdio) { "mcpServers": { "spark-mcp": { "command": "uv", "args": ["run", "spark-mcp"], "env": { "MCP_TOOL_MODE": "intent", "SPARK_CONNECT_URL": "sc://spark-connect.apps.svc:15002", "SPARK_LAKEHOUSE_CATALOG": "lakehouse", "SPARK_LAKEHOUSE_SCOPE": "lakekeeper", "SPARK_ENABLE_TRANSFORMS": "False", "SPARKTOOL": "True" } } } } Architecture api_client.py wraps api/api_client_spark.py's SparkApi, a thin gRPC client over pyspark.sql.connect.session.SparkSession, behind api/api_client_base.py's typed-error layer (SparkApiError with a kind: unreachable / job_failed / session_evicted / disabled — never a silent empty result). auth.py mints Keycloak client-credentials identity tokens and can attach them as real gRPC bearer credentials, but the deployed Spark Connect endpoint is plaintext gRPC today, so attach is disabled by default (see docs/architecture.md).
mcp_server.py serves one typed spark_ tool per SparkApi method (spark_sql, spark_describe, spark_cancel, spark_submit_transform, spark_rerun_transform, spark_list_transform_runs, spark_list_lakekeeper_tables, spark_lineage_config, spark_lineage_events, spark_application_status) through one register_tool_surface(...) call; GET-like reads are read-only and spark_cancel is destructive. kg_ingest.py exposes ingest_entities/ingest_run plus record-mapping helpers around the required native_ingest (Wire-First) authority.
Python 3.14 (floor 3.12) against a Spark 4.1 server. pyspark-client 4.1 is the thin Spark Connect client; it runs on numpy 2, pandas 3 and pyarrow wheels. pyspark-client ships only a pure-Python sdist, so it is the one package built from source ([tool.pipelines] allow-source-build = ["pyspark-client"]).
15 package + 24 inherited variable(s). Auto-generated from .env.example + the shared scion-sdk set — do not edit.
1 action-routed tool(s) · 12 verbose 1:1 tool(s). Each is enabled unless its TOOL toggle is set false; MCP_TOOL_MODE selects the surface (intent default — the six verb-tools, granular set loaded on demand · condensed action-routed · verbose 1:1 · both). Auto-generated — do not edit.
Contributions are welcome! Please ensure code quality by running local checks before submitting pull requests:
This package ships a compact canonical skill surface with specialist procedures kept as referenced workflows. The current MCP tools, skill metadata, connector_manifest.yml, ontology, mappings, shapes, fixtures, migrations, tool-schema fingerprints, and certification metadata form one versioned capability contract. Validate them together; do not rely on stale tool names or historical per-task skill wrappers.
Runtime endpoints, credentials, certificate trust, tenant identity, retention, and observability policy are deployment inputs and are never packaged values. See Configuration, trust, and privacy before enabling a network transport, connector ingestion, Arbora delegation, or trace export.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




