# Airflow Unfactor

> MCP server for LLM-assisted conversion of Apache Airflow DAGs to Prefect flows

- **Type:** MCP server
- **Install:** `agentstack add mcp-gabcoyne-airflow-unfactor`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [gabcoyne](https://agentstack.voostack.com/s/gabcoyne)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [gabcoyne](https://github.com/gabcoyne)
- **Source:** https://github.com/gabcoyne/airflow-unfactor
- **Website:** https://gabcoyne.github.io/airflow-unfactor

## Install

```sh
agentstack add mcp-gabcoyne-airflow-unfactor
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# airflow-unfactor

[](https://github.com/gabcoyne/airflow-unfactor/actions/workflows/test.yml)
[](https://pypi.org/project/airflow-unfactor/)
[](LICENSE)

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](https://github.com/jlowin/fastmcp).

## Install

[](https://cursor.com/install-mcp?name=airflow-unfactor&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJhaXJmbG93LXVuZmFjdG9yIl19)
[](https://insiders.vscode.dev/redirect/mcp/install?name=airflow-unfactor&config=%7B%22name%22%3A%22airflow-unfactor%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22airflow-unfactor%22%5D%7D)

**Claude Code** — one line:

```bash
claude mcp add airflow-unfactor -- uvx airflow-unfactor
```

**Claude Desktop** and other clients — see [manual config](#manual-config) below.

Then ask your LLM: *"Convert the DAG in `dags/my_etl.py` to a Prefect flow."*

## 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.

## 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`.

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json

```json
{
  "mcpServers": {
    "airflow-unfactor": {
      "command": "uvx",
      "args": ["airflow-unfactor"]
    }
  }
}
```

Claude Code — .mcp.json in your project

```json
{
  "mcpServers": {
    "airflow-unfactor": {
      "command": "uvx",
      "args": ["airflow-unfactor"]
    }
  }
}
```

Cursor — MCP settings

```json
{
  "mcpServers": {
    "airflow-unfactor": {
      "command": "uvx",
      "args": ["airflow-unfactor"]
    }
  }
}
```

## Example

**Airflow DAG:**
```python
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:**
```python
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](https://gabcoyne.github.io/airflow-unfactor)

## Development

```bash
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](LICENSE).

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [gabcoyne](https://github.com/gabcoyne)
- **Source:** [gabcoyne/airflow-unfactor](https://github.com/gabcoyne/airflow-unfactor)
- **License:** MIT
- **Homepage:** https://gabcoyne.github.io/airflow-unfactor

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-gabcoyne-airflow-unfactor
- Seller: https://agentstack.voostack.com/s/gabcoyne
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
