agents / astro-airflow-mcp
AGENTS.md448 starsChanged 59 days agoApache-2.0View on GitHub
Guidelines for AI coding assistants contributing to this repository. MCP server for Apache Airflow with adapter pattern for version compatibility: Use httpx, not requests. All HTTP calls should use httpx.Client and pass self._verify for SSL configuration: All Airflow API calls go through adapters. Never call Airflow API directly from MCP tools: When adding new API endpoints: 1. Add abstract method to adapters/base.py 2. Implement in both airflow_v2.py and airflow_v3.py 3. Handle API differences (field names, paths, availability) Tools need descriptive…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- astro-airflow-mcp/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- airflow-hitlSkill
- airflow-pluginsSkill
- airflowSkill
- airflow-state-storeSkill
- analyzing-dataSkill
- annotating-task-lineageSkill
- authoring-dagsSkill
- authoring-go-sdk-tasksSkill
- authoring-java-sdk-tasksSkill
- authoring-language-sdk-tasksSkill
- blueprintSkill
- checking-freshnessSkill
- configuring-airflow-language-sdksSkill
- cosmos-dbt-coreSkill
- cosmos-dbt-fusionSkill
- creating-openlineage-extractorsSkill
- dag-factorySkill
- debugging-dagsSkill
- delegating-to-ottoSkill
- deploying-airflowSkill
- deploying-go-sdk-bundlesSkill
- deploying-java-sdk-bundlesSkill
- managing-astro-deploymentsSkill
- managing-astro-local-envSkill
- migrating-airflow-2-to-3Skill
- migrating-ai-sdk-to-common-aiSkill
- migrating-dagster-to-airflowSkill
- profiling-tablesSkill
- setting-up-astro-projectSkill
- testing-dagsSkill
- tracing-downstream-lineageSkill
- tracing-upstream-lineageSkill
- troubleshooting-astro-deploymentsSkill
- warehouse-initSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 50
Use httpx, not requests. All HTTP calls should use httpx.Client and pass self._verify for SSL configuration:
- Distinctive: line 63
All Airflow API calls go through adapters.
- Distinctive: line 74
When adding new API endpoints:
- Very specific: line 75
Add abstract method to adapters/base.py
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- START doctoc generated TOC please keep comment here to allow auto update --><!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->Table of Contents generated with DocToc
- Agent Guidelines for astro-airflow-mcp
- Architecture
- Code Conventions
- HTTP Client
- Adapter Pattern
- MCP Tools
- Error Handling
- Airflow Version Differences
- Testing
- Files to Know
<!-- END doctoc generated TOC please keep comment here to allow auto update -->Agent Guidelines for astro-airflow-mcp
Guidelines for AI coding assistants contributing to this repository.
Architecture
MCP server for Apache Airflow with adapter pattern for version compatibility:
src/astro_airflow_mcp/
├── server.py # Core infrastructure: config, auth, adapter management (FastMCP)
├── tools/ # MCP tool implementations (grouped by domain)
│ ├── dag.py # DAG management (get, list, source, stats, pause, unpause)
│ ├── task.py # Task management (get, list, instance, logs, clear)
│ ├── dag_run.py # DAG run management (list, get, trigger, trigger_and_wait, delete, clear)
│ ├── asset.py # Asset/dataset tools (list, events, upstream events)
│ ├── admin.py # Admin tools (connections, variables, pools, plugins, providers, config, version)
│ └── diagnostic.py # Diagnostic tools (warnings, errors, explore, diagnose, health)
├── resources.py # MCP resources (read-only endpoints)
├── prompts.py # MCP prompts (guided workflows)
├── adapters/
│ ├── base.py # Abstract adapter interface
│ ├── airflow_v2.py # Airflow 2.x API (/api/v1)
│ └── airflow_v3.py # Airflow 3.x API (/api/v2)
├── models.py # Pydantic models (documentation/type reference)
└── plugin.py # Airflow 3.x plugin integrationCode Conventions
HTTP Client
Use httpx, not requests. All HTTP calls should use httpx.Client and pass self._verify for SSL configuration:
# Good
with httpx.Client(timeout=30.0, verify=self._verify) as client:
response = client.get(url, headers=headers)
# Bad
response = requests.get(url, headers=headers)Adapter Pattern
All Airflow API calls go through adapters. Never call Airflow API directly from MCP tools:
# Good - use adapter
adapter = _get_adapter()
data = adapter.list_dags(limit=100)
# Bad - direct API call
response = httpx.get(f"{url}/api/v2/dags")When adding new API endpoints:
- Add abstract method to
adapters/base.py - Implement in both
airflow_v2.pyandairflow_v3.py - Handle API differences (field names, paths, availability)
MCP Tools
Tools need descriptive docstrings for AI discovery:
@mcp.tool()
def get_dag_details(dag_id: str) -> str:
"""Get detailed information about a specific DAG.
Use this tool when the user asks about:
- "Show me details for DAG X"
- "What's the schedule for DAG Y?"
Args:
dag_id: The ID of the DAG
Returns:
JSON with DAG metadata
"""Error Handling
Adapters handle missing endpoints gracefully:
try:
return self._call("newEndpoint")
except NotFoundError:
return self._handle_not_found(
"newEndpoint",
alternative="Use alternativeEndpoint instead"
)Airflow Version Differences
| Feature | Airflow 2.x | Airflow 3.x |
| API path | /api/v1 | /api/v2 |
| Auth | Basic auth | OAuth2/JWT |
| Assets | datasets | assets |
| DAG runs | execution_date | logical_date |
Testing
- Mock adapters, not HTTP libraries
- Unit tests:
tests/ - Integration tests:
tests/integration/(require running Airflow)
# Good - mock adapter (patch in the tool module that imports it)
mock_adapter = mocker.Mock()
mock_adapter.list_dags.return_value = {"dags": [...]}
mocker.patch("astro_airflow_mcp.tools.dag._get_adapter", return_value=mock_adapter)
# Bad - mock HTTP library
mocker.patch("httpx.Client")Files to Know
server.py: All MCP tools defined hereadapters/base.py: Interface contract for both versionsmodels.py: Type reference (not used for validation currently)docker-compose.test.yml: Test against real Airflow instances
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

