mcp-server-apache-airflow

mcp-server-apache-airflow avatar

by yangkyeongmo

pypi.org/project/mcp-server-apache-airflow/

What is mcp-server-apache-airflow

mcp-server-apache-airflow

*smithery badge*

A Model Context Protocol (MCP) server implementation for Apache Airflow, enabling seamless integration with MCP clients. This project provides a standardized way to interact with Apache Airflow through the Model Context Protocol.

About

This project implements a Model Context Protocol server that wraps Apache Airflow's REST API, allowing MCP clients to interact with Airflow in a standardized way. It uses the official Apache Airflow client library to ensure compatibility and maintainability.

Feature Implementation Status

Feature API Path Status
DAG Management
List DAGs /api/v1/dags āœ…
Get DAG Details /api/v1/dags/{dag_id} āœ…
Pause DAG /api/v1/dags/{dag_id} āœ…
Unpause DAG /api/v1/dags/{dag_id} āœ…
Update DAG /api/v1/dags/{dag_id} āœ…
Delete DAG /api/v1/dags/{dag_id} āœ…
Get DAG Source /api/v1/dagSources/{file_token} āœ…
Patch Multiple DAGs /api/v1/dags āœ…
Reparse DAG File /api/v1/dagSources/{file_token}/reparse āœ…
DAG Runs
List DAG Runs /api/v1/dags/{dag_id}/dagRuns āœ…
Create DAG Run /api/v1/dags/{dag_id}/dagRuns āœ…
Get DAG Run Details /api/v1/dags/{dag_id}/dagRuns/{dag_run_id} āœ…
Update DAG Run /api/v1/dags/{dag_id}/dagRuns/{dag_run_id} āœ…
Delete DAG Run /api/v1/dags/{dag_id}/dagRuns/{dag_run_id} āœ…
Get DAG Runs Batch /api/v1/dags/~/dagRuns/list āœ…
Clear DAG Run /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/clear āœ…
Set DAG Run Note /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/setNote āœ…
Get Upstream Dataset Events /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEvents āœ…
Tasks
List DAG Tasks /api/v1/dags/{dag_id}/tasks āœ…
Get Task Details /api/v1/dags/{dag_id}/tasks/{task_id} āœ…
Get Task Instance /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id} āœ…
List Task Instances /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances āœ…
Update Task Instance /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id} āœ…
Clear Task Instances /api/v1/dags/{dag_id}/clearTaskInstances āœ…
Set Task Instances State /api/v1/dags/{dag_id}/updateTaskInstancesState āœ…
Variables
List Variables /api/v1/variables āœ…
Create Variable /api/v1/variables āœ…
Get Variable /api/v1/variables/{variable_key} āœ…
Update Variable /api/v1/variables/{variable_key} āœ…
Delete Variable /api/v1/variables/{variable_key} āœ…
Connections
List Connections /api/v1/connections āœ…
Create Connection /api/v1/connections āœ…
Get Connection /api/v1/connections/{connection_id} āœ…
Update Connection /api/v1/connections/{connection_id} āœ…
Delete Connection /api/v1/connections/{connection_id} āœ…
Test Connection /api/v1/connections/test āœ…
Pools
List Pools /api/v1/pools āœ…
Create Pool /api/v1/pools āœ…
Get Pool /api/v1/pools/{pool_name} āœ…
Update Pool /api/v1/pools/{pool_name} āœ…
Delete Pool /api/v1/pools/{pool_name} āœ…
XComs
List XComs /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries āœ…
Get XCom Entry /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key} āœ…
Datasets
List Datasets /api/v1/datasets āœ…
Get Dataset /api/v1/datasets/{uri} āœ…
Get Dataset Events /api/v1/datasetEvents āœ…
Create Dataset Event /api/v1/datasetEvents āœ…
Get DAG Dataset Queued Event /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri} āœ…
Get DAG Dataset Queued Events /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents āœ…
Delete DAG Dataset Queued Event /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents/{uri} āœ…
Delete DAG Dataset Queued Events /api/v1/dags/{dag_id}/dagRuns/queued/datasetEvents āœ…
Get Dataset Queued Events /api/v1/datasets/{uri}/dagRuns/queued/datasetEvents āœ…
Delete Dataset Queued Events /api/v1/datasets/{uri}/dagRuns/queued/datasetEvents āœ…
Monitoring
Get Health /api/v1/health āœ…
DAG Stats
Get DAG Stats /api/v1/dags/statistics āœ…
Config
Get Config /api/v1/config āœ…
Plugins
Get Plugins /api/v1/plugins āœ…
Providers
List Providers /api/v1/providers āœ…
Event Logs
List Event Logs /api/v1/eventLogs āœ…
Get Event Log /api/v1/eventLogs/{event_log_id} āœ…
System
Get Import Errors /api/v1/importErrors āœ…
Get Import Error Details /api/v1/importErrors/{import_error_id} āœ…
Get Health Status /api/v1/health āœ…
Get Version /api/v1/version āœ…

Setup

Dependencies

This project depends on the official Apache Airflow client library (apache-airflow-client). It will be automatically installed when you install this package.

Environment Variables

Set the following environment variables:

AIRFLOW_HOST=<your-airflow-host>
AIRFLOW_USERNAME=<your-airflow-username>
AIRFLOW_PASSWORD=<your-airflow-password>

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-server-apache-airflow": {
      "command": "uvx",
      "args": ["mcp-server-apache-airflow"],
      "env": {
        "AIRFLOW_HOST": "https://your-airflow-host",
        "AIRFLOW_USERNAME": "your-username",
        "AIRFLOW_PASSWORD": "your-password"
      }
    }
  }
}

Alternative configuration using uv:

{
  "mcpServers": {
    "mcp-server-apache-airflow": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-apache-airflow",
        "run",
        "mcp-server-apache-airflow"
      ],
      "env": {
        "AIRFLOW_HOST": "https://your-airflow-host",
        "AIRFLOW_USERNAME": "your-username",
        "AIRFLOW_PASSWORD": "your-password"
      }
    }
  }
}

Replace /path/to/mcp-server-apache-airflow with the actual path where you've cloned the repository.

Selecting the API groups

You can select the API groups you want to use by setting the --apis flag.

uv run mcp-server-apache-airflow --apis "dag,dagrun"

The default is to use all APIs.

Allowed values are:

  • config
  • connections
  • dag
  • dagrun
  • dagstats
  • dataset
  • eventlog
  • importerror
  • monitoring
  • plugin
  • pool
  • provider
  • taskinstance
  • variable
  • xcom

Manual Execution

You can also run the server manually:

make run

make run accepts following options:

Options:

  • --port: Port to listen on for SSE (default: 8000)
  • --transport: Transport type (stdio/sse, default: stdio)

Or, you could run the sse server directly, which accepts same parameters:

make run-sse

Installing via Smithery

To install Apache Airflow MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @yangkyeongmo/mcp-server-apache-airflow --client claude

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.