From 71483351924a644be40c04d8480878922dc5f5c4 Mon Sep 17 00:00:00 2001 From: abhishekbhakat Date: Fri, 14 Feb 2025 10:12:27 +0000 Subject: [PATCH] Basic auth --- airflow-mcp-server/README.md | 6 ++++-- .../src/airflow_mcp_server/client/airflow_client.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/airflow-mcp-server/README.md b/airflow-mcp-server/README.md index 857a861..125177c 100644 --- a/airflow-mcp-server/README.md +++ b/airflow-mcp-server/README.md @@ -9,9 +9,9 @@ A [Model Context Protocol](https://modelcontextprotocol.io/) server for controll The MCP Server expects environment variables to be set: - `AIRFLOW_BASE_URL`: The base URL of the Airflow API -- `AUTH_TOKEN`: The token to use for authorization +- `AUTH_TOKEN`: The token to use for authorization (_This should be base64 encoded username:password_) -*Currently, only Session mode is supported.* +*Currently, only Basic Auth is supported.* **Page Limit** @@ -20,5 +20,7 @@ The default is 100 items, but you can change it using `maximum_page_limit` optio ## Tasks - [x] First API +- [x] Parse OpenAPI Spec +- [ ] Parse proper description with listing tools. - [ ] Airflow config fetch (_specifically for page limit_) - [ ] Env variables optional (_env variables might not be ideal for airflow plugins_) diff --git a/airflow-mcp-server/src/airflow_mcp_server/client/airflow_client.py b/airflow-mcp-server/src/airflow_mcp_server/client/airflow_client.py index 1bebca1..7313b69 100644 --- a/airflow-mcp-server/src/airflow_mcp_server/client/airflow_client.py +++ b/airflow-mcp-server/src/airflow_mcp_server/client/airflow_client.py @@ -97,7 +97,7 @@ class AirflowClient: # API configuration self.base_url = base_url.rstrip("/") self.headers = { - "Authorization": f"Bearer {auth_token}", + "Authorization": f"Basic {auth_token}", "Content-Type": "application/json", "Accept": "application/json", } @@ -208,6 +208,8 @@ class AirflowClient: url = f"{self.base_url}{path}" logger.debug("Executing %s %s", method, url) + logger.debug("Request body: %s", body) + logger.debug("Request query params: %s", query_params) # Make request async with self._session.request( @@ -217,6 +219,7 @@ class AirflowClient: json=body, ) as response: response.raise_for_status() + logger.debug("Response: %s", await response.text()) return await response.json() except aiohttp.ClientError as e: