Spark Iceberg MCP Server
Provides read-only access to Apache Iceberg tables via Spark SQL, enabling agents to inspect schemas, list namespaces and tables, and run SELECT queries against Iceberg data.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Spark Iceberg MCP ServerShow the schema for local.datapulse.events and sample 5 rows"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Spark Iceberg MCP Server
A Model Context Protocol server that provides read-only access to Apache Iceberg tables via Spark SQL.
Use it from Cursor, Claude Desktop, or any MCP client when you have Iceberg data on HDFS/S3 and want an LLM to inspect schemas and run SELECT queries — without Hive or Impala.
Inspired by cloudera/iceberg-mcp-server (Impala-based).
Tools
Tool | Description |
| Run read-only Spark SQL ( |
|
|
|
|
|
|
Results are returned as JSON with columns, rows, and truncated flags.
Related MCP server: Cloudera Iceberg MCP Server
Requirements
Python 3.9+
Spark 3.x with Iceberg runtime JAR
Network/filesystem access to the Iceberg warehouse (e.g. HDFS on a CDP node)
Two execution modes:
Mode | When to use |
subprocess (recommended on CDP) |
|
pyspark | Local dev with |
Quick start (CDP lab cluster)
Run the MCP server on the cluster node (or any host with spark3-submit + HDFS access):
git clone https://github.com/will-sh/spark-iceberg-mcp-server.git
cd spark-iceberg-mcp-server
uv syncSet environment variables (example for wxiao-732 lab):
export SPARK_EXECUTION_MODE=subprocess
export SPARK_SUBMIT_BIN=spark3-submit
export SPARK_MASTER="local[2]"
export SPARK_ICEBERG_CATALOG=local
export SPARK_ICEBERG_CATALOG_TYPE=hadoop
export SPARK_ICEBERG_WAREHOUSE="hdfs://ccycloud-1.wxiao-732.root.comops.site:8020/user/systest/iceberg-warehouse"
export SPARK_ICEBERG_RUNTIME_JAR="/opt/cloudera/parcels/CDH-7.3.2-1.cdh7.3.2.p30000.83076434/lib/iceberg/iceberg-spark-runtime-3.5_2.12-*.jar"
export HADOOP_CONF_DIR=/etc/hadoop/conf
export SPARK_MAX_ROWS=1000Test a query directly:
uv run spark-iceberg-query --query "SELECT count(*) AS n FROM local.datapulse.events"Start the MCP server:
uv run run-serverCursor configuration
Add to Cursor MCP settings (~/.cursor/mcp.json or project MCP config):
{
"mcpServers": {
"spark-iceberg": {
"command": "uv",
"args": [
"--directory",
"/path/to/spark-iceberg-mcp-server",
"run",
"run-server"
],
"env": {
"SPARK_EXECUTION_MODE": "subprocess",
"SPARK_SUBMIT_BIN": "spark3-submit",
"SPARK_MASTER": "local[2]",
"SPARK_ICEBERG_CATALOG": "local",
"SPARK_ICEBERG_CATALOG_TYPE": "hadoop",
"SPARK_ICEBERG_WAREHOUSE": "hdfs://ccycloud-1.wxiao-732.root.comops.site:8020/user/systest/iceberg-warehouse",
"SPARK_ICEBERG_RUNTIME_JAR": "/opt/cloudera/parcels/CDH-7.3.2-1.cdh7.3.2.p30000.83076434/lib/iceberg/iceberg-spark-runtime-3.5_2.12-*.jar",
"HADOOP_CONF_DIR": "/etc/hadoop/conf",
"SPARK_MAX_ROWS": "100"
}
}
}
}Or install from GitHub with uvx:
{
"mcpServers": {
"spark-iceberg": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/will-sh/spark-iceberg-mcp-server@main",
"run-server"
],
"env": {
"SPARK_EXECUTION_MODE": "subprocess",
"SPARK_SUBMIT_BIN": "spark3-submit",
"SPARK_ICEBERG_WAREHOUSE": "hdfs://your-nn:8020/user/systest/iceberg-warehouse",
"SPARK_ICEBERG_RUNTIME_JAR": "/opt/cloudera/parcels/CDH/lib/iceberg/iceberg-spark-runtime-3.5_2.12-*.jar"
}
}
}
}Note:
uvxstill needsspark3-submitand HDFS access on the host where Cursor launches the MCP process. For remote CDP clusters, run Cursor's MCP on the cluster node via SSH Remote, or use a bastion with Hadoop client configs.
Environment variables
Variable | Default | Description |
|
|
|
|
| Spark submit binary for subprocess mode |
|
| Spark master URL ( |
|
| Iceberg catalog name |
|
| Catalog type ( |
| — | Warehouse path (required for Hadoop catalog) |
| — | Path to |
| — | Optional |
| — | Hadoop config directory |
|
| Max rows returned per query |
|
| MCP transport: |
Security
Only read-only SQL prefixes are allowed (
SELECT,SHOW,DESCRIBE,WITH,EXPLAIN).This is a basic guardrail; do not expose the MCP server to untrusted networks without additional controls.
Prefer a dedicated read-only HDFS/Spark principal in production.
Development
uv sync --group dev
uv run pytest
uv run ruff check src testsLicense
Apache License 2.0 — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Your Databricks Lakehouse in natural language: run SQL on your SQL warehouses, track long-running qu
The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.
Search, sample and query open reproducible datasets published as immutable Parquet with schemas.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables read-only access to Apache Iceberg tables via Impala, allowing LLMs to inspect database schemas and execute SQL queries to retrieve data from Iceberg tables.214Apache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Iceberg tables via Apache Impala, enabling LLMs to inspect database schemas and execute SQL queries on Iceberg data.Apache 2.0
- AlicenseCqualityDmaintenanceEnables natural language interaction with Apache Iceberg Lakehouse tables through MCP, supporting read-only operations like listing namespaces, tables, schemas, and partitions.5Apache 2.0
- AlicenseAqualityCmaintenanceProvides read-only SQL access to Apache Iceberg tables via HiveServer2, enabling querying, schema discovery, and database listing on Cloudera Data Platform.3Apache 2.0