PySpark MCP

v0.1.0
io.github.AnnasMazhar/pyspark-mcp Checked 2 days ago Published 1 month ago

SQL migration, AWS Glue job generation, and PySpark optimization as an MCP server.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

convert Convert

Convert SQL to PySpark code or process SQL files in batch. **Modes:** ``sql`` Convert a single SQL query to PySpark code. *Parameters:* ``sql_query`` (required), ``table_info``, ``dialect``, ``optimization_level``, ``include_glue_template``, ``style`` (``production`` | ``notebook``), ``target`` (``spark`` | ``glue``) ``batch_files`` Process multiple SQL files into PySpark. *Parameters:* ``file_paths`` (required list), ``output_dir``, ``job_name`` ``batch_dir`` Process all SQL files in a directory. *Parameters:* ``directory_path`` (required), ``output_dir``,…

ParameterTypeDescription
mode *string
dialect
directory_path
file_paths
include_glue_templateboolean
job_name
optimization_levelstring
output_dir
pdf_path
recursiveboolean
sql_query
stylestring
table_info
targetstring

analyze Analyze

**Deprecated.** Prefer ``convert`` / ``glue_job`` / ``review``. Still registered this minor version. Analyze SQL or PySpark code for context, data flow, or optimization opportunities. **Modes:** ``sql_context`` Analyze SQL context (schemas, tables, dialect, complexity). *Parameters:* ``sql_content`` or ``selected_text`` ``data_flow`` Analyze data flow patterns in PySpark code. *Parameters:* ``pyspark_code`` (required), ``table_info`` ``codebase`` Analyze a PySpark codebase directory for patterns and issues. *Parameters:* ``directory_path`` (required), ``include_opt…

ParameterTypeDescription
mode *string
directory_path
include_optimization_suggestionsboolean
include_project_structureboolean
pyspark_code
scan_depthinteger
selected_text
sql_content
table_info
workspace_name
workspace_path

optimize Optimize

**Deprecated.** Prefer ``review``. Still registered this minor version. Optimize PySpark code and recommend performance improvements. **Modes:** ``code`` Return pattern-based suggestions for PySpark code. Does **not** rewrite the input. *Parameters:* ``code`` (required), ``optimization_level`` ``joins`` Recommend join strategies based on estimated table sizes. *Parameters:* ``pyspark_code`` (required), ``table_info`` ``partitioning`` Suggest optimal partitioning strategies. *Parameters:* ``pyspark_code`` (required), ``table_info`` ``comprehensive`` Generate co…

ParameterTypeDescription
mode *string
code
optimization_levelstring
pyspark_code
table_info

review Review

Review PySpark code for issues, patterns, and refactoring opportunities. **Modes:** ``code`` Review PySpark code for issues, best practices, and performance. *Parameters:* ``code`` (required), ``focus_areas`` ``patterns`` Analyze code samples to discover common patterns. *Parameters:* ``code_samples`` (required list) ``duplicates`` Detect duplicate patterns across code samples. *Parameters:* ``code_samples`` (required list)

ParameterTypeDescription
mode *string
code
code_samples
focus_areas

glue_job Glue Job

Generate and manage AWS Glue job configurations and templates. **Modes:** ``template`` Generate a complete AWS Glue job template. *Parameters:* ``sql_query``, ``job_name``, ``source_database``, ``source_table``, ``target_database``, ``target_table``, ``output_dir``, ``source_format``, ``target_format``, ``include_bookmarking``, ``template_type``, ``script_name`` ``dynamic_frame`` Convert PySpark DataFrame code to use DynamicFrames. *Parameters:* ``pyspark_code`` (required), ``source_database``, ``source_table``, ``target_database``, ``target_table`` ``properties…

ParameterTypeDescription
mode *string
enable_continuous_loggingboolean
enable_metricsboolean
enable_spark_uiboolean
glue_versionstring
include_bookmarkingboolean
job_name
job_typestring
max_retriesinteger
number_of_workersinteger
output_dir
pyspark_code
script_name
source_database
source_formatstring
source_table
sql_query
target_database
target_formatstring
target_table
template_typestring
timeoutinteger
worker_typestring

glue_schema Glue Schema

**Deprecated.** Prefer ``glue_job``. Still registered this minor version. Manage Glue Data Catalog schemas — detect, evolve, and define. **Modes:** ``detect`` Detect schema from sample data and generate table definition. *Parameters:* ``sample_data`` (required dict/list), ``table_name`` (required), ``infer_partitions`` ``evolve`` Generate schema evolution strategy for handling schema changes. *Parameters:* ``current_columns`` (required), ``new_columns`` (required), ``merge_behavior``, ``case_sensitive`` ``catalog`` Generate AWS Glue Data Catalog table definit…

ParameterTypeDescription
mode *string
case_sensitiveboolean
columns
current_columns
data_formatstring
database_name
enable_schema_evolutionboolean
infer_partitionsboolean
merge_behaviorstring
new_columns
partition_keys
s3_location
sample_data
table_name

glue_s3 Glue S3

**Deprecated.** Prefer ``glue_job``. Still registered this minor version. Analyze S3 data layouts using **path heuristics** (no AWS API call). **Modes:** ``analyze`` Path-heuristic layout suggestions. No AWS call; figures are not measured. *Parameters:* ``s3_location`` (required), ``database_name`` (required), ``table_name`` (required), ``data_format``, ``query_patterns``, ``data_size_gb`` ``optimize`` Generate comprehensive S3 optimization strategy. *Parameters:* ``database_name`` (required), ``table_name`` (required), ``s3_location`` (required), ``data_format``, `…

ParameterTypeDescription
mode *string
compression_typestring
consolidation_strategystring
data_formatstring
data_size_gb
database_name
enable_small_file_optimizationboolean
query_patterns
s3_location
source_database
source_table
table_name
target_database
target_file_size_mbinteger
target_table

glue_data Glue Data

**Deprecated.** Prefer ``glue_job``. Still registered this minor version. Generate AWS Glue data processing jobs — incremental, CDC, bookmarks. **Modes:** ``incremental`` Generate Glue job with incremental processing and job bookmarking. *Parameters:* ``source_database`` (required), ``source_table`` (required), ``target_database`` (required), ``target_table`` (required), ``incremental_column`` (required), ``incremental_strategy``, ``transformation_sql`` ``cdc`` Generate Change Data Capture (CDC) Glue job. *Parameters:* ``source_database`` (required), ``source_…

ParameterTypeDescription
mode *string
bookmark_strategystring
cdc_columnstring
cdc_strategystring
incremental_column
incremental_strategystring
job_name
primary_keys
source_database
source_table
target_database
target_table
transformation_context_keys
transformation_sql

refactor Refactor

**Deprecated.** Prefer ``review``. Still registered this minor version. Refactor PySpark code and generate pipeline structures. **Modes:** ``patterns`` Refactor code by replacing duplicate patterns with utility function calls. *Parameters:* ``original_code`` (required), ``code_samples`` (required) ``utilities`` Extract common utility functions from code patterns. *Parameters:* ``code_samples`` (required), ``patterns`` ``pipeline`` Generate optimized PySpark data pipeline code or project structure. *Parameters (pipeline):* ``data_sources`` (required list), ``process…

ParameterTypeDescription
mode *string
code_samples
data_sources
dialect
include_batch_processingboolean
include_glue_templateboolean
include_monitoringboolean
include_visualizationboolean
original_code
output_dir
patterns
processing_requirements
sql_content
target_formatstring
workspace_name
workspace_path

context Context

**Deprecated.** Prefer ``convert``. Still registered this minor version. Store, retrieve, and work with SQL/PySpark conversion context. **Modes:** ``store`` Store additional context data for a conversion. *Parameters:* ``conversion_id`` (required), ``context_data`` (required) ``get`` Retrieve stored context for a conversion. *Parameters:* ``conversion_id`` (required) ``assist`` Real-time SQL assistance — analyze and convert as you edit. *Parameters:* ``sql_query`` or ``selected_text``

ParameterTypeDescription
mode *string
context_data
conversion_id
selected_text
sql_query

batch_status Batch Status

**Deprecated.** Prefer ``convert(mode="batch_dir")``. Still registered this minor version. Monitor and manage batch processing jobs. **Modes:** ``status`` Get the status of a specific batch job. *Parameters:* ``job_id`` (required) ``cancel`` Cancel a running batch job. *Parameters:* ``job_id`` (required) ``active`` List all currently active batch jobs. *Parameters:* none ``recent`` List recent batch jobs. *Parameters:* ``limit``, ``status``

ParameterTypeDescription
mode *string
job_id
limitinteger
status

s3_source S3 Source

**Deprecated.** Prefer ``glue_job``. Still registered this minor version. Analyze S3 data sources and Delta tables. **Modes:** ``analyze`` Analyze S3 data source structure, format, and optimization opportunities. *Parameters:* ``s3_path`` (required), ``include_schema_inference`` ``delta`` Analyze Delta table structure, properties, and optimization. *Parameters:* ``table_path`` (required), ``analyze_history``

ParameterTypeDescription
mode *string
analyze_historyboolean
include_schema_inferenceboolean
s3_path
table_path

analytics Analytics

**Deprecated.** Prefer ``review``. Still registered this minor version. Analytics on optimization effectiveness and usage patterns. **Modes:** ``optimization`` Get analytics on optimization effectiveness. *Parameters:* ``optimization_type``, ``limit`` ``usage`` Get usage statistics including conversion history and pattern stats. *Parameters:* ``limit``

ParameterTypeDescription
mode *string
limitinteger
optimization_type