MCP server for LLM-assisted conversion of Apache Airflow DAGs to Prefect flows
Project description
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.
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 |
|---|---|
read_dag |
Returns raw DAG source code with metadata (path, size, line count) |
lookup_concept |
Airflow→Prefect translation knowledge — operators, patterns, connections |
validate |
Syntax-checks generated code and returns both sources for comparison |
search_prefect_docs |
Searches live Prefect docs for anything not in the pre-compiled knowledge |
scaffold |
Creates a Prefect project directory structure (not code) |
generate_deployment |
Writes prefect.yaml deployment configuration from DAG metadata |
generate_migration_report |
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.
Installation
# From PyPI
pip install airflow-unfactor
# Or with uv
uv pip install airflow-unfactor
Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}
Claude Code
Add to .mcp.json in your project:
{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}
Cursor
Add to your Cursor MCP settings:
{
"mcpServers": {
"airflow-unfactor": {
"command": "uvx",
"args": ["airflow-unfactor"]
}
}
}
Then ask your LLM: "Convert the DAG in dags/my_etl.py to a Prefect flow."
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 >> t2
Generated 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 result
The >> 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 run
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file airflow_unfactor-1.0.0.tar.gz.
File metadata
- Download URL: airflow_unfactor-1.0.0.tar.gz
- Upload date:
- Size: 639.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01f52deb382b2ec7a8ed4296dbbc14521841034e41c6233b02153e7c18327a48
|
|
| MD5 |
5f83971e14db18c5fd283201ea103ee4
|
|
| BLAKE2b-256 |
5825a0887baaa3205ead51e14d108209886be7674efc8ae6c241a7a8e9e3e8d0
|
Provenance
The following attestation bundles were made for airflow_unfactor-1.0.0.tar.gz:
Publisher:
release.yml on gabcoyne/airflow-unfactor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
airflow_unfactor-1.0.0.tar.gz -
Subject digest:
01f52deb382b2ec7a8ed4296dbbc14521841034e41c6233b02153e7c18327a48 - Sigstore transparency entry: 1032480213
- Sigstore integration time:
-
Permalink:
gabcoyne/airflow-unfactor@dbb691eee5fc8e6f721a7fc3597b64856705b17d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/gabcoyne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dbb691eee5fc8e6f721a7fc3597b64856705b17d -
Trigger Event:
push
-
Statement type:
File details
Details for the file airflow_unfactor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: airflow_unfactor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 64.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bcdf795799f095486e8b04958e2815d64513fc449cb518d13abdb4e20c8aad7
|
|
| MD5 |
5d012695d4d2eaffcd2f75ed76ac7445
|
|
| BLAKE2b-256 |
f6e429e4304ba21e7776eef9a16405abcddb1a45b98b3953bb682028623c7dfa
|
Provenance
The following attestation bundles were made for airflow_unfactor-1.0.0-py3-none-any.whl:
Publisher:
release.yml on gabcoyne/airflow-unfactor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
airflow_unfactor-1.0.0-py3-none-any.whl -
Subject digest:
1bcdf795799f095486e8b04958e2815d64513fc449cb518d13abdb4e20c8aad7 - Sigstore transparency entry: 1032480327
- Sigstore integration time:
-
Permalink:
gabcoyne/airflow-unfactor@dbb691eee5fc8e6f721a7fc3597b64856705b17d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/gabcoyne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dbb691eee5fc8e6f721a7fc3597b64856705b17d -
Trigger Event:
push
-
Statement type: