airflow-unfactor
Reads Apache Airflow DAG source code and provides tools to convert it to Prefect flows, including reading DAG files, looking up translation knowledge, and validating generated code.
Generates idiomatic Prefect flow code from Apache Airflow DAGs, with support for deployment configuration, project scaffolding, and migration reporting.
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., "@airflow-unfactor convert the DAG in dags/my_etl.py to a Prefect flow"
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.
airflow-unfactor
An MCP server that converts Apache Airflow DAGs into Prefect flows. Point it at a DAG, and the LLM generates idiomatic Prefect code. Not a template with TODOs — working code. Built with FastMCP.
Install
Claude Code — one line:
claude mcp add airflow-unfactor -- uvx airflow-unfactorClaude Desktop and other clients — see manual config below.
Then ask your LLM: "Convert the DAG in dags/my_etl.py to a Prefect flow."
Related MCP server: Apache Airflow MCP Server
How It Works
The server exposes seven tools over MCP. The LLM reads raw DAG source code, looks up translation knowledge, and generates the Prefect flow.
Tool | What It Does |
| Returns raw DAG source code with metadata (path, size, line count) |
| Airflow→Prefect translation knowledge — operators, patterns, connections |
| Syntax-checks generated code and returns both sources for comparison |
| Searches live Prefect docs for anything not in the pre-compiled knowledge |
| Creates a Prefect project directory structure (not code) |
| Writes prefect.yaml deployment configuration from DAG metadata |
| Writes MIGRATION.md with conversion decisions and a before-production checklist |
No AST parsing. No template engine. The LLM reads the code directly, just like a developer would.
Manual config
The buttons above and the claude mcp add command both register the server with uvx, which downloads it on first run — no separate pip install needed. To install the package directly anyway: pip install airflow-unfactor or uv pip install airflow-unfactor.
{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}Example
Airflow DAG:
from airflow import DAG
from airflow.operators.python import PythonOperator
def extract():
return {"users": [1, 2, 3]}
def transform(ti):
data = ti.xcom_pull(task_ids="extract")
return [u * 2 for u in data["users"]]
with DAG("my_etl", ...) as dag:
t1 = PythonOperator(task_id="extract", python_callable=extract)
t2 = PythonOperator(task_id="transform", python_callable=transform)
t1 >> t2Generated Prefect flow:
from prefect import flow, task
@task
def extract():
return {"users": [1, 2, 3]}
@task
def transform(data):
return [u * 2 for u in data["users"]]
@flow(name="my_etl")
def my_etl():
data = extract()
result = transform(data)
return resultThe >> dependency chain becomes explicit data passing through return values. XCom is gone. It's just Python.
Translation Knowledge
The server ships with 78 pre-compiled Airflow→Prefect translation entries covering operators, patterns, connections, and core concepts. These are compiled by Colin from live Airflow source and Prefect documentation.
When the pre-compiled knowledge doesn't cover something, search_prefect_docs queries the Prefect documentation MCP server at docs.prefect.io in real time.
Documentation
Full docs: gabcoyne.github.io/airflow-unfactor
Development
git clone https://github.com/gabcoyne/airflow-unfactor.git
cd airflow-unfactor
uv sync
# Run tests
uv run pytest
# Lint
uv run ruff check --fix
# Compile translation knowledge
cd colin && colin runLicense
MIT — see LICENSE.
Available Tools
7 toolsgenerate_deploymentA
Write prefect.yaml deployment configuration from DAG metadata.
Call after generating flow.py. Produces a complete prefect.yaml with YAML anchors, schedule config, parameter defaults, and TODO stubs for work pool and pull step configuration.
Args: output_directory: Directory to write prefect.yaml into. flows: List of flow dicts. Each requires flow_name and entrypoint. Optional fields: schedule (cron/interval/None), parameters (dict of name→default), description, tags, dataset_triggers. workspace: Workspace name (default: "default").
Returns: JSON with created_file, deployment_names, next_steps.
Inputs: flows (required), output_directory (required), workspace. Returns: result
generate_migration_reportA
Write MIGRATION.md — human-readable record of a DAG conversion.
Call as the final step after generate_deployment. Documents every conversion decision, produces a before-production checklist with Prefect doc links, and suggests adding the Prefect MCP server.
Args: output_directory: Directory to write MIGRATION.md into. dag_path: Path to the original Airflow DAG file. flow_path: Path to the generated Prefect flow file. decisions: List of dicts, each with: component, outcome, rationale (optional), manual_action (optional). manual_actions: Top-level action types not tied to a specific component (e.g. "setup_work_pool", "migrate_connections").
Returns: JSON with created_file, checklist_items_count.
Inputs: dag_path (required), decisions (required), flow_path (required), output_directory (required), +1 more. Returns: result
lookup_conceptA
Look up Airflow→Prefect translation knowledge for a concept.
Searches Colin-compiled knowledge for operators, patterns, connections, and core concepts. Falls back to built-in mappings if Colin output is not available.
Args: concept: The Airflow concept to look up (e.g. "PythonOperator", "XCom", "TaskGroup", "postgres_default").
Returns: JSON with concept_type, airflow info, prefect_equivalent, translation_rules, and source ("colin" or "fallback").
Inputs: concept (required). Returns: result
read_dagA
Read an Airflow DAG file and return raw source with metadata.
Accepts a file path or inline content. Returns the source code, file path, size, and line count. The LLM reads the code directly.
Args: path: Path to a DAG file on disk. content: Inline DAG source code.
Returns: JSON with source, file_path, file_size_bytes, line_count — or error.
Inputs: path, content. Returns: result
scaffoldA
Generate a Prefect project directory structure.
Creates the project skeleton following prefecthq/flows conventions. Does NOT generate flow code - that's for the LLM to do.
Args: output_directory: Where to create the project project_name: Project name (defaults to directory name) workspace: Workspace name for deployments// structure flow_names: List of flow names to create directories for include_docker: Include Dockerfile template include_github_actions: Include CI workflow template schedule_interval: Cron string, preset (@daily etc.), seconds, or None.
Returns: JSON with created_directories, created_files, prefect_yaml_template, next_steps
Inputs: output_directory (required), workspace, flow_names, project_name, +3 more. Returns: result
search_prefect_docsA
Search current Prefect documentation via the Prefect MCP server.
For real-time queries beyond what Colin pre-compiled. Returns search results or an error with suggestion to run 'colin run'.
Args: query: Search query for Prefect docs.
Returns: JSON with search results or error.
Inputs: query (required). Returns: result
validateA
Validate a converted Prefect flow against the original Airflow DAG.
Returns both source files for comparison plus a syntax check on the generated code. You perform the structural comparison.
Args: original_dag: Path or inline content of the original DAG. converted_flow: Path or inline content of the generated flow.
Returns: JSON with original_source, converted_source, syntax_valid, syntax_errors, and comparison_guidance.
Inputs: original_dag (required), converted_flow (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct stage of the migration workflow: reading source, lookup translation knowledge, searching docs, validating, scaffolding project, generating deployment config, and writing report. No two tools overlap in purpose or could be confused.
Most tools follow a verb_noun pattern (read_dag, lookup_concept, search_prefect_docs, generate_deployment, generate_migration_report), but 'validate' and 'scaffold' are single verbs without objects, breaking the pattern. The naming style is still readable and all lowercase with underscores.
7 tools is well within the ideal 3-15 range and perfectly scoped for the server's purpose: converting Airflow DAGs to Prefect. Each tool earns its place in the workflow without redundancy or bloat.
The tool set covers the major stages of migration: reading the source, understanding concepts, verifying, scaffolding, deployment config, and reporting. The only notable gap is the lack of a tool to generate the actual flow code, but this is intentional (the LLM is expected to write it). Minor gaps like automatic metadata extraction are workable.
Maintenance
Related MCP Connectors
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Related MCP Servers
AlicenseAqualityFmaintenanceAn MCP server that enables AI assistants to interact with Apache Airflow's REST API for DAG management, task monitoring, and system diagnostics. It provides comprehensive tools for triggering workflows, retrieving logs, and inspecting system health across Airflow 2.x and 3.x versions.3113Apache 2.0- AlicenseNot gradedqualityNot gradedmaintenanceAn MCP server that wraps the Apache Airflow REST API, enabling clients to manage DAGs, monitor task instances, and handle workflows through a standardized interface. It provides comprehensive access to Airflow features including DAG runs, variables, connections, and XComs.MIT

prefect-mcp-serverofficial
AlicenseAqualityCmaintenanceAn MCP server for interacting with Prefect resources, enabling AI assistants to monitor, manage, and debug workflows.1456MIT- AlicenseAqualityCmaintenanceAn MCP server that enables AI coding assistants to interact with a local Airflow cluster via its REST API for triggering DAG runs, monitoring status, reading logs, and diagnosing errors.101MIT