MCP integration
AutoAir exposes DAG authoring to AI agents through a Model Context Protocol (MCP) server: agents can search the operator catalog, read the DagSpec schema, validate and patch specs, generate code, review DAGs, read Airflow run state and, with explicit confirmation, save DAGs and trigger runs. Use MCP when the client is an agent (Claude Code, Claude Desktop, IDE agents, your own agent framework); use the REST API for scripts and CI.
The full tool, resource and prompt catalogue is on MCP server; the sections below are what an integrator needs.
Endpoints
| Where | URL / command | Authentication |
|---|---|---|
| Plugin (inside Airflow) | https://<airflow-host>/autoair/mcp/ (streamable HTTP) | Airflow's auth manager: Authorization: Bearer <airflow token> |
| Standalone server | https://<autoair-host>/mcp/ | Bearer token verified against Airflow |
| Separate AI service | /mcp on autoair ai-serve (ai.service.serve_mcp), or proxied through the main server with ai.service.proxy_mcp=true | Main server auth, then the signed identity |
| Standalone MCP process | autoair mcp-serve --http (HTTP at /mcp/), or stdio: autoair mcp-serve, autoair mcp, autoair-mcp | HTTP: bearer token verified against Airflow; stdio: AUTOAIR_AIRFLOW_TOKEN |
The MCP endpoint needs the mcp extra (pip install 'autoair[mcp]') and features.mcp=true (default). Without the extra the endpoint is not mounted and the server logs MCP endpoint disabled.
Connect a client
Remote, through Airflow (Claude Code):
claude mcp add --transport http autoair https://airflow.example.com/autoair/mcp/ \
--header "Authorization: Bearer $AIRFLOW_TOKEN"
Local, over stdio:
claude mcp add autoair -e AIRFLOW_HOME=$AIRFLOW_HOME -e AUTOAIR_AIRFLOW_TOKEN=$AIRFLOW_TOKEN -- autoair mcp
Any MCP client that supports streamable HTTP and custom headers can connect the same way. Obtain the token from Airflow as described in REST API.
Safety model
- Same identity, same RBAC. Over HTTP the endpoint sits behind the same authentication as the API, and the caller's credentials are forwarded to Airflow, so Airflow's permissions apply to every Airflow tool.
- Writes need confirmation.
save_dag_spec,delete_dag_specandtrigger_dagonly act withconfirm=true; without it they describe what would happen. - Read-only switch.
AUTOAIR_AI__MCP__ALLOW_WRITES=falserefuses those tools entirely. - No secrets out. Connection and variable values and run
confare never returned. - Code execution is gated.
import_python_dagruns the file in an isolated subprocess without AutoAir's secrets and requiresallow_python_code. - Route permissions do not apply. MCP tools call AutoAir's services directly and do not go through the REST routes' AutoAir permission checks; restrict who can reach
/mcp, and useallow_writes=falsewhere agents should only read. See IAM.
Typical agent workflow
get_dagspec_schemaandsearch_knowledge/list_operatorsto learn the format and the available operators.- Build or modify a spec;
apply_spec_patchedits by node id. validate_dag_specuntil there are no errors;generate_codeto show the Python.review_dag_specandscan_dag_leaksfor a second opinion.save_dag_specwithconfirm=trueto deploy through the normal pipeline (validation, policy, approvals, git pull requests).
AutoAir as an MCP client
The reverse direction also exists: AutoAir's own AI agents can use external MCP servers (metrics, ticketing, runbooks) as tools, configured in ai.mcp_client.servers or the admin panel. See AI troubleshooting.