data-ops-mcp
by jerrylroach
README.md
# data-ops-mcp
[Model Context Protocol](https://modelcontextprotocol.io) servers that let an AI assistant inspect **Apache Airflow**, the **Spark History Server** and **Argo CD**, from one package with shared HTTP, auth and config code. Read-only by default.
All bundled data is synthetic. Try it with no network and no credentials using `--standin`.
## Problem
Debugging a data platform means hopping between three web UIs: why is this DAG not running, which Spark stage failed, is the deployment synced and what do its pods say. Each has a REST API, but raw API access is a poor fit for an assistant: responses are huge, unfiltered listings can return thousands of rows, variables can hold secrets, and a hung host can stall the whole session.
`data-ops-mcp` exposes a small set of slim, bounded, safe tools per system. Secrets are masked, writes are off until you turn them on, every request has a connect and a total timeout, and long waits are capped below 30 minutes.
## Architecture
```mermaid
flowchart LR
C[MCP client] -- stdio JSON-RPC --> I[index.ts<br/>--server airflow / spark_history / argocd]
I --> R[runtime.ts<br/>instance pick, credential, HttpClient]
R --> A[servers/airflow.ts]
R --> S[servers/spark.ts]
R --> G[servers/argocd.ts]
R --> H[http.ts<br/>bearer auth, timeouts, size cap]
R --> K[credentials.ts<br/>env var or OS keychain]
H --> U[(Airflow v2 / Spark History v1 / Argo CD v1)]
H -.-> T[standin/<br/>synthetic fixtures]
```
One process serves one system; several instances of that system (prod, staging) come from the config map.
## Setup (three steps)
1. **Install and build.** `npm ci && npm run build`
2. **Configure.** `mkdir -p ~/.config/data-ops-mcp && cp config.example.yaml ~/.config/data-ops-mcp/config.yaml`, edit the URLs, and export the token variables named in `auth_env`.
3. **Register one server per system** in your MCP client:
```json
{
"mcpServers": {
"airflow": { "command": "node", "args": ["/path/to/data-ops-mcp/dist/index.js", "--server", "airflow"] },
"spark-history": { "command": "node", "args": ["/path/to/data-ops-mcp/dist/index.js", "--server", "spark_history"] },
"argocd": { "command": "node", "args": ["/path/to/data-ops-mcp/dist/index.js", "--server", "argocd"] }
}
}
```
Try without any backend: `node dist/index.js --config config.example.yaml --server argocd --standin`.
CLI flags: `--server airflow|spark_history|argocd` (overrides `server:` in config), `--config PATH` (overrides `DATA_OPS_MCP_CONFIG`), `--standin`.
## Tools
Every tool takes an optional `instance` (default: the instance marked `default: true`, or the only one) and `list_instances` is available on all three servers.
| System | Tool | Notes |
| --- | --- | --- |
| Airflow | `list_dags` | slim rows incl. `is_paused` |
| | `list_dag_runs` | `state` filter, no start-date filter |
| | `list_task_instances` | per run |
| | `get_task_log` | last `tail_lines` lines |
| | `diagnose_stalled_dag` | checks `is_paused` first |
| | `wait_for_dag_run` | bounded polling |
| | `list_variables` | values masked by default |
| | `trigger_dag_run` | needs `allow_writes: true` |
| Spark History | `list_applications` | `name` filter required |
| | `get_application`, `list_stages` | optional `attempt_id` |
| Argo CD | `list_applications`, `get_application` | slim rows, resource health |
| | `get_logs` | tail window |
## Configuration reference
Default location `~/.config/data-ops-mcp/config.yaml`, or the path in `DATA_OPS_MCP_CONFIG`. Unknown keys are rejected, so a stray `token:` in the file is an error rather than a silent plaintext secret.
| Key | Default | Meaning |
| --- | --- | --- |
| `server` | none | `airflow`, `spark_history` or `argocd`; the `--server` flag wins |
| `allow_writes` | `false` | enables `trigger_dag_run` |
| `allow_secrets` | `false` | allows `list_variables` with `reveal: true` |
| `request_timeout_s` | `30` | total time per HTTP request |
| `connect_timeout_s` | `5` | time to establish the connection |
| `max_wait_s` | `1500` | cap on `wait_for_dag_run`; must be under 30 minutes (maximum accepted 1740) |
| `<system>.instances.<name>.url` | required | base URL (path prefixes allowed). `<system>` is `airflow`, `spark_history` or `argocd` |
| `<system>.instances.<name>.auth_env` | | name of the environment variable holding a bearer token |
| `<system>.instances.<name>.auth_keychain_service` | | OS keychain service name (macOS `security`, Linux `secret-tool`) used if the env var is unset |
| `<system>.instances.<name>.default` | `false` | instance used when a tool call omits `instance`; at most one per system |
At least one of `auth_env` / `auth_keychain_service` is required per instance. Tokens are never read from the config file.
## Design decisions
- **One package, one process per system.** Multi-instance is a config map, not duplicate servers.
- **Read-only first.** The only write tool, `trigger_dag_run`, is visible but refuses until `allow_writes: true`, so the assistant can explain why.
- **Secrets masked by default.** Revealing Airflow variables needs both a per-call flag and `allow_secrets: true`.
- **Do not hide queued runs.** Airflow run listings expose a `state` filter instead of date ranges, because queued runs have a null start date and a start-date filter drops them.
- **Pause check first.** The stalled-DAG diagnosis stops at `is_paused`, the most common and cheapest explanation.
- **Spark name filter is mandatory.** The History Server cannot filter by name server-side; the tool scans up to 1000 applications, filters locally and says if the scan may be incomplete.
- **Logs are tails.** Argo CD log requests send `tailLines` and the client keeps only the last lines; Airflow task logs are tail-trimmed the same way.
- **Bounded waits.** No single sleep exceeds 25 minutes and total waits are capped by config, always under 30.
- **Two timeouts.** A dead host fails at `connect_timeout_s` rather than hanging for the full request timeout.
- **Tests run against a stand-in.** `src/standin` serves synthetic fixtures for all three APIs, including the quirks the tests pin down.
## Development
`npm run check` runs lint, typecheck, tests and build. Each known pitfall has its own test, named `gotcha (a)` to `gotcha (f)`.
## License
MIT, see `LICENSE`.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues