Basic auth
This commit is contained in:
@@ -9,9 +9,9 @@ A [Model Context Protocol](https://modelcontextprotocol.io/) server for controll
|
|||||||
|
|
||||||
The MCP Server expects environment variables to be set:
|
The MCP Server expects environment variables to be set:
|
||||||
- `AIRFLOW_BASE_URL`: The base URL of the Airflow API
|
- `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**
|
**Page Limit**
|
||||||
|
|
||||||
@@ -20,5 +20,7 @@ The default is 100 items, but you can change it using `maximum_page_limit` optio
|
|||||||
## Tasks
|
## Tasks
|
||||||
|
|
||||||
- [x] First API
|
- [x] First API
|
||||||
|
- [x] Parse OpenAPI Spec
|
||||||
|
- [ ] Parse proper description with listing tools.
|
||||||
- [ ] Airflow config fetch (_specifically for page limit_)
|
- [ ] Airflow config fetch (_specifically for page limit_)
|
||||||
- [ ] Env variables optional (_env variables might not be ideal for airflow plugins_)
|
- [ ] Env variables optional (_env variables might not be ideal for airflow plugins_)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class AirflowClient:
|
|||||||
# API configuration
|
# API configuration
|
||||||
self.base_url = base_url.rstrip("/")
|
self.base_url = base_url.rstrip("/")
|
||||||
self.headers = {
|
self.headers = {
|
||||||
"Authorization": f"Bearer {auth_token}",
|
"Authorization": f"Basic {auth_token}",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
}
|
}
|
||||||
@@ -208,6 +208,8 @@ class AirflowClient:
|
|||||||
url = f"{self.base_url}{path}"
|
url = f"{self.base_url}{path}"
|
||||||
|
|
||||||
logger.debug("Executing %s %s", method, url)
|
logger.debug("Executing %s %s", method, url)
|
||||||
|
logger.debug("Request body: %s", body)
|
||||||
|
logger.debug("Request query params: %s", query_params)
|
||||||
|
|
||||||
# Make request
|
# Make request
|
||||||
async with self._session.request(
|
async with self._session.request(
|
||||||
@@ -217,6 +219,7 @@ class AirflowClient:
|
|||||||
json=body,
|
json=body,
|
||||||
) as response:
|
) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
logger.debug("Response: %s", await response.text())
|
||||||
return await response.json()
|
return await response.json()
|
||||||
|
|
||||||
except aiohttp.ClientError as e:
|
except aiohttp.ClientError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user