mcp-airflow-api 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_airflow_api-0.0.2/PKG-INFO +10 -0
- mcp_airflow_api-0.0.2/README.md +0 -0
- mcp_airflow_api-0.0.2/pyproject.toml +12 -0
- mcp_airflow_api-0.0.2/setup.cfg +4 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api/airflow_api.py +47 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api/functions.py +12 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api.egg-info/PKG-INFO +10 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api.egg-info/SOURCES.txt +9 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api.egg-info/dependency_links.txt +1 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api.egg-info/requires.txt +4 -0
- mcp_airflow_api-0.0.2/src/mcp_airflow_api.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-airflow-api
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Model Context Protocol (MCP) server for Apache Airflow API integration. Provides comprehensive tools for managing Airflow clusters including service operations, configuration management, status monitoring, and request tracking.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: fastapi>=0.116.1
|
|
8
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
9
|
+
Requires-Dist: requests>=2.32.4
|
|
10
|
+
Requires-Dist: uvicorn>=0.35.0
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-airflow-api"
|
|
3
|
+
version = "0.0.2"
|
|
4
|
+
description = "Model Context Protocol (MCP) server for Apache Airflow API integration. Provides comprehensive tools for managing Airflow clusters including service operations, configuration management, status monitoring, and request tracking."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"fastapi>=0.116.1",
|
|
9
|
+
"python-dotenv>=1.1.1",
|
|
10
|
+
"requests>=2.32.4",
|
|
11
|
+
"uvicorn>=0.35.0",
|
|
12
|
+
]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Main feature definitions for Airflow MCP.
|
|
3
|
+
"""
|
|
4
|
+
import os
|
|
5
|
+
from fastapi import APIRouter, HTTPException
|
|
6
|
+
from dotenv import load_dotenv
|
|
7
|
+
import requests
|
|
8
|
+
from .functions import airflow_request
|
|
9
|
+
|
|
10
|
+
load_dotenv(dotenv_path=os.getenv("MCP_CONFIG", "config"))
|
|
11
|
+
|
|
12
|
+
AIRFLOW_API_URL = os.getenv("AIRFLOW_API_URL")
|
|
13
|
+
AIRFLOW_API_TOKEN = os.getenv("AIRFLOW_API_TOKEN")
|
|
14
|
+
|
|
15
|
+
router = APIRouter()
|
|
16
|
+
|
|
17
|
+
# MCP tool: DAG 목록 조회
|
|
18
|
+
@router.get("/dags", tags=["airflow"])
|
|
19
|
+
def list_dags():
|
|
20
|
+
resp = airflow_request("GET", f"{AIRFLOW_API_URL}/dags")
|
|
21
|
+
if resp.status_code != 200:
|
|
22
|
+
raise HTTPException(status_code=resp.status_code, detail=resp.text)
|
|
23
|
+
return resp.json()
|
|
24
|
+
|
|
25
|
+
# MCP tool: 실행 중인 DAG 조회
|
|
26
|
+
@router.get("/dags/running", tags=["airflow"])
|
|
27
|
+
def running_dags():
|
|
28
|
+
resp = airflow_request("GET", f"{AIRFLOW_API_URL}/dags?state=running")
|
|
29
|
+
if resp.status_code != 200:
|
|
30
|
+
raise HTTPException(status_code=resp.status_code, detail=resp.text)
|
|
31
|
+
return resp.json()
|
|
32
|
+
|
|
33
|
+
# MCP tool: 최근 실패한 DAG 조회
|
|
34
|
+
@router.get("/dags/failed", tags=["airflow"])
|
|
35
|
+
def failed_dags():
|
|
36
|
+
resp = airflow_request("GET", f"{AIRFLOW_API_URL}/dags?state=failed")
|
|
37
|
+
if resp.status_code != 200:
|
|
38
|
+
raise HTTPException(status_code=resp.status_code, detail=resp.text)
|
|
39
|
+
return resp.json()
|
|
40
|
+
|
|
41
|
+
# MCP tool: DAG 실행 트리거
|
|
42
|
+
@router.post("/dags/{dag_id}/trigger", tags=["airflow"])
|
|
43
|
+
def trigger_dag(dag_id: str):
|
|
44
|
+
resp = airflow_request("POST", f"{AIRFLOW_API_URL}/dags/{dag_id}/dagRuns")
|
|
45
|
+
if resp.status_code != 200:
|
|
46
|
+
raise HTTPException(status_code=resp.status_code, detail=resp.text)
|
|
47
|
+
return resp.json()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Airflow MCP auxiliary utility functions definition file
|
|
3
|
+
"""
|
|
4
|
+
import os
|
|
5
|
+
import requests
|
|
6
|
+
|
|
7
|
+
def airflow_request(method, url, **kwargs):
|
|
8
|
+
user = os.getenv("AIRFLOW_API_USER")
|
|
9
|
+
password = os.getenv("AIRFLOW_API_PASSWORD")
|
|
10
|
+
headers = kwargs.pop("headers", {})
|
|
11
|
+
auth = (user, password) if user and password else None
|
|
12
|
+
return requests.request(method, url, headers=headers, auth=auth, **kwargs)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-airflow-api
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Model Context Protocol (MCP) server for Apache Airflow API integration. Provides comprehensive tools for managing Airflow clusters including service operations, configuration management, status monitoring, and request tracking.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: fastapi>=0.116.1
|
|
8
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
9
|
+
Requires-Dist: requests>=2.32.4
|
|
10
|
+
Requires-Dist: uvicorn>=0.35.0
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/mcp_airflow_api/airflow_api.py
|
|
4
|
+
src/mcp_airflow_api/functions.py
|
|
5
|
+
src/mcp_airflow_api.egg-info/PKG-INFO
|
|
6
|
+
src/mcp_airflow_api.egg-info/SOURCES.txt
|
|
7
|
+
src/mcp_airflow_api.egg-info/dependency_links.txt
|
|
8
|
+
src/mcp_airflow_api.egg-info/requires.txt
|
|
9
|
+
src/mcp_airflow_api.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcp_airflow_api
|