PySpark MCP
概要
作者による説明(英語の原文)
SQL migration, AWS Glue job generation, and PySpark optimization as an MCP server.
PopNx MCPの3つの柱
この3つを1つのスコアにまとめることはしません。意見、測定、人気はそれぞれ別のものだからです。
- 利用者の声iレビューはまだありませんレビューは今後のステップで、アカウント機能と一緒に始まります
- 私たちの基本チェックi1項目中1項目に合格公開情報からチェック。コードはまだスキャンしていません
- 利用状況iとても新しい↓ 17/週 · ★ –
できること
このサーバーのやさしい解説はまだ書いていません。以下はレジストリから読み取った事実です。
- 接続方法: パソコンで動く
- トランスポート: stdio
- カテゴリ: データベース・データセット
インストール
使っているAIアプリを選んで、設定をコピーしてください。
インストールの前に
- 基本チェック:1項目中1項目に合格
- あなたのパソコンで、あなたのユーザーと同じ権限(ファイル、ネットワーク、アプリ)で動きます。
- レジストリには、入力が必要なキーは載っていません。
必要なもの
- PyPIPythonのuvのインストール(uvxコマンドに必要)
どのアプリを使っていますか?
上でアプリを選んでください。選んだアプリを覚えておくので、次からはボタンに「…にインストール」と表示されます。
Claude Desktop → Settings → Developer → Edit Config を開き、claude_desktop_config.json にこれを貼り付けます
{
"mcpServers": {
"pyspark": {
"command": "uvx",
"args": [
"pyspark-tools"
]
}
}
}ターミナルでこれを実行します
claude mcp add pyspark -- uvx pyspark-toolsまたは、設定を自分でコピーする
プロジェクトの .cursor/mcp.json、または ~/.cursor/mcp.json に貼り付けます
{
"mcpServers": {
"pyspark": {
"command": "uvx",
"args": [
"pyspark-tools"
]
}
}
}ブラウザがアプリを開いてよいか確認し、そのあとアプリが設定を表示して確認を求めます。キーの値は空欄のままなので、自分で入力してください。
または、設定を自分でコピーする
プロジェクトの .vscode/mcp.json に貼り付けます
{
"servers": {
"pyspark": {
"type": "stdio",
"command": "uvx",
"args": [
"pyspark-tools"
]
}
}
}ブラウザがアプリを開いてよいか確認し、そのあとアプリが設定を表示して確認を求めます。キーの値は空欄のままなので、自分で入力してください。
これはパソコンで動くサーバーですが、ChatGPTがつなげるのはインターネット上のサーバーだけです。ほかのアプリを選んでください。
選んだアプリは、この端末のCookieに保存されます。アカウントは不要です。
この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。
できること
パソコンで動くサーバーです。インストールすると、ツール一覧がAIアプリに表示されます。
基本チェックi
誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月9日にチェック
- ✓ 合格
作者とリポジトリが一致
レジストリ名は、リポジトリを所有するGitHubアカウント AnnasMazhar で確認済みです
- … 未チェック
今もメンテナンスされている
このリポジトリはまだGitHubから読み取っていません
- … 未チェック
ライセンスがある
このリポジトリはまだGitHubから読み取っていません
- – 対象外
エンドポイントが応答する
これはパソコンで動くため、インターネット上のエンドポイントはありません
- – 対象外
OAuthでサインイン
パソコンで動き、代わりにローカルの設定を使います
- … 未チェック
ツールの説明に隠れた指示がない
パソコンで動くサーバーです。ツール一覧を読み取れるのは、インターネット上のエンドポイントがある場合だけです
データベース・データセットのほかのサーバーとの比較i
- このカテゴリのほかの1153件のうち0%よりスターが多い
- このカテゴリのほかの1153件のうち67%より最近レジストリに公開
- 基本チェックの結果が、このカテゴリのほかの1153件のうち100%と同じかそれ以上
レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。
よくある質問
PySpark MCPは安全ですか?
当てはまる基本チェック1項目のうち1項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。
どんなキーやコードが必要ですか?
レジストリには必須のキーは載っていません。ただし、最初に使うときにサインインを求めるサーバーもあります。
パソコンで動きますか、それともクラウドですか?
あなたのパソコンで動きます。必要なときにAIアプリが起動し、データは作者のサーバーを通りません(サーバー自体がオンラインサービスを呼び出す場合を除きます)。
今もメンテナンスされていますか?
GitHubリポジトリの最終更新は–、最新バージョン(0.1.0)がレジストリに届いたのは21 日前です。
どのアプリで使えますか?
Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。パソコンにPython (uv)も必要です。
代わりに使えるものは?
同じカテゴリには:Supabase, MongoDB MCP Server, Elasticsearch MCP Server
代わりの候補
同じカテゴリで、ほかの作者が作ったサーバー。スターの多い順。
カードの見方:↓ 週あたりのダウンロードi★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i
作者のREADME
READMEを開く
作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。
PySpark MCP Server
SQL migration assistance, AWS Glue job *template* generation, and Spark code optimization — as an MCP server.
Not the live-Spark `pyspark-mcp` package. This project is SQL → PySpark /
Glue *source generation*, published as
pyspark-tools.
SemyonSinchenko/pyspark-mcp introspects a
running SparkSession. A deprecated
pyspark-mcpconsole script remains here so
old configs keep working; it prints a warning, then starts this server.
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
pip install pyspark-tools
pyspark-tools
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
pip install pyspark-tools
python -c "from pathlib import Path; from pyspark_tools.sql_converter import SQLToPySparkConverter as C; from pyspark_tools.consolidated_tools import glue_job; c,s,o=C(),Path('examples'),Path('examples/out'); [(o/f'{n}.py').write_text(c.convert_sql_to_pyspark((s/f'{n}.sql').read_text(), dialect=d).pyspark_code) for n,d in [('postgres_orders','postgres'),('oracle_decode','oracle')]]; (o/'orders_etl_glue.py').write_text(glue_job(mode='template', job_name='orders_etl', sql_query=(s/'postgres_orders.sql').read_text())['template'])"
Writes the same files as examples/out/. MCP stdio CLI: pyspark-tools.
Example: SQL → PySpark
SELECT o.customer_id, c.name, SUM(o.amount) AS total
FROM orders o JOIN customers c ON o.customer_id = c.id WHERE o.status = 'paid' GROUP BY o.customer_id, c.name
Call convert with mode=sql. Captured converter output (dialect=spark):
from pyspark.sql import SparkSession
from pyspark.sql.functions import ( col, lit, when, count, sum as spark_sum, avg, min, max, countDistinct, coalesce, concat, datediff, date_add, to_date, row_number, rank, lag, lead, ) from pyspark.sql.window import Window
Generated from SPARK SQL
spark = SparkSession.builder.appName('SQLToPySpark').getOrCreate()
Load table: customers
customers_df = spark.table('customers')
Load table: orders
orders_df = spark.table('orders')
Main query
result_df = (orders_df.alias('o') .join(customers_df.alias('c'), (col('o.customer_id') == col('c.id')), 'inner') .filter((col('o.status') == lit('paid'))) .groupBy(col('o.customer_id'), col('c.name')) .select(col('o.customer_id'), col('c.name'), (spark_sum(col('o.amount'))).alias('total')))
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
{
"mcpServers": { "pyspark": { "command": "pyspark-tools", "args": [] } } }
Hermes Agent
Add to ~/.hermes/config.yaml:
mcp:
servers: pyspark: command: pyspark-tools enabled_tools: all
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.
docker compose --profile test run --rm pyspark-tools-test
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)
convert(mode="sql", sql_query="SELECT id FROM users", dialect="postgres")
convert(mode="batch_dir", directory_path="etl/", output_dir="out")
glue_job — Glue 5.0 job *template* strings
glue_job(mode="template", job_name="orders_etl", sql_query="SELECT * FROM orders")
review — code review, patterns, duplicates
review(mode="code", code="df = spark.table('t')\ndf.collect()")
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:
pip install "pyspark-tools[aws]" # boto3 for S3/Glue catalog helpers
pip install "pyspark-tools[spark]" # pyspark — not required at runtime; generated code only
Development
python -m venv .venv
source .venv/bin/activate pip install -e ".[dev]"
Test
pytest tests/ -v --cov=pyspark_tools
Format
black pyspark_tools tests isort pyspark_tools tests
Lint
flake8 pyspark_tools tests
Requires Python 3.11+ (matches the CI matrix).
Architecture
pyspark_tools/
├── server.py # FastMCP server + helper implementations ├── consolidated_tools.py # 14 @app.tool() routers ├── sql_converter.py # SQLGlot-based transpilation + DataFrame API generation ├── aws_glue_integration.py # Glue job templates, DynamicFrame, Data Catalog ├── advanced_optimizer.py # Performance analysis + optimization suggestions ├── batch_processor.py # Concurrent file processing ├── code_reviewer.py # PySpark code review patterns ├── duplicate_detector.py # Code deduplication ├── data_source_analyzer.py # Data source analysis (optional boto3) └── file_utils.py # File I/O with allow-root checks
License
MIT — see LICENSE.
mcp-name: io.github.AnnasMazhar/pyspark-mcp