
Spark SQL
io.github.aidancorrellPublished by GitHub account aidancorrellv0.1.2Updated Oct 24, 2026
Query Spark SQL clusters via Thrift/HiveServer2. Works with Spark, EMR, Hive, Impala.
Overview
Lets an assistant run read-only SQL against Spark, EMR, Hive, or Impala clusters over Thrift/HiveServer2 and inspect schemas.
- What you can do
- Connects to a HiveServer2-compatible endpoint and exposes four tools: list_databases, list_tables, describe_table, and execute_query. Queries are restricted to read-only statements (SELECT, SHOW, DESCRIBE, DESC, EXPLAIN, WITH), unbounded queries get an automatic LIMIT, and database errors are sanitized before being returned. Supports NONE, LDAP, NOSASL, CUSTOM, and Kerberos authentication.
- When to use it
- Useful when an assistant needs to explore or query an existing Spark, EMR, Hive, Impala, or Presto warehouse without a separate SQL client. Good for schema discovery and ad-hoc read-only analysis; not for writes or cluster administration.
- Requirements
- Local Python runtime; install via pip or run with uvx. Requires SPARK_HOST and optionally SPARK_PORT (default 10000), SPARK_DATABASE, SPARK_AUTH, and for LDAP SPARK_USERNAME and SPARK_PASSWORD; Kerberos needs a valid ticket. Network access to the Thrift server, often through an SSH tunnel.
Installation
In SourceWeft
- Open Spark SQL in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Spark SQL MCP Server
An MCP server that enables AI assistants to query Spark SQL clusters via the Thrift/HiveServer2 protocol.
Works with any HiveServer2-compatible system: Apache Spark, AWS EMR, Hive, Impala, Presto.
Features
- Query Spark SQL — Execute read-only SQL queries against your Spark cluster
- Schema Discovery — List databases, tables, and describe table structures
- Multiple Auth Methods — NONE, LDAP, NOSASL, CUSTOM, and Kerberos authentication
- EMR Compatible — Works with AWS EMR clusters out of the box
- Read-Only Enforcement — Only SELECT, SHOW, DESCRIBE, EXPLAIN, and WITH statements are allowed
- Safety Defaults — Automatic LIMIT clause on unbounded queries, sanitized error messages
Installation
Or run directly with uvx:
Quick Start
1. Set Environment Variables
2. Add to Claude Code
Global (all projects) — add to ~/.claude.json under your project's mcpServers:
Project-level — add to .claude/mcp.json in your repo:
3. Add to Claude Desktop
Add to your claude_desktop_config.json:
4. Query
Ask Claude things like:
- "What databases are available in our Spark cluster?"
- "Show me the schema of the
sales.transactionstable" - "Query the top 10 customers by revenue from the analytics database"
Available Tools
Authentication
No Auth (default)
LDAP
Kerberos
AWS EMR Setup
- Security Group — Allow inbound traffic on port 10000 from your IP
- SSH Tunnel (recommended):
- Set
SPARK_HOST=localhost
Development
Local Testing with Docker
A Docker Compose setup provides a local Spark Thrift Server with sample data for integration testing.
The local server comes with sample tables: default.employees, default.orders, and test_db.metrics.
Unit tests run by default with pytest (integration tests are skipped unless -m integration is specified).
Using the local server with Claude Code
With the Docker Spark server running, add it to your MCP config to test the server interactively.
Global — add to ~/.claude.json under your project's mcpServers:
Project-level — add to .claude/mcp.json:
Then start a new Claude Code session and ask it to query the sample data.
Security
Read-Only Enforcement
The execute_query tool only allows read-only SQL statements. Queries must start with one of: SELECT, SHOW, DESCRIBE, DESC, EXPLAIN, or WITH. All other statement types (DROP, INSERT, DELETE, CREATE, ALTER, SET, ADD JAR, etc.) are rejected before reaching the Spark cluster.
Error Sanitization
Database errors are sanitized before being returned to the MCP client. Internal details such as server hostnames, file paths, and stack traces are not exposed. Connection failures report only the target host/port and error type.
Credential Handling
- Passwords are never included in log output or error messages
- The
SparkConfigobject masks passwords in its string representation SPARK_PASSWORDis marked as a secret in the MCP registry schema
Known Limitations
- No TLS/SSL support — Thrift connections are unencrypted. For production use with LDAP auth, use an SSH tunnel to protect credentials in transit.
- No query timeout — Long-running queries are not automatically cancelled. Rely on Spark cluster-level timeout configuration.
- No per-user access control — All queries execute with the privileges of the configured Spark user. Use HiveServer2 authorization (Ranger, Sentry) to restrict access at the database level.
- Auth mode defaults to NONE — Appropriate for local development but not for production. Set
SPARK_AUTHtoLDAPorKERBEROSfor authenticated environments.
License
MIT
Source: README.md at commit 691cee7
Tools
0Version history
1- v0.1.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts