
PySpark MCP
io.github.AnnasMazharPublished by GitHub account AnnasMazharv0.1.0Updated Oct 24, 2026
SQL migration, AWS Glue job generation, and PySpark optimization as an MCP server.
Overview
Local MCP server that turns SQL into PySpark and AWS Glue source text, and reviews existing PySpark code, without running Spark.
- What you can do
- Convert SQL between PostgreSQL, Oracle, Redshift, MySQL, Snowflake and Spark SQL, and emit PySpark DataFrame API source text
- Generate AWS Glue job template strings, DynamicFrame conversions and Data Catalog definitions
- Batch-convert SQL files or directories into converted modules
- Review PySpark source for anti-patterns, duplicated snippets and optimization suggestions
- Note: it does not start a SparkSession, submit Glue jobs or execute SQL; optimization returns suggestions only
- When to use it
- Useful when migrating SQL workloads to Spark or Glue and you want an assistant to draft conversion code, Glue boilerplate and review notes. Skip it if you need live Spark session introspection, query execution, or plain sqlglot transpilation.
- Requirements
- Runs locally over stdio as the PyPI package pyspark-tools (uvx pyspark-tools or pip install pyspark-tools), requiring Python 3.11+. No authentication, environment variables or headers are declared. Optional extras add boto3 for S3/Glue helpers and pyspark for generated code.
Installation
In SourceWeft
- Open PySpark MCP 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
PySpark MCP Server
SQL migration assistance, AWS Glue job template generation, and Spark code optimization — as an MCP server.
Not the live-Spark
pyspark-mcppackage. This project is SQL → PySpark / Glue source generation, published aspyspark-tools. SemyonSinchenko/pyspark-mcp introspects a running SparkSession. A deprecatedpyspark-mcpconsole script remains here so old configs keep working; it prints a warning, then starts this server.
[CI Pipeline] [Python 3.11+] [License: MIT]
What It Does
- SQL Dialect Transpilation — Convert between PostgreSQL, Oracle, Redshift, MySQL, Snowflake, and Spark SQL using SQLGlot
- PySpark DataFrame API Generation — Generate DataFrame API source text from SQL, with optimization hints
- AWS Glue templates — Job script strings, DynamicFrame conversions, Data Catalog definitions, S3 layout advice
- Batch Processing — Walk SQL files/directories and emit converted modules
- Code Review & Optimization — Pattern-based review of existing PySpark source
- Pattern Detection — Find duplicated snippets and suggest utilities
What It Doesn't Do
- Recursive CTEs → provides Spark SQL equivalent + guidance (PySpark has no native recursive CTE support)
- MERGE/PIVOT/CONNECT BY → transpiles to Spark SQL, provides DataFrame API guidance
- Perfect 1:1 DataFrame API transpilation for all SQL — complex queries get Spark SQL + recommendations
- It does not start a SparkSession, submit Glue jobs, or execute SQL
optimize(mode="code")returns suggestions; it does not rewrite your codeglue_s3is a path heuristic (no AWS call, no measured speedups)- It does not replace SemyonSinchenko/pyspark-mcp for live catalog/plans
Why this vs calling sqlglot yourself
SQLGlot already transpiles dialects. This MCP adds three things around that kernel: DataFrame-API pretty-printing with join/window/cast mappings that the conversion tests lock, Glue job boilerplate strings (bookmarks, DynamicFrames, catalog tables) so an agent can emit a file instead of assembling one, and a 14-tool FastMCP surface so an LLM picks convert / mode=sql instead of wiring sqlglot itself. If you only need sqlglot.transpile(...), use sqlglot.
Quick Start
Zero-clone alternative: uvx pyspark-tools. run_server.py is a development convenience that inserts sys.path and prints startup banners. Prefer pyspark-tools in configs and production.
Try it
Writes the same files as examples/out/. MCP stdio CLI: pyspark-tools.
Example: SQL → PySpark
Call convert with mode=sql. Captured converter output (dialect=spark):
Exact output depends on dialect detection and fallbacks; conversion tests in tests/test_sql_conversion_fixes.py pin the important constructs. Notebook-style import * / show() is opt-in via style="notebook" on the converter.
MCP Configuration
Claude Desktop
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Hermes Agent
Add to ~/.hermes/config.yaml:
Docker
The image is stdio only (FastMCP over stdin/stdout). There is no HTTP server
on port 8000. docker compose up is for local tests, not a health-checkable
web service.
Tools
Three primary tools. The other eleven routers stay registered this minor
version but are deprecated — prefer convert, glue_job, and review.
convert — SQL → PySpark (including mode=batch_dir)
glue_job — Glue 5.0 job template strings
review — code review, patterns, duplicates
Legacy / deprecated: analyze, optimize, glue_schema, glue_s3,
glue_data, refactor, search, context, batch_status, s3_source,
analytics. Still callable; do not advertise to new agents.
Security
This MCP can read local files (SQL, TXT, PDF) and, if the [aws] extra is installed, list/read S3 with the host's default AWS credentials. File tools only allow paths under the process working directory (or an explicit base_path / FileHandler(base_directory=...)). That is not a sandbox.
Run the server under a restricted OS account. Do not point it at secrets directories. Do not attach AWS credentials with write access unless you intend S3 reads via s3_source / glue_s3. Optional extras:
Development
Requires Python 3.11+ (matches the CI matrix).
Architecture
License
MIT — see LICENSE.
mcp-name: io.github.AnnasMazhar/pyspark-mcp
Source: README.md at commit a5694cd
Tools
0Version history
2- v0.1.0LatestOct 18, 2026
- v0.0.4Sep 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