MCP-Airflow-API
Description
MCP-Airflow-API is an MCP server that leverages the Model Context Protocol (MCP) to transform Apache Airflow REST API operations into natural language tools. This project hides the complexity of API structures and enables intuitive management of Airflow clusters through natural…
About
MCP-Airflow-API is an MCP server that leverages the Model Context Protocol (MCP) to transform Apache Airflow REST API operations into natural language tools. This project hides the complexity of API structures and enables intuitive management of Airflow clusters through natural language commands.
Details
- Author
- call518
- Categories
- Other, Developer Tools
Jump to
🎯 Recommended: Docker Compose (Complete Demo Environment)
git clone https://github.com/call518/MCP-Airflow-API.git cd MCP-Airflow-API # Configure your Airflow credentials cp .env.example .env # Edit .env with your Airflow API settings # Start all services docker-compose up -d # Access OpenWebUI at http://localhost:3002/ # API documentation at http://localhost:8002/docs
Getting Started with OpenWebUI (Docker Option)
📌Note: Web-UI configuration instructions are based on OpenWebUIv0.6.22. Menu locations and settings may differ in newer versions.
- Access](https://github.com/call518/Airflow-Docker-Compose)[http://localhost:3002/
- Log in with admin account
- Go to "Settings" → "Tools" from the top menu
- Add Tool URL:http://localhost:8002/airflow-api
- Configure your LLM provider (Ollama, OpenAI, etc.)
Option 3: Deploy Both Versions Simultaneously
For comprehensive testing across different Airflow versions:
# Start Airflow 2.x (port 38080) cd airflow-2.x && ./run-airflow-cluster.sh # Start Airflow 3.x (port 48080) cd ../airflow-3.x && ./run-airflow-cluster.sh
To stop and clean up the test environments:
# For Airflow 2.x cd airflow-2.x && ./cleanup-airflow-cluster.sh # For Airflow 3.x cd airflow-3.x && ./cleanup-airflow-cluster.sh
- Scalable design and modular structure for easy addition of new features
- Standards-compliant protocol for integration with other tools
- Cloud-native operations and LLM-ready interface
- Context-aware query processing and automated workflow management capabilities
- Data Engineers— Reduce debugging time, improve productivity, minimize learning curve
- DevOps Engineers— Automate infrastructure monitoring, reduce incident response time
- System Administrators— User-friendly management without complex APIs, real-time cluster status monitoring
Revolutionary Open Source Tool for Managing Apache Airflow with Natural Language
Have you ever wondered how amazing it would be if you could manage your Apache Airflow workflows using natural language instead of complex REST API calls or web interface manipulations?MCP-Airflow-APIis the revolutionary open-source project that makes this goal a reality.
MCP-Airflow-API is an MCP server that leverages theModel Context Protocol (MCP)to transform Apache Airflow REST API operations into natural language tools. This project hides the complexity of API structures and enables intuitive management of Airflow clusters through natural language commands.
Now supports both Airflow API v1 (2.x) and v2 (3.0+)with dynamic version selection via environment variable:
- API v1: Full compatibility with Airflow 2.x clusters (43 tools) -Documentation
- API v2: Enhanced features for Airflow 3.0+ including asset management for data-aware scheduling (45 tools) -Documentation
Key Architecture: Single MCP server with shared common tools (43) plus v2-exclusive asset tools (2) - dynamically loads appropriate toolset based onAIRFLOW_API_VERSIONenvironment variable!
curl -X GET "http://localhost:8080/api/v1/dags?limit=100&offset=0" \ -H "Authorization: Basic YWlyZmxvdzphaXJmbG93"
MCP-Airflow-API approach (natural language):
"Show me the currently running DAGs"
📝 Need a test Airflow cluster?Use our companion projectAirflow-Docker-Composewith support for bothAirflow 2.xandAirflow 3.xenvironments!
🎯 Recommended: Docker Compose (Complete Demo Environment)
git clone https://github.com/call518/MCP-Airflow-API.git cd MCP-Airflow-API # Configure your Airflow credentials cp .env.example .env # Edit .env with your Airflow API settings # Start all services docker-compose up -d # Access OpenWebUI at http://localhost:3002/ # API documentation at http://localhost:8002/docs
Getting Started with OpenWebUI (Docker Option)
📌Note: Web-UI configuration instructions are based on OpenWebUIv0.6.22. Menu locations and settings may differ in newer versions.
- Accesshttp://localhost:3002/
- Log in with admin account
- Go to "Settings" → "Tools" from the top menu
- Add Tool URL:http://localhost:8002/airflow-api
- Configure your LLM provider (Ollama, OpenAI, etc.)
Method 2: Claude-Desktop MCP Client Integration
{ "mcpServers": { "mcp-airflow-api": { "command": "uvx", "args": ["--python", "3.12", "mcp-airflow-api"], "env": { "AIRFLOW_API_VERSION": "v2", "AIRFLOW_API_BASE_URL": "http://localhost:8080/api", "AIRFLOW_API_USERNAME": "airflow", "AIRFLOW_API_PASSWORD": "airflow" } } } }git
Remote Access (streamable-http mode without authentication)
{ "mcpServers": { "mcp-airflow-api": { "type": "streamable-http", "url": "http://localhost:8000/mcp" } } }
Remote Access (streamable-http mode with Bearer token authentication - Recommended)
{ "mcpServers": { "mcp-airflow-api": { "type": "streamable-http", "url": "http://localhost:8000/mcp", "headers": { "Authorization": "Bearer your-secure-secret-key-here" } } } }
Multiple Airflow Clusters with Different Versions
{ "mcpServers": { "airflow-2x-cluster": { "command": "uvx", "args": ["--python", "3.12", "mcp-airflow-api"], "env": { "AIRFLOW_API_VERSION": "v1", "AIRFLOW_API_BASE_URL": "http://localhost:38080/api", "AIRFLOW_API_USERNAME": "airflow", "AIRFLOW_API_PASSWORD": "airflow" } }, "airflow-3x-cluster": { "command": "uvx", "args": ["--python", "3.12", "mcp-airflow-api"], "env": { "AIRFLOW_API_VERSION": "v2", "AIRFLOW_API_BASE_URL": "http://localhost:48080/api", "AIRFLOW_API_USERNAME": "airflow", "AIRFLOW_API_PASSWORD": "airflow" } } } }
💡 Pro Tip: Use the test clusters fromAirflow-Docker-Composefor the above configuration - they run on ports 38080 (2.x) and 48080 (3.x) respectively!
git clone https://github.com/call518/MCP-Airflow-API.git cd MCP-Airflow-API pip install -e . # Run in stdio mode python -m mcp_airflow_api
-
Natural Language Queries
No need to learn complex API syntax. Just ask as you would naturally speak:
- "What DAGs are currently running?"
- "Show me the failed tasks"
- "Find DAGs containing ETL"
Comprehensive Monitoring Capabilities
Real-time cluster status monitoring:
- Cluster health monitoring
- DAG status and performance analysis
- Task execution log tracking
- XCom data management
Dynamic API Version Support
Single MCP server adapts to your Airflow version:
- API v1: 43 shared tools for Airflow 2.x compatibility
- API v2: 43 shared tools + 2 asset management tools for Airflow 3.0+
- Environment Variable Control: Switch versions instantly withAIRFLOW_API_VERSION
- Zero Configuration Changes: Same tool names, enhanced capabilities
- Efficient Architecture: Shared common codebase eliminates duplication
Comprehensive Tool Coverage
Covers almost all Airflow API functionality:
- DAG management (trigger, pause, resume)
- Task instance monitoring
- Pool and variable management
- Connection configuration
- Configuration queries
- Event log analysis
Large Environment Optimization
Efficiently handles large environments with 1000+ DAGs:
- Smart pagination support
- Advanced filtering options
- Batch processing capabilities
-
Leveraging Model Context Protocol (MCP)
MCP is an open standard for secure connections between AI applications and data sources, providing:
- Standardized interface
- Secure data access
- Scalable architecture
- stdiomode: Direct MCP client integration for local environments
- streamable-httpmode: HTTP-based deployment for Docker and remote access
FASTMCP_TYPE=stdio # Default: Direct MCP client mode FASTMCP_TYPE=streamable-http # Docker/HTTP mode FASTMCP_PORT=8000 # HTTP server port (Docker internal)
Comprehensive Airflow API Coverage
Full implementation of official Airflow REST APIs:
- API v1 Support: Based onAirflow 2.x REST API
- API v2 Support: Based onAirflow 3.0+ REST API
- Dynamic Version Selection: Runtime switching between API versions
- Feature Parity: Complete endpoint coverage for both versions
Complete Docker Support
Full Docker Compose setup with 3 separate services:
- Open WebUI: Web interface (port3002)
- MCP Server: Airflow API tools (internal port8000, exposed via18002)
- MCPO Proxy: REST API endpoint provider (port8002)
# Required - Dynamic API Version Selection (NEW!) # Single server supports both v1 and v2 - just change this variable! AIRFLOW_API_VERSION=v1 # v1 for Airflow 2.x, v2 for Airflow 3.0+ AIRFLOW_API_BASE_URL=http://localhost:8080/api # Test Cluster Connection Examples: # For Airflow 2.x test cluster (from Airflow-Docker-Compose) AIRFLOW_API_VERSION=v1 AIRFLOW_API_BASE_URL=http://localhost:38080/api # For Airflow 3.x test cluster (from Airflow-Docker-Compose) AIRFLOW_API_VERSION=v2 AIRFLOW_API_BASE_URL=http://localhost:48080/api # Authentication AIRFLOW_API_USERNAME=airflow AIRFLOW_API_PASSWORD=airflow # Optional - MCP Server Configuration MCP_LOG_LEVEL=INFO # DEBUG/INFO/WARNING/ERROR/CRITICAL FASTMCP_TYPE=stdio # stdio/streamable-http FASTMCP_PORT=8000 # HTTP server port (Docker mode) # Bearer Token Authentication for streamable-http mode # Enable authentication (recommended for production) # Default: false (when undefined, empty, or null) # Values: true/false, 1/0, yes/no, on/off (case insensitive) REMOTE_AUTH_ENABLE=false # true/false REMOTE_SECRET_KEY=your-secure-secret-key-here
- API v1:Airflow 2.x REST API Reference
- API v2:Airflow 3.0+ REST API Reference
Forstreamable-httpmode, this MCP server supports Bearer token authentication to secure remote access. This is especially important when running the server in production environments.
# In .env file REMOTE_AUTH_ENABLE=true REMOTE_SECRET_KEY=your-secure-secret-key-here
python -m mcp_airflow_api --type streamable-http --auth-enable --secret-key your-secure-secret-key-here
- stdio mode(Default): Local-only access, no authentication needed
- streamable-http + REMOTE_AUTH_ENABLE=false: Remote access without authentication ⚠️NOT RECOMMENDED for production
- streamable-http + REMOTE_AUTH_ENABLE=true: Remote access with Bearer token authentication ✅RECOMMENDED for production
Note:REMOTE_AUTH_ENABLEdefaults tofalsewhen undefined, empty, or null. Supported values aretrue/false,1/0,yes/no,on/off(case insensitive).
When authentication is enabled, MCP clients must include the Bearer token in the Authorization header:
{ "mcpServers": { "mcp-airflow-api": { "type": "streamable-http", "url": "http://your-server:8000/mcp", "headers": { "Authorization": "Bearer your-secure-secret-key-here" } } } }
- Always enable authenticationwhen using streamable-http mode in production
- Use strong, randomly generated secret keys(32+ characters recommended)
- Use HTTPSwhen possible (configure reverse proxy with SSL/TLS)
- Restrict network accessusing firewalls or network policies
- Rotate secret keys regularlyfor enhanced security
- Monitor access logsfor unauthorized access attempts
When authentication fails, the server returns:
- 401 Unauthorizedfor missing or invalid tokens
- Detailed error messagesin JSON format for debugging
version: '3.8' services: mcp-server: build: context: . dockerfile: Dockerfile.MCP-Server environment: - FASTMCP_PORT=8000 - AIRFLOW_API_VERSION=v1 - AIRFLOW_API_BASE_URL=http://your-airflow:8080/api - AIRFLOW_API_USERNAME=airflow - AIRFLOW_API_PASSWORD=airflow
git clone https://github.com/call518/MCP-Airflow-API.git cd MCP-Airflow-API pip install -e . # Run in stdio mode python -m mcp_airflow_api
For testing and development, use our companion projectAirflow-Docker-Composewhich supports both Airflow 2.x and 3.x environments.
- Clone the test environment repository:
git clone https://github.com/call518/Airflow-Docker-Compose.git cd Airflow-Docker-Compose
For testingAPI v1compatibility with stable production features:
# Navigate to Airflow 2.x environment cd airflow-2.x # (Optional) Customize environment variables cp .env.template .env # Edit .env file as needed # Deploy Airflow 2.x cluster ./run-airflow-cluster.sh # Access Web UI # URL: http://localhost:38080 # Username: airflow / Password: airflow
- Image:apache/airflow:2.10.2
- Port:38080(configurable viaAIRFLOW_WEBSERVER_PORT)
- API:/api/v1/endpoints
- Authentication: Basic Auth
- Use case: Production-ready, stable features
For testingAPI v2with latest features including Assets management:
# Navigate to Airflow 3.x environment cd airflow-3.x # (Optional) Customize environment variables cp .env.template .env # Edit .env file as needed # Deploy Airflow 3.x cluster ./run-airflow-cluster.sh # Access API Server # URL: http://localhost:48080 # Username: airflow / Password: airflow
- Image:apache/airflow:3.0.6
- Port:48080(configurable viaAIRFLOW_APISERVER_PORT)
- API:/api/v2/endpoints + Assets management
- Authentication: JWT Token (FabAuthManager)
- Use case: Development, testing new features
Option 3: Deploy Both Versions Simultaneously
For comprehensive testing across different Airflow versions:
# Start Airflow 2.x (port 38080) cd airflow-2.x && ./run-airflow-cluster.sh # Start Airflow 3.x (port 48080) cd ../airflow-3.x && ./run-airflow-cluster.sh
To stop and clean up the test environments:
# For Airflow 2.x cd airflow-2.x && ./cleanup-airflow-cluster.sh # For Airflow 3.x cd airflow-3.x && ./cleanup-airflow-cluster.sh
- Scalable design and modular structure for easy addition of new features
- Standards-compliant protocol for integration with other tools
- Cloud-native operations and LLM-ready interface
- Context-aware query processing and automated workflow management capabilities
- Data Engineers— Reduce debugging time, improve productivity, minimize learning curve
- DevOps Engineers— Automate infrastructure monitoring, reduce incident response time
- System Administrators— User-friendly management without complex APIs, real-time cluster status monitoring
🚀 Open Source Contribution and Community
Repository:https://github.com/call518/MCP-Airflow-API
- Bug reports and feature suggestions
- Documentation improvements
- Code contributions
Please consider starring the project if you find it useful.
MCP-Airflow-API changes the paradigm of data engineering and workflow management:
No need to memorize REST API calls — just ask in natural language:
"Show me the status of currently running ETL jobs."
#Apache-Airflow #MCP #ModelContextProtocol #DataEngineering #DevOps #WorkflowAutomation #NaturalLanguage #OpenSource #Python #Docker #AI-Integration
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





