MCP-Airflow-API
Copilot instructions52 starsChanged 4 months agoMITView on GitHub
Key Components: - src/mcp_airflow_api/airflow_api.py: 40+ @mcp.tool() decorators defining Airflow operations - src/mcp_airflow_api/functions.py: Global session management with connection pooling - src/mcp_airflow_api/prompt_template.md: Canonical English instructions for LLMs - pyproject.toml: Entry point mcp-airflow-api = "mcp_airflow_mcp_main:main" Transport Logic: Environment variable FASTMCP_TYPE controls stdio vs http mode: Pagination Strategy: All tools return {data, total_entries, limit, offset, has_more_pages, next_offset}: Configuration Files: Multiple configs for different deployment modes: - mcp-config.json.stdio: Local python -m mcp_airflow_mcp_main - mcp-config.json.http: Docker "url": "http://host.docker.internal:18002/mcp" Build Commands: Use versioned Docker images: Airflow Version:…
The file
We split this copilot-instructions.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Connection Pooling: Use global _airflow_session for performance:
- Very specific: line 28
Pagination Strategy: All tools return {data, total_entries, limit, offset, has_more_pages, next_offset}:
- Distinctive: line 45
Build Commands: Use versioned Docker images:
- Very specific: line 52
Use TEMPLATE_CONFIG constants for validation thresholds
- Distinctive: line 53
Test structure/behavior, not exact content
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot Instructions for MCP-Airflow-API
Project Architecture
Core Pattern: MCP (Model Context Protocol) server exposing Apache Airflow REST API as LLM-friendly tools.
Key Components:
src/mcp_airflow_api/airflow_api.py: 40+@mcp.tool()decorators defining Airflow operationssrc/mcp_airflow_api/functions.py: Global session management with connection poolingsrc/mcp_airflow_api/prompt_template.md: Canonical English instructions for LLMspyproject.toml: Entry pointmcp-airflow-api = "mcp_airflow_mcp_main:main"
Transport Logic: Environment variable FASTMCP_TYPE controls stdio vs http mode:
transport_type = args.transport_type or os.getenv("FASTMCP_TYPE", "stdio")
if transport_type == "streamable-http":
mcp.run(transport="streamable-http", host=host, port=port) # Docker mode
else:
mcp.run(transport='stdio') # Local modeCritical Patterns
Connection Pooling: Use global _airflow_session for performance:
# functions.py - persistent session with retry strategy
_airflow_session = requests.Session() # Reused across all API callsPagination Strategy: All tools return {data, total_entries, limit, offset, has_more_pages, next_offset}:
# Standard pattern in airflow_api.py
def list_dags(limit=20, offset=0):
# Returns pagination metadata for large environments (1000+ DAGs)Configuration Files: Multiple configs for different deployment modes:
mcp-config.json.stdio: Localpython -m mcp_airflow_mcp_mainmcp-config.json.http: Docker"url": "http://host.docker.internal:18002/mcp"
Docker Multi-Service Pattern
docker-compose.yml orchestrates 3 services:
mcp-server: FastMCP server (port 18002→8080 internal)mcpo-proxy: MCP-to-REST converter (Swagger at :8002/docs)open-webui: Web interface (port 3002)
Build Commands: Use versioned Docker images:
./build-mcp-server-docker-image.sh # Builds call518/mcp-server-airflow-api:1.0.0Testing Philosophy
Tests in tests/test_prompt_template.py are "resilient to template content changes":
- Use
TEMPLATE_CONFIGconstants for validation thresholds - Test structure/behavior, not exact content
- Fixture-based template loading for performance
Environment Requirements
Required: AIRFLOW_API_BASE_URL, AIRFLOW_API_USERNAME, AIRFLOW_API_PASSWORD
Optional: AIRFLOW_API_VERSION (defaults to 'v1'), MCP_LOG_LEVEL (DEBUG/INFO/WARNING/ERROR/CRITICAL), FASTMCP_TYPE (stdio/streamable-http), FASTMCP_PORT (transport control)
Airflow Version: Tested with 2.10.2 API v1 - all endpoints assume this version
Development Workflow
- Local testing:
python -m mcp_airflow_mcp_main(stdio mode) - Docker development:
docker-compose up -dthen check http://localhost:8002/docs - Testing:
pytest tests/(uses resilient template validation)
Key files: airflow_api.py (tools), functions.py (HTTP layer), prompt_template.md (LLM guidance)
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.

