Mcp Airflow Postgres

by gavinHuang

MCP Client
  • other

Operate airflow's postgresql directly

About

What is Mcp Airflow Postgres?

Mcp Airflow Postgres is a Model Context Protocol (MCP) server that connects to an Airflow PostgreSQL database, allowing users to query failed DAG runs and execute custom SQL. It runs locally via Python and is designed for developers and data engineers who want to integrate Airflow database interactions into MCP-compatible tools.

How to use Mcp Airflow Postgres?

Install Python 3.8+ and Poetry, clone the repository, run poetry install, create a .env file with a DATABASE_URL pointing to your Airflow PostgreSQL instance, then start the server with poetry run python src/server.py. The server can also be used with Smithery by providing the DATABASE_URL configuration as defined in smithery.yaml.

Key features of Mcp Airflow Postgres

- Connects to Airflow PostgreSQL databases via MCP
- Query failed DAG runs within a specified time period
- Execute arbitrary SQL queries directly
- Simple setup using Poetry and environment variables
- Compatible with the Smithery platform

Use cases of Mcp Airflow Postgres

- Monitor and inspect failed Airflow DAG runs programmatically
- Run ad‑hoc SQL queries against the Airflow metadata database
- Integrate Airflow database access into AI assistants or automation tools
- Automate Airflow health checks within MCP workflows

FAQ from Mcp Airflow Postgres

What does Mcp Airflow Postgres do?

It is an MCP server that lets you query failed DAG runs and execute direct SQL on an Airflow PostgreSQL database.

Can I use it with Smithery?

Yes, the server is configured for Smithery via smithery.yaml; you must supply the DATABASE_URL when starting.

What are the available tools?

Two tools: failed_runs – queries failed DAG runs within a given time period; query – runs arbitrary SQL against the database.

What database does it support?

PostgreSQL, as shown in the example connection string postgresql://airflow:airflow123@localhost:5432/airflow.

How do I install and run it?

Requires Python 3.8+ and Poetry. Clone the repo, run poetry install, set a DATABASE_URL in .env, then run poetry run python src/server.py.

Details

Author
gavinHuang
Category
other
Repository
gavinhuang/mcp-airflow-postgres

MCP Airflow Database

A Model Context Protocol (MCP) server for interacting with Airflow databases.

Setup with Poetry

Prerequisites

- Python 3.8 or higher
- Poetry installed on your system

Installation

1. Clone this repository:

   git clone <your-repository-url>
cd mcp-airflow-db

2. Install dependencies with Poetry:

   poetry install

3. Configure your environment:
Create a .env file with your database connection string:

   DATABASE_URL=postgresql://airflow:airflow123@localhost:5432/airflow

Running the MCP Server

Run the server with Poetry:

poetry run python src/server.py

Or activate the Poetry environment first:

poetry shell
python src/server.py

Using with Smithery

This MCP can be used with Smithery directly as configured in the smithery.yaml file. Make sure to provide the DATABASE_URL configuration when starting the server.

Available Tools

- failed_runs: Query failed Airflow DAG runs within a specified time period.
- query: Execute SQL queries directly against the Airflow database.

License

[Your License]