coalesce-transform-mcp 0.4.7 → 0.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +296 -176
  2. package/agents/lineage-analyst.agent.md +21 -0
  3. package/agents/pipeline-builder.agent.md +33 -0
  4. package/agents/run-operator.agent.md +28 -0
  5. package/agents/workspace-auditor.agent.md +23 -0
  6. package/dist/cache-dir.d.ts +1 -0
  7. package/dist/cache-dir.d.ts.map +1 -1
  8. package/dist/cache-dir.js +8 -3
  9. package/dist/cache-dir.js.map +1 -1
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js +3 -11
  12. package/dist/client.js.map +1 -1
  13. package/dist/coalesce/api/scan.d.ts.map +1 -1
  14. package/dist/coalesce/api/scan.js +7 -5
  15. package/dist/coalesce/api/scan.js.map +1 -1
  16. package/dist/coalesce/run-schemas.d.ts +28 -31
  17. package/dist/coalesce/run-schemas.d.ts.map +1 -1
  18. package/dist/coalesce/run-schemas.js +5 -77
  19. package/dist/coalesce/run-schemas.js.map +1 -1
  20. package/dist/coalesce/tool-response.d.ts +6 -0
  21. package/dist/coalesce/tool-response.d.ts.map +1 -1
  22. package/dist/coalesce/tool-response.js +60 -8
  23. package/dist/coalesce/tool-response.js.map +1 -1
  24. package/dist/index.js +0 -0
  25. package/dist/mcp/cache.js +1 -1
  26. package/dist/mcp/cache.js.map +1 -1
  27. package/dist/mcp/coa.d.ts +308 -0
  28. package/dist/mcp/coa.d.ts.map +1 -0
  29. package/dist/mcp/coa.js +509 -0
  30. package/dist/mcp/coa.js.map +1 -0
  31. package/dist/mcp/lineage.d.ts.map +1 -1
  32. package/dist/mcp/lineage.js +31 -9
  33. package/dist/mcp/lineage.js.map +1 -1
  34. package/dist/mcp/node-type-corpus.d.ts.map +1 -1
  35. package/dist/mcp/node-type-corpus.js +1 -1
  36. package/dist/mcp/node-type-corpus.js.map +1 -1
  37. package/dist/mcp/nodes.d.ts.map +1 -1
  38. package/dist/mcp/nodes.js +6 -2
  39. package/dist/mcp/nodes.js.map +1 -1
  40. package/dist/mcp/pipelines.d.ts.map +1 -1
  41. package/dist/mcp/pipelines.js +28 -16
  42. package/dist/mcp/pipelines.js.map +1 -1
  43. package/dist/mcp/setup.d.ts +4 -0
  44. package/dist/mcp/setup.d.ts.map +1 -0
  45. package/dist/mcp/setup.js +15 -0
  46. package/dist/mcp/setup.js.map +1 -0
  47. package/dist/mcp/tool-helpers.d.ts +8 -0
  48. package/dist/mcp/tool-helpers.d.ts.map +1 -1
  49. package/dist/mcp/tool-helpers.js +53 -3
  50. package/dist/mcp/tool-helpers.js.map +1 -1
  51. package/dist/prompts/index.d.ts.map +1 -1
  52. package/dist/prompts/index.js +63 -0
  53. package/dist/prompts/index.js.map +1 -1
  54. package/dist/resources/coa-describe.d.ts +12 -0
  55. package/dist/resources/coa-describe.d.ts.map +1 -0
  56. package/dist/resources/coa-describe.js +106 -0
  57. package/dist/resources/coa-describe.js.map +1 -0
  58. package/dist/resources/context/aggregation-patterns.md +3 -3
  59. package/dist/resources/context/ecosystem-boundaries.md +130 -0
  60. package/dist/resources/context/pipeline-workflows.md +1 -1
  61. package/dist/resources/context/tool-usage.md +2 -2
  62. package/dist/resources/index.d.ts.map +1 -1
  63. package/dist/resources/index.js +9 -0
  64. package/dist/resources/index.js.map +1 -1
  65. package/dist/server.d.ts +1 -1
  66. package/dist/server.d.ts.map +1 -1
  67. package/dist/server.js +17 -0
  68. package/dist/server.js.map +1 -1
  69. package/dist/services/cache/snapshots.d.ts.map +1 -1
  70. package/dist/services/cache/snapshots.js +17 -18
  71. package/dist/services/cache/snapshots.js.map +1 -1
  72. package/dist/services/coa/describe.d.ts +49 -0
  73. package/dist/services/coa/describe.d.ts.map +1 -0
  74. package/dist/services/coa/describe.js +182 -0
  75. package/dist/services/coa/describe.js.map +1 -0
  76. package/dist/services/coa/preflight.d.ts +34 -0
  77. package/dist/services/coa/preflight.d.ts.map +1 -0
  78. package/dist/services/coa/preflight.js +211 -0
  79. package/dist/services/coa/preflight.js.map +1 -0
  80. package/dist/services/coa/project.d.ts +11 -0
  81. package/dist/services/coa/project.d.ts.map +1 -0
  82. package/dist/services/coa/project.js +35 -0
  83. package/dist/services/coa/project.js.map +1 -0
  84. package/dist/services/coa/redact.d.ts +22 -0
  85. package/dist/services/coa/redact.d.ts.map +1 -0
  86. package/dist/services/coa/redact.js +84 -0
  87. package/dist/services/coa/redact.js.map +1 -0
  88. package/dist/services/coa/resolver.d.ts +21 -0
  89. package/dist/services/coa/resolver.d.ts.map +1 -0
  90. package/dist/services/coa/resolver.js +90 -0
  91. package/dist/services/coa/resolver.js.map +1 -0
  92. package/dist/services/coa/runner.d.ts +30 -0
  93. package/dist/services/coa/runner.d.ts.map +1 -0
  94. package/dist/services/coa/runner.js +117 -0
  95. package/dist/services/coa/runner.js.map +1 -0
  96. package/dist/services/config/coa-config.d.ts +48 -0
  97. package/dist/services/config/coa-config.d.ts.map +1 -0
  98. package/dist/services/config/coa-config.js +151 -0
  99. package/dist/services/config/coa-config.js.map +1 -0
  100. package/dist/services/config/credentials.d.ts +37 -0
  101. package/dist/services/config/credentials.d.ts.map +1 -0
  102. package/dist/services/config/credentials.js +123 -0
  103. package/dist/services/config/credentials.js.map +1 -0
  104. package/dist/services/lineage/lineage-cache.d.ts.map +1 -1
  105. package/dist/services/lineage/lineage-cache.js +26 -7
  106. package/dist/services/lineage/lineage-cache.js.map +1 -1
  107. package/dist/services/lineage/lineage-propagation.d.ts +1 -0
  108. package/dist/services/lineage/lineage-propagation.d.ts.map +1 -1
  109. package/dist/services/lineage/lineage-propagation.js +139 -56
  110. package/dist/services/lineage/lineage-propagation.js.map +1 -1
  111. package/dist/services/pipelines/intent-resolution.d.ts.map +1 -1
  112. package/dist/services/pipelines/intent-resolution.js +7 -1
  113. package/dist/services/pipelines/intent-resolution.js.map +1 -1
  114. package/dist/services/pipelines/intent.d.ts.map +1 -1
  115. package/dist/services/pipelines/intent.js.map +1 -1
  116. package/dist/services/pipelines/planning-types.d.ts +4 -4
  117. package/dist/services/pipelines/sql-utils.d.ts +1 -1
  118. package/dist/services/pipelines/sql-utils.d.ts.map +1 -1
  119. package/dist/services/pipelines/sql-utils.js +1 -3
  120. package/dist/services/pipelines/sql-utils.js.map +1 -1
  121. package/dist/services/pipelines/workspace-resolution.d.ts.map +1 -1
  122. package/dist/services/pipelines/workspace-resolution.js +6 -0
  123. package/dist/services/pipelines/workspace-resolution.js.map +1 -1
  124. package/dist/services/policies/sql-override.js +2 -2
  125. package/dist/services/policies/sql-override.js.map +1 -1
  126. package/dist/services/setup/diagnose.d.ts +124 -0
  127. package/dist/services/setup/diagnose.d.ts.map +1 -0
  128. package/dist/services/setup/diagnose.js +326 -0
  129. package/dist/services/setup/diagnose.js.map +1 -0
  130. package/dist/services/shared/node-helpers.d.ts +1 -1
  131. package/dist/services/shared/node-helpers.d.ts.map +1 -1
  132. package/dist/services/shared/node-helpers.js +1 -1
  133. package/dist/services/shared/node-helpers.js.map +1 -1
  134. package/dist/services/templates/nodes.js +2 -2
  135. package/dist/services/templates/nodes.js.map +1 -1
  136. package/dist/services/workspace/join-helpers.d.ts +5 -0
  137. package/dist/services/workspace/join-helpers.d.ts.map +1 -1
  138. package/dist/services/workspace/join-helpers.js +15 -6
  139. package/dist/services/workspace/join-helpers.js.map +1 -1
  140. package/dist/services/workspace/join-operations.d.ts.map +1 -1
  141. package/dist/services/workspace/join-operations.js +11 -2
  142. package/dist/services/workspace/join-operations.js.map +1 -1
  143. package/dist/tasks/run-and-wait-task.d.ts.map +1 -1
  144. package/dist/tasks/run-and-wait-task.js +3 -1
  145. package/dist/tasks/run-and-wait-task.js.map +1 -1
  146. package/dist/tasks/start-run-task.d.ts.map +1 -1
  147. package/dist/tasks/start-run-task.js +3 -1
  148. package/dist/tasks/start-run-task.js.map +1 -1
  149. package/dist/workflows/run-and-wait.d.ts.map +1 -1
  150. package/dist/workflows/run-and-wait.js +3 -1
  151. package/dist/workflows/run-and-wait.js.map +1 -1
  152. package/package.json +4 -1
package/README.md CHANGED
@@ -1,16 +1,46 @@
1
1
  # coalesce-transform-mcp
2
2
 
3
- MCP server for the [Coalesce](https://coalesce.io/) Transform API. Connect AI assistants like Claude, Cursor, or Windsurf to your Coalesce workspace to manage nodes, pipelines, environments, jobs, runs, and more.
3
+ MCP server for [Coalesce](https://coalesce.io/). Connect AI assistants like Claude, Cursor, or Windsurf to Coalesce to manage nodes, pipelines, environments, jobs, and runs — **and**, starting with 0.5, drive the local-first `coa` CLI from the same server: validate a project, preview DDL/DML, plan a deployment, and apply it to a cloud environment. One install, two execution surfaces.
4
+
5
+ > **First time here?** Two ways to get credentials to the server: (a) if you already use the `coa` CLI locally, the server reads the same `~/.coa/config` file — one shared credential store, nothing to duplicate; (b) otherwise, set `COALESCE_ACCESS_TOKEN` in your MCP client config. Either path works. The `/coalesce-setup` prompt uses `diagnose_setup` to walk you through whatever you're missing.
6
+
7
+ ## Contents
8
+
9
+ - [What you get](#what-you-get)
10
+ - [Quick Start](#quick-start)
11
+ - [Trying a prerelease (alpha)](#trying-a-prerelease-alpha)
12
+ - [Using the COA CLI tools](#using-the-coa-cli-tools)
13
+ - [Requirements](#requirements)
14
+ - [Environment Variables](#environment-variables)
15
+ - [Safety model](#safety-model)
16
+ - [Resources](#resources)
17
+ - [Tool Reference](#tool-reference)
18
+ - [Cloud REST tools](#cloud-rest-tools)
19
+ - [Intelligent tools](#intelligent-tools)
20
+ - [COA CLI tools](#coa-cli-tools)
21
+ - [Snowflake exploration via Cortex Code](#snowflake-exploration-via-cortex-code)
22
+ - [Notes and conventions](#notes-and-conventions)
23
+ - [Links](#links)
24
+ - [License](#license)
25
+
26
+ ## What you get
27
+
28
+ The server exposes two complementary ways of working with Coalesce:
29
+
30
+ **1. Cloud REST tools** (the original surface) — manage workspaces, environments, nodes, pipelines, jobs, runs, projects, git accounts, and users through the Coalesce Deploy API. All agent interaction flows through the authenticated `COALESCE_ACCESS_TOKEN`. Right for: building pipelines declaratively, editing node YAML, reviewing lineage, running deployed jobs, and auditing documentation.
31
+
32
+ **2. Local COA CLI tools** (new in 0.5) — wrap the bundled [`@coalescesoftware/coa`](https://www.npmjs.com/package/@coalescesoftware/coa) CLI to work against a local project directory and the warehouse directly. Right for: validating a project before checkin, previewing generated DDL/DML (`--dry-run`), iterating on V2 `.sql` node files, and running `plan → deploy → refresh` cycles. COA is bundled — **no separate install step**.
33
+
34
+ The two modes are orthogonal. Use both, one, or the other. Destructive tools require explicit confirmation in both modes.
4
35
 
5
36
  ## Quick Start
6
37
 
7
- **1. Set your access token** in `~/.zshrc` or `~/.bashrc`:
38
+ **1. Provide a Coalesce access token.** Pick one path:
8
39
 
9
- ```bash
10
- export COALESCE_ACCESS_TOKEN="your-token-here"
11
- ```
40
+ - **Option A — reuse `~/.coa/config`** (best if you already use the `coa` CLI). Add a `token=` line under the profile you want to use. See [Reading from ~/.coa/config](#reading-from-coaconfig) for the schema the MCP consumes, and run `npx @coalescesoftware/coa describe config` for COA's own reference.
41
+ - **Option B — env var** (simplest for first-time MCP users). Generate a token from Deploy → User Settings in Coalesce, then set `COALESCE_ACCESS_TOKEN` in your MCP client config (see step 2). No file required.
12
42
 
13
- Generate a token from the Deploy tab in your Coalesce workspace ([docs](https://docs.coalesce.io/docs/api/authentication)).
43
+ When both are set, the env var wins see [Environment Variables](#environment-variables) for precedence details.
14
44
 
15
45
  **2. Add to your MCP client config:**
16
46
 
@@ -21,7 +51,7 @@ Generate a token from the Deploy tab in your Coalesce workspace ([docs](https://
21
51
  | Cursor | `.cursor/mcp.json` in project root |
22
52
  | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
23
53
 
24
- **Claude Code** (`.mcp.json`):
54
+ **Claude Code** (`.mcp.json`) — with env-var auth (Option B):
25
55
 
26
56
  ```json
27
57
  {
@@ -35,44 +65,65 @@ Generate a token from the Deploy tab in your Coalesce workspace ([docs](https://
35
65
  }
36
66
  ```
37
67
 
38
- **Claude Desktop, Cursor, Windsurf**same thing, wrapped in `"mcpServers"`:
68
+ With profile auth (Option A), drop the `env` block entirely the server reads `~/.coa/config` automatically. To use a non-default profile, set `"env": { "COALESCE_PROFILE": "MEDBASE" }`.
69
+
70
+ **Claude Desktop, Cursor, Windsurf** — same thing, wrapped in `"mcpServers"`.
71
+
72
+ See [Environment Variables](#environment-variables) for every knob you might need and the env-vs-profile precedence rules.
73
+
74
+ > **Never hardcode credentials in config files tracked by git.** The `${VAR}` syntax pulls values from your shell environment.
75
+
76
+ ### Trying a prerelease (alpha)
77
+
78
+ Pre-release builds are published to the `@alpha` npm dist-tag while `@latest` stays on stable. Point your MCP client at the alpha channel by appending `@alpha` to the npx arg:
39
79
 
40
80
  ```json
41
81
  {
42
- "mcpServers": {
43
- "coalesce-transform": {
44
- "command": "npx",
45
- "args": ["coalesce-transform-mcp"],
46
- "env": {
47
- "COALESCE_ACCESS_TOKEN": "${COALESCE_ACCESS_TOKEN}"
48
- }
49
- }
82
+ "coalesce-transform": {
83
+ "command": "npx",
84
+ "args": ["coalesce-transform-mcp@alpha"]
50
85
  }
51
86
  }
52
87
  ```
53
88
 
54
- The server defaults to the US region. See [Environment Variables](#environment-variables) if you need to change the region, enable run tools, or configure repo-backed features.
89
+ Restart your MCP client after changing the config so `npx` re-resolves.
55
90
 
56
- > **Never hardcode credentials in config files tracked by git.** The `${VAR}` syntax pulls values from your shell environment.
91
+ To pin to an exact prerelease build rather than whatever `@alpha` resolves to today, replace `@alpha` with the full version, e.g. `coalesce-transform-mcp@0.5.0-alpha.2`. If `npx` is serving a stale cached copy when `@alpha` advances, force a fresh fetch with `npx -y coalesce-transform-mcp@alpha`.
92
+
93
+ To run alpha and stable side-by-side, register both with different server names (e.g. `coalesce-transform` for stable and `coalesce-transform-alpha` for the prerelease). To switch back to stable, drop the `@alpha` suffix and restart.
94
+
95
+ ### Using the COA CLI tools
96
+
97
+ The COA CLI tools require no extra install — COA is bundled as a dependency. Usage notes:
98
+
99
+ - **Local commands** (`coa_doctor`, `coa_validate`, `coa_dry_run_create`, `coa_dry_run_run`, `coa_create`, `coa_run`, `coa_plan`) need a COA project directory (one that contains `data.yml`). Pass the path via the `projectPath` tool argument.
100
+ - **Cloud commands** (`coa_list_environments`, `coa_list_environment_nodes`, `coa_list_runs`, `coa_deploy`, `coa_refresh`) read credentials from `~/.coa/config` — the same file the MCP uses. Populate the file once (see [Reading from ~/.coa/config](#reading-from-coaconfig)) and both surfaces share it.
101
+ - **Profile resolution**: cloud tools accept an optional `profile` arg. When omitted, they fall back to `COALESCE_PROFILE` (env var), then to COA's own `[default]` — so you don't have to pass it on every call.
102
+ - **Warehouse-touching commands** (`coa_create`, `coa_run`) need a valid `workspaces.yml` in the project root with storage-location mappings. Preflight catches a missing file before execution.
57
103
 
58
104
  ## Requirements
59
105
 
60
106
  - [Node.js](https://nodejs.org/) >= 22.0.0
61
- - A [Coalesce](https://coalesce.io/) account with a workspace and access token
107
+ - A [Coalesce](https://coalesce.io/) account with a workspace
62
108
  - An MCP-compatible AI client
63
- - **For run tools only:** Snowflake key pair authentication (see below)
109
+ - A `COALESCE_ACCESS_TOKEN` env var OR a populated `~/.coa/config` with a `token=` field — the server reads both and prefers env when they disagree
110
+ - **For run tools (`start_run`/`run_and_wait`/`retry_*`, `coa_create`/`coa_run`) only:** Snowflake credentials (key-pair or PAT). Same source choice as above — env vars or the matching `snowflake*` keys in `~/.coa/config`
111
+
112
+ Install footprint is ~76 MB unpacked due to the bundled `@coalescesoftware/coa` CLI, which ships its own self-contained runtime. The MCP tarball itself stays under 1 MB.
64
113
 
65
114
  ## Environment Variables
66
115
 
67
- Only `COALESCE_ACCESS_TOKEN` is required. Everything else is optional.
116
+ The server merges values from `~/.coa/config` and the MCP env with **env-wins precedence** — a matching env var always overrides the profile value, so you can pin a single field per session without editing the config file.
68
117
 
69
118
  <!-- ENV_METADATA_CORE_TABLE_START -->
70
119
  | Variable | Description | Default |
71
120
  | -------- | -------- | -------- |
72
- | `COALESCE_ACCESS_TOKEN` | **Required.** Bearer token from the Coalesce Deploy tab. | — |
121
+ | `COALESCE_ACCESS_TOKEN` | Bearer token from the Coalesce Deploy tab. Optional when `~/.coa/config` provides a `token`. | — |
122
+ | `COALESCE_PROFILE` | Selects which `~/.coa/config` profile to load. | `default` |
73
123
  | `COALESCE_BASE_URL` | Region-specific base URL. | `https://app.coalescesoftware.io (US)` |
74
124
  | `COALESCE_ORG_ID` | Fallback org ID for cancel-run. | — |
75
125
  | `COALESCE_REPO_PATH` | Local repo root for repo-backed tools and pipeline planning. | — |
126
+ | `COALESCE_CACHE_DIR` | Base directory for the local data cache. When set, cache files are written here instead of the working directory. | — |
76
127
  | `COALESCE_MCP_AUTO_CACHE_MAX_BYTES` | JSON size threshold before auto-caching to disk. | `32768` |
77
128
  | `COALESCE_MCP_LINEAGE_TTL_MS` | In-memory lineage cache TTL in milliseconds. | `1800000` |
78
129
  | `COALESCE_MCP_MAX_REQUEST_BODY_BYTES` | Max outbound API request body size. | `524288` |
@@ -80,9 +131,31 @@ Only `COALESCE_ACCESS_TOKEN` is required. Everything else is optional.
80
131
  | `COALESCE_MCP_SKILLS_DIR` | Directory for customizable AI skill resources. When set, reads context resources from this directory and seeds defaults on first run. Users can augment or override any skill. | — |
81
132
  <!-- ENV_METADATA_CORE_TABLE_END -->
82
133
 
83
- ### Snowflake (for run tools only)
134
+ ### Reading from ~/.coa/config
135
+
136
+ COA stores credentials in a standard INI file at `~/.coa/config`. You create it by hand (or let `coa` write it as you use the CLI over time). For the authoritative reference, run `npx @coalescesoftware/coa describe config`.
137
+
138
+ The MCP reads the profile selected by `COALESCE_PROFILE` (defaulting to `[default]`) and maps the keys it cares about onto the env vars above: `token` ↔ `COALESCE_ACCESS_TOKEN`, `domain` ↔ `COALESCE_BASE_URL`, and each `snowflake*` key ↔ its corresponding `SNOWFLAKE_*` env var. Env vars override individual fields.
139
+
140
+ ```ini
141
+ [default]
142
+ token=<your-coalesce-refresh-token>
143
+ domain=https://your-org.app.coalescesoftware.io
144
+ snowflakeUsername=YOUR_USER
145
+ snowflakeRole=YOUR_ROLE
146
+ snowflakeWarehouse=YOUR_WAREHOUSE
147
+ snowflakeKeyPairKey=/Users/you/.coa/rsa_key.p8
148
+ snowflakeAuthType=KeyPair
149
+
150
+ [staging]
151
+ # …additional profiles; select with COALESCE_PROFILE
152
+ ```
153
+
154
+ Only the fields the MCP needs are shown above — COA's config supports many more (see `coa describe config`). Unknown keys are ignored by this server.
84
155
 
85
- Required for `start_run`, `retry_run`, `run_and_wait`, and `retry_and_wait`. The server starts without them — they're validated when you first use a run tool.
156
+ ### Snowflake overrides (for run tools only)
157
+
158
+ Run tools (`start_run`, `retry_run`, `run_and_wait`, `retry_and_wait`) and the warehouse-touching COA tools (`coa_create`, `coa_run`) need Snowflake credentials. These normally come from `~/.coa/config`. Override any field via env var if needed:
86
159
 
87
160
  <!-- ENV_METADATA_SNOWFLAKE_TABLE_START -->
88
161
  | Variable | Required | Description |
@@ -95,23 +168,11 @@ Required for `start_run`, `retry_run`, `run_and_wait`, and `retry_and_wait`. The
95
168
  | `SNOWFLAKE_ROLE` | Yes | Snowflake user role |
96
169
  <!-- ENV_METADATA_SNOWFLAKE_TABLE_END -->
97
170
 
98
- To use optional variables, add them to your shell profile and pass them through in your MCP config. Here's a full example with everything enabled:
99
-
100
- **`~/.zshrc`:**
171
+ "Required" means one of env OR the matching `~/.coa/config` field must supply the value. **`SNOWFLAKE_PAT` is env-only** COA's config uses `snowflakePassword` for Basic auth (a different concept), which this server deliberately doesn't read.
101
172
 
102
- ```bash
103
- export COALESCE_ACCESS_TOKEN="your-token-here"
104
- export COALESCE_BASE_URL="https://app.eu.coalescesoftware.io"
105
- export COALESCE_REPO_PATH="/path/to/local/coalesce-repo"
106
- export SNOWFLAKE_USERNAME="your-username"
107
- export SNOWFLAKE_KEY_PAIR_KEY="/path/to/snowflake_key.pem" # Option A: Key Pair
108
- export SNOWFLAKE_KEY_PAIR_PASS="your-passphrase" # (only if key is encrypted)
109
- export SNOWFLAKE_PAT="your-programmatic-access-token" # Option B: PAT (if both set, Key Pair wins)
110
- export SNOWFLAKE_WAREHOUSE="your-warehouse"
111
- export SNOWFLAKE_ROLE="your-role"
112
- ```
173
+ ### Overriding individual fields
113
174
 
114
- **`.mcp.json`:**
175
+ The most common reason to set env vars is to flip a single field for a session without editing the config file:
115
176
 
116
177
  ```json
117
178
  {
@@ -119,49 +180,63 @@ export SNOWFLAKE_ROLE="your-role"
119
180
  "command": "npx",
120
181
  "args": ["coalesce-transform-mcp"],
121
182
  "env": {
122
- "COALESCE_ACCESS_TOKEN": "${COALESCE_ACCESS_TOKEN}",
123
- "COALESCE_BASE_URL": "${COALESCE_BASE_URL}",
124
- "COALESCE_REPO_PATH": "${COALESCE_REPO_PATH}",
125
- "SNOWFLAKE_USERNAME": "${SNOWFLAKE_USERNAME}",
126
- "SNOWFLAKE_KEY_PAIR_KEY": "${SNOWFLAKE_KEY_PAIR_KEY}",
127
- "SNOWFLAKE_KEY_PAIR_PASS": "${SNOWFLAKE_KEY_PAIR_PASS}",
128
- "SNOWFLAKE_PAT": "${SNOWFLAKE_PAT}",
129
- "SNOWFLAKE_WAREHOUSE": "${SNOWFLAKE_WAREHOUSE}",
130
- "SNOWFLAKE_ROLE": "${SNOWFLAKE_ROLE}"
183
+ "COALESCE_PROFILE": "staging",
184
+ "SNOWFLAKE_ROLE": "TRANSFORMER_ADMIN"
131
185
  }
132
186
  }
133
187
  }
134
188
  ```
135
189
 
136
- Only include the variables you need — the Quick Start config with just `COALESCE_ACCESS_TOKEN` is enough to get started.
190
+ That says "use the `[staging]` profile, but override its `snowflakeRole`."
191
+
192
+ ## Safety model
193
+
194
+ The server uses three layers to prevent an agent from doing something destructive by surprise:
137
195
 
138
- ## Skills Directory
196
+ 1. **Tool annotations.** Every tool carries MCP annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`). MCP clients that respect these can filter tools proactively. The ⚠️ marker in [Tool Reference](#tool-reference) marks `destructiveHint: true` tools.
197
+ 2. **`COALESCE_MCP_READ_ONLY=true`** hides all write-style tools at server startup. Only read/list/search/analyze/review/diagnose/plan tools are registered. Useful for auditing or agent sandboxes.
198
+ 3. **Explicit confirmation for destructive ops.** Tools marked destructive require a `confirmed: true` argument. When the MCP client supports elicitation, the server prompts the user interactively; otherwise it returns a `STOP_AND_CONFIRM` response the agent must surface before retrying with `confirmed: true`. This applies to: `delete_*`, `propagate_column_change`, `cancel_run`, `clear_data_cache`, `coa_create`, `coa_run`, `coa_deploy`, `coa_refresh`.
139
199
 
140
- The server ships 23 AI skill resources that guide how agents interact with Coalesce. By default these are bundled inside the package, but you can make them visible and editable by setting `COALESCE_MCP_SKILLS_DIR`.
200
+ Additionally, the local COA write tools run **preflight validation** before shelling out. Preflight scans the project and blocks on known footguns:
141
201
 
142
- ### Setup
202
+ | Code | Level | What it catches |
203
+ | ---- | ----- | --------------- |
204
+ | `SQL_DOUBLE_QUOTED_REF` | error | `.sql` nodes using `ref("…")` — silently returns `UNKNOWN` columns; must be single-quoted |
205
+ | `WORKSPACES_YML_MISSING` | error | `workspaces.yml` not in project root — required for local create/run |
206
+ | `SELECTOR_COMBINED_OR` | error | `{ A \|\| B }` selector form — matches zero nodes; must be `{ A } \|\| { B }` |
207
+ | `SQL_LITERAL_UNION_ALL` | warning | Literal `UNION ALL` in a V2 `.sql` node — silently dropped by the V2 parser; use `insertStrategy: UNION ALL` instead |
208
+ | `DATA_YML_UNEXPECTED_FILEVERSION` | warning | `data.yml` missing or not `fileVersion: 3` |
209
+ | `DATA_YML_NO_FILEVERSION` | warning | `data.yml` has no `fileVersion` field |
210
+
211
+ Errors block execution; warnings pass through in the tool response as `preflightWarnings` so agents can surface them.
212
+
213
+ ## Resources
214
+
215
+ Resources are read-only context documents exposed via MCP that clients can pull into their prompts on demand. There are two families.
216
+
217
+ ### Coalesce context skills (customizable)
218
+
219
+ 24 curated markdown resources under `coalesce://context/*` that guide how agents interact with the server — SQL conventions per warehouse, node-type selection, pipeline workflows, lineage/impact guidance, and so on. Set `COALESCE_MCP_SKILLS_DIR` to make them editable on disk:
143
220
 
144
221
  ```bash
145
222
  export COALESCE_MCP_SKILLS_DIR="/path/to/my-skills"
146
223
  ```
147
224
 
148
- On first run, the server seeds the directory with 46 files:
225
+ On first run the server seeds the directory with 48 files:
149
226
 
150
227
  - `coalesce_skills.<name>.md` — the default skill content (editable)
151
228
  - `user_skills.<name>.md` — your customization file (starts as an inactive stub with instructions)
152
229
 
153
- ### How customization works
154
-
155
230
  Each resource resolves using this priority:
156
231
 
157
232
  1. **Override** — `user_skills.<name>.md` starts with `<!-- OVERRIDE -->` → only the user file is served
158
233
  2. **Augment** — `user_skills.<name>.md` has custom content (remove the `<!-- STUB -->` line first) → default + user content are concatenated
159
234
  3. **Default** — `user_skills.<name>.md` is missing, empty, or still has the seeded stub → default skill content is served
160
- 4. **Disabled** — both files deleted → empty content is served (effectively disabled)
235
+ 4. **Disabled** — both files deleted → empty content is served
161
236
 
162
237
  Seeding is idempotent — it never overwrites files you've already modified.
163
238
 
164
- ### Available Skills
239
+ #### Available context skills
165
240
 
166
241
  | Skill | File | Description |
167
242
  | ----- | ---- | ----------- |
@@ -188,167 +263,206 @@ Seeding is idempotent — it never overwrites files you've already modified.
188
263
  | Run Diagnostics Guide | `run-diagnostics-guide` | Using `diagnose_run_failure` to analyze failed runs and determine fixes |
189
264
  | Pipeline Review Guide | `pipeline-review-guide` | Using `review_pipeline` for pipeline analysis and optimization |
190
265
  | Pipeline Workshop Guide | `pipeline-workshop-guide` | Using pipeline workshop tools for iterative, conversational pipeline building |
266
+ | Ecosystem Boundaries | `ecosystem-boundaries` | Scope of this MCP vs adjacent data engineering MCPs (Snowflake, Fivetran, dbt, Catalog) |
267
+
268
+ ### COA describe topics (sourced from the CLI)
269
+
270
+ 10 resources under `coalesce://coa/describe/*` that surface the bundled COA CLI's self-describing documentation. Content is fetched from `coa describe <topic>` on first access and cached to disk, keyed by the pinned COA version — so agents always see docs that match the CLI they're driving. Topics: `overview`, `commands`, `selectors`, `schemas`, `workflow`, `structure`, `concepts`, `sql-format`, `node-types`, `config`.
271
+
272
+ For parameterized topics (`command <name>`, `schema <type>`), use the `coa_describe` tool with a `subtopic` argument.
191
273
 
192
274
  ## Tool Reference
193
275
 
194
- ⚠️ = Destructive operation
276
+ ⚠️ = Destructive (requires `confirmed: true`). 🧰 = Runs bundled `coa` CLI.
195
277
 
196
- ### API Tools
278
+ ### Cloud REST tools
197
279
 
198
- Coalesce Platform Tools: manage workspaces, environments, projects, runs, and other platform resources.
280
+ Manage Coalesce platform resources through the Deploy API.
199
281
 
200
282
  #### Environments
201
283
 
202
- - `list_environments` - List all available environments
203
- - `get_environment` - Get details of a specific environment
204
- - `create_environment` - Create a new environment within a project
205
- - `delete_environment` - Delete an environment ⚠️
284
+ - `list_environments` List all available environments
285
+ - `get_environment` Get details of a specific environment
286
+ - `create_environment` Create a new environment within a project
287
+ - `delete_environment` Delete an environment ⚠️
206
288
 
207
289
  #### Workspaces
208
290
 
209
- - `list_workspaces` - List all workspaces
210
- - `get_workspace` - Get details of a specific workspace
291
+ - `list_workspaces` List all workspaces
292
+ - `get_workspace` Get details of a specific workspace
211
293
 
212
294
  #### Nodes
213
295
 
214
- - `list_environment_nodes` - List nodes in an environment
215
- - `list_workspace_nodes` - List nodes in a workspace
216
- - `get_environment_node` - Get a specific environment node
217
- - `get_workspace_node` - Get a specific workspace node
218
- - `set_workspace_node` - Replace a workspace node with a full body
219
- - `update_workspace_node` - Safely update selected fields of a workspace node
220
- - `delete_workspace_node` - Delete a node from a workspace ⚠️
296
+ - `list_environment_nodes` List nodes in an environment
297
+ - `list_workspace_nodes` List nodes in a workspace
298
+ - `get_environment_node` Get a specific environment node
299
+ - `get_workspace_node` Get a specific workspace node
300
+ - `set_workspace_node` Replace a workspace node with a full body
301
+ - `update_workspace_node` Safely update selected fields of a workspace node
302
+ - `delete_workspace_node` Delete a node from a workspace ⚠️
221
303
 
222
304
  #### Jobs
223
305
 
224
- - `list_environment_jobs` - List all jobs for an environment
225
- - `create_workspace_job` - Create a job in a workspace with node include/exclude selectors
226
- - `get_environment_job` - Get details of a specific job (via environment)
227
- - `update_workspace_job` - Update a job's name and node selectors
228
- - `delete_workspace_job` - Delete a job ⚠️
306
+ - `list_environment_jobs` List all jobs for an environment
307
+ - `create_workspace_job` Create a job in a workspace with node include/exclude selectors
308
+ - `get_environment_job` Get details of a specific job (via environment)
309
+ - `update_workspace_job` Update a job's name and node selectors
310
+ - `delete_workspace_job` Delete a job ⚠️
229
311
 
230
312
  #### Subgraphs
231
313
 
232
- - `list_workspace_subgraphs` - List subgraphs in a workspace
233
- - `get_workspace_subgraph` - Get details of a specific subgraph
234
- - `create_workspace_subgraph` - Create a subgraph to group nodes visually
235
- - `update_workspace_subgraph` - Update a subgraph's name and node membership
236
- - `delete_workspace_subgraph` - Delete a subgraph (nodes are NOT deleted) ⚠️
314
+ - `list_workspace_subgraphs` List subgraphs in a workspace
315
+ - `get_workspace_subgraph` Get details of a specific subgraph
316
+ - `create_workspace_subgraph` Create a subgraph to group nodes visually
317
+ - `update_workspace_subgraph` Update a subgraph's name and node membership
318
+ - `delete_workspace_subgraph` Delete a subgraph (nodes are NOT deleted) ⚠️
237
319
 
238
320
  #### Runs
239
321
 
240
- - `diagnose_run_failure` - Diagnose a failed run with error classification, root-cause analysis, and actionable fix suggestions
241
- - `list_runs` - List runs with optional filters
242
- - `get_run` - Get details of a specific run
243
- - `get_run_results` - Get results of a completed run
244
- - `start_run` - Start a new run; requires Snowflake auth (Key Pair or PAT, credentials from env vars)
245
- - `run_status` - Check status of a running job
246
- - `retry_run` - Retry a failed run; requires Snowflake auth (Key Pair or PAT, credentials from env vars)
247
- - `cancel_run` - Cancel a running job (requires `runID` and `environmentID`; `orgID` may come from `COALESCE_ORG_ID`) ⚠️
322
+ - `diagnose_run_failure` Diagnose a failed run with error classification, root-cause analysis, and actionable fix suggestions
323
+ - `list_runs` List runs with optional filters
324
+ - `get_run` Get details of a specific run
325
+ - `get_run_results` Get results of a completed run
326
+ - `start_run` Start a new run; requires Snowflake auth (Key Pair or PAT, credentials from env vars)
327
+ - `run_status` Check status of a running job
328
+ - `retry_run` Retry a failed run; requires Snowflake auth (Key Pair or PAT, credentials from env vars)
329
+ - `cancel_run` Cancel a running job (requires `runID` and `environmentID`; `orgID` may come from `COALESCE_ORG_ID`) ⚠️
248
330
 
249
331
  #### Projects
250
332
 
251
- - `list_projects` - List all projects
252
- - `get_project` - Get project details
253
- - `create_project` - Create a new project
254
- - `update_project` - Update a project
255
- - `delete_project` - Delete a project ⚠️
333
+ - `list_projects` List all projects
334
+ - `get_project` Get project details
335
+ - `create_project` Create a new project
336
+ - `update_project` Update a project
337
+ - `delete_project` Delete a project ⚠️
256
338
 
257
339
  #### Git Accounts
258
340
 
259
- - `list_git_accounts` - List all git accounts
260
- - `get_git_account` - Get git account details
261
- - `create_git_account` - Create a new git account
262
- - `update_git_account` - Update a git account
263
- - `delete_git_account` - Delete a git account ⚠️
264
-
265
- #### Users
266
-
267
- - `list_org_users` - List all organization users
268
- - `get_user_roles` - Get roles for a specific user
269
- - `list_user_roles` - List all user roles
270
- - `set_org_role` - Set organization role for a user
271
- - `set_project_role` - Set project role for a user
272
- - `delete_project_role` - Remove project role from a user ⚠️
273
- - `set_env_role` - Set environment role for a user
274
- - `delete_env_role` - Remove environment role from a user ⚠️
275
-
276
- ### Intelligent Tools
277
-
278
- Custom logic built on top of the API: pipeline planning, config completion, join analysis, workspace analysis, and more.
279
-
280
- #### Node Creation and Configuration
341
+ - `list_git_accounts` List all git accounts
342
+ - `get_git_account` Get git account details
343
+ - `create_git_account` Create a new git account
344
+ - `update_git_account` Update a git account
345
+ - `delete_git_account` Delete a git account ⚠️
346
+
347
+ #### Users and roles
348
+
349
+ - `list_org_users` List all organization users
350
+ - `get_user_roles` Get roles for a specific user
351
+ - `list_user_roles` List all user roles
352
+ - `set_org_role` Set organization role for a user
353
+ - `set_project_role` Set project role for a user
354
+ - `delete_project_role` Remove project role from a user ⚠️
355
+ - `set_env_role` Set environment role for a user
356
+ - `delete_env_role` Remove environment role from a user ⚠️
357
+
358
+ ### Intelligent tools
359
+
360
+ Custom logic on top of the Coalesce API: pipeline planning, config completion, join analysis, lineage, and more.
361
+
362
+ #### Node creation and configuration
363
+
364
+ - `create_workspace_node_from_scratch` — Create a workspace node with no predecessors, apply fields to the requested completion level, and run automatic config completion
365
+ - `create_workspace_node_from_predecessor` — Create a node from predecessor nodes, verify column coverage, suggest join columns, and run automatic config completion
366
+ - `replace_workspace_node_columns` — Replace `metadata.columns` wholesale and optionally apply additional changes for complex column rewrites
367
+ - `convert_join_to_aggregation` — Convert a join-style node into an aggregated fact-style node with generated JOIN/GROUP BY analysis
368
+ - `apply_join_condition` — Auto-generate and write a FROM/JOIN/ON clause for a multi-predecessor node
369
+ - `create_node_from_external_schema` — Create a workspace node whose columns match an existing warehouse table or external schema
370
+ - `complete_node_configuration` — Intelligently complete a node's configuration by analyzing context and applying best-practice rules
371
+ - `list_workspace_node_types` — List distinct node types observed in current workspace nodes
372
+ - `analyze_workspace_patterns` — Analyze workspace nodes to detect package adoption, pipeline layers, methodology, and generate recommendations
373
+
374
+ #### Pipeline planning and execution
375
+
376
+ - `plan_pipeline` — Plan a pipeline from SQL or a natural-language goal without mutating the workspace; ranks best-fit node types from the local repo
377
+ - `create_pipeline_from_plan` — Execute an approved pipeline plan using predecessor-based creation
378
+ - `create_pipeline_from_sql` — Plan and create a pipeline directly from SQL
379
+ - `build_pipeline_from_intent` — Build a pipeline from a natural language goal with automatic entity resolution and node type selection
380
+ - `review_pipeline` — Analyze an existing pipeline for redundant nodes, missing joins, layer violations, naming issues, and optimization opportunities
381
+ - `parse_sql_structure` — Parse a SQL statement into structural components (CTEs, source tables, projected columns) without touching the workspace
382
+ - `select_pipeline_node_type` — Rank and select the best Coalesce node type for a pipeline step using the deliberative selection loop against repo or workspace-observed types
383
+
384
+ #### Pipeline workshop
385
+
386
+ - `pipeline_workshop_open` — Open an iterative pipeline builder session with workspace context pre-loaded
387
+ - `pipeline_workshop_instruct` — Send a natural language instruction to modify the current workshop plan
388
+ - `get_pipeline_workshop_status` — Get the current state of a workshop session
389
+ - `pipeline_workshop_close` — Close a workshop session and release resources
390
+
391
+ #### Repo-backed node types and templates
392
+
393
+ - `list_repo_packages` — Inspect a committed local Coalesce repo and list package aliases plus enabled node-type coverage
394
+ - `list_repo_node_types` — List exact resolvable committed node-type identifiers from `nodeTypes/`
395
+ - `get_repo_node_type_definition` — Resolve one exact committed node type and return its outer definition plus parsed `nodeMetadataSpec`
396
+ - `generate_set_workspace_node_template` — Generate a YAML-friendly `set_workspace_node` body template from a definition object or committed repo definition
397
+ - `search_node_type_variants` — Search the committed node-type corpus by normalized family, package, primitive, or support status
398
+ - `get_node_type_variant` — Load one exact node-type corpus variant by variant key
399
+ - `generate_set_workspace_node_template_from_variant` — Generate a `set_workspace_node` body template from a committed corpus variant
400
+
401
+ #### Lineage and impact
402
+
403
+ - `get_upstream_nodes` — Walk the full upstream dependency graph for a node
404
+ - `get_downstream_nodes` — Walk the full downstream dependency graph for a node
405
+ - `get_column_lineage` — Trace a column through the pipeline upstream and downstream via column-level references
406
+ - `analyze_impact` — Analyze downstream impact of changing a node or specific column — returns impacted counts, grouped by depth, and critical path
407
+ - `propagate_column_change` — Update all downstream columns after a column rename or data type change ⚠️
408
+ - `search_workspace_content` — Search across node SQL, column names, descriptions, and config values using the lineage cache as a searchable index
409
+ - `audit_documentation_coverage` — Scan all workspace nodes and columns for missing descriptions and report coverage statistics
410
+
411
+ #### Cache and snapshots
412
+
413
+ - `cache_workspace_nodes` — Fetch every page of workspace nodes, write a full snapshot, and return cache metadata
414
+ - `cache_environment_nodes` — Fetch every page of environment nodes, write a full snapshot, and return cache metadata
415
+ - `cache_runs` — Fetch every page of run results, write a full snapshot, and return cache metadata
416
+ - `cache_org_users` — Fetch every page of organization users, write a full snapshot, and return cache metadata
417
+ - `clear_data_cache` — Delete all cached snapshots, auto-cached responses, and plan summaries ⚠️
418
+
419
+ #### Run workflows
420
+
421
+ - `run_and_wait` — Start a run and poll until completion; requires Snowflake auth (Key Pair or PAT)
422
+ - `retry_and_wait` — Retry a failed run and poll until completion; requires Snowflake auth (Key Pair or PAT)
423
+ - `get_run_details` — Get run metadata and results in one call
424
+ - `get_environment_overview` — Get environment details with full node list
425
+ - `get_environment_health` — Comprehensive health dashboard: node counts by type, run statuses, failed runs in last 24h, stale nodes, dependency health, and overall health score (walks all paginated environment runs before scoring — slower on busy environments)
281
426
 
282
- - `create_workspace_node_from_scratch` - Create a workspace node with no predecessors, apply fields to the requested completion level, and run automatic config completion
283
- - `create_workspace_node_from_predecessor` - Create a node from predecessor nodes, verify column coverage, suggest join columns, and run automatic config completion
284
- - `replace_workspace_node_columns` - Replace `metadata.columns` wholesale and optionally apply additional changes for complex column rewrites
285
- - `convert_join_to_aggregation` - Convert a join-style node into an aggregated fact-style node with generated JOIN/GROUP BY analysis
286
- - `apply_join_condition` - Auto-generate and write a FROM/JOIN/ON clause for a multi-predecessor node
287
- - `create_node_from_external_schema` - Create a workspace node whose columns match an existing warehouse table or external schema
288
- - `complete_node_configuration` - Intelligently complete a node's configuration by analyzing context and applying best-practice rules
289
- - `list_workspace_node_types` - List distinct node types observed in current workspace nodes
290
- - `analyze_workspace_patterns` - Analyze workspace nodes to detect package adoption, pipeline layers, methodology, and generate recommendations
291
-
292
- #### Pipeline Planning and Execution
293
-
294
- - `plan_pipeline` - Plan a pipeline from SQL or a natural-language goal without mutating the workspace; ranks best-fit node types from the local repo
295
- - `create_pipeline_from_plan` - Execute an approved pipeline plan using predecessor-based creation
296
- - `create_pipeline_from_sql` - Plan and create a pipeline directly from SQL
297
- - `build_pipeline_from_intent` - Build a pipeline from a natural language goal with automatic entity resolution and node type selection
298
- - `review_pipeline` - Analyze an existing pipeline for redundant nodes, missing joins, layer violations, naming issues, and optimization opportunities
299
- - `parse_sql_structure` - Parse a SQL statement into structural components (CTEs, source tables, projected columns) without touching the workspace
300
- - `select_pipeline_node_type` - Rank and select the best Coalesce node type for a pipeline step using the deliberative selection loop against repo or workspace-observed types
427
+ #### Skills
301
428
 
302
- #### Pipeline Workshop
429
+ - `personalize_skills` — Export bundled skill files to a local directory for customization; creates editable `coalesce_skills.{name}.md` and `user_skills.{name}.md` pairs (idempotent — never overwrites existing files)
303
430
 
304
- - `pipeline_workshop_open` - Open an iterative pipeline builder session with workspace context pre-loaded
305
- - `pipeline_workshop_instruct` - Send a natural language instruction to modify the current workshop plan
306
- - `get_pipeline_workshop_status` - Get the current state of a workshop session
307
- - `pipeline_workshop_close` - Close a workshop session and release resources
431
+ #### Setup
308
432
 
309
- #### Repo-Backed Node Types and Templates
433
+ - `diagnose_setup` — Stateless probe reporting which first-time-setup pieces are configured: access token, Snowflake credentials, `~/.coa/config` profile, local repo path, and a best-effort `coa doctor` check. Returns a structured report plus ordered `nextSteps` and per-field `source` markers (`env`, `profile:<name>`, or `missing`). Paired with the `/coalesce-setup` MCP prompt, which walks a user through any remaining gaps.
310
434
 
311
- - `list_repo_packages` - Inspect a committed local Coalesce repo and list package aliases plus enabled node-type coverage from `packages/*.yml`
312
- - `list_repo_node_types` - List exact resolvable committed node-type identifiers from `nodeTypes/`, optionally scoped to one package alias or currently in-use types
313
- - `get_repo_node_type_definition` - Resolve one exact committed node type from a local repo and return its outer definition plus raw and parsed `metadata.nodeMetadataSpec`
314
- - `generate_set_workspace_node_template` - Generate a YAML-friendly `set_workspace_node` body template from either a raw definition object or an exact committed repo definition resolved by `repoPath` or `COALESCE_REPO_PATH`
435
+ ### COA CLI tools
315
436
 
316
- #### Node Type Corpus
437
+ Wrap the bundled `@coalescesoftware/coa` CLI. All local tools accept a `projectPath` argument and validate that it contains `data.yml` before shelling out. Destructive tools run preflight validation; see [Safety model](#safety-model).
317
438
 
318
- - `search_node_type_variants` - Search the committed node-type corpus snapshot by normalized family, package, primitive, or support status
319
- - `get_node_type_variant` - Load one exact node-type corpus variant by variant key
320
- - `generate_set_workspace_node_template_from_variant` - Generate a `set_workspace_node` body template from a committed corpus variant without needing the original external source repo at runtime; partial variants are rejected unless `allowPartial=true`
439
+ #### Read-only, local
321
440
 
322
- #### Cache and Snapshots
441
+ - 🧰 `coa_doctor` — Check config, credentials, and warehouse connectivity for a project. Wraps `coa doctor --json`
442
+ - 🧰 `coa_validate` — Validate YAML schemas and scan a project for configuration problems. Wraps `coa validate --json`
443
+ - 🧰 `coa_list_project_nodes` — List all nodes defined in a local project (pre-deploy). Wraps `coa create --list-nodes`
444
+ - 🧰 `coa_dry_run_create` — Preview DDL without executing against the warehouse. Forces `--dry-run --verbose`
445
+ - 🧰 `coa_dry_run_run` — Preview DML without executing against the warehouse. Forces `--dry-run --verbose`
323
446
 
324
- - `cache_workspace_nodes` - Fetch every page of workspace nodes, write the full snapshot to `coalesce_transform_mcp_data_cache/nodes/`, and return only cache metadata
325
- - `cache_environment_nodes` - Fetch every page of environment nodes, write the full snapshot to `coalesce_transform_mcp_data_cache/nodes/`, and return only cache metadata
326
- - `cache_runs` - Fetch every page of run results, write the full snapshot to `coalesce_transform_mcp_data_cache/runs/`, and return only cache metadata
327
- - `cache_org_users` - Fetch every page of organization users, write the full snapshot to `coalesce_transform_mcp_data_cache/users/`, and return only cache metadata
328
- - `clear_data_cache` - Delete all cached snapshots, auto-cached responses, and plan summaries under `coalesce_transform_mcp_data_cache/` ⚠️
447
+ #### Read-only, cloud (require `~/.coa/config`)
329
448
 
330
- #### Workflows
449
+ - 🧰 `coa_list_environments` — List deployment environments. Wraps `coa environments list --format json`
450
+ - 🧰 `coa_list_environment_nodes` — List deployed nodes in an environment. Wraps `coa nodes list --environmentID ...`
451
+ - 🧰 `coa_list_runs` — List pipeline runs in a cloud environment (or across all environments). Wraps `coa runs list`
331
452
 
332
- - `run_and_wait` - Start a run and poll until completion; requires Snowflake auth (Key Pair or PAT)
333
- - `retry_and_wait` - Retry a failed run and poll until completion; requires Snowflake auth (Key Pair or PAT)
334
- - `get_run_details` - Get run metadata and results in one call
335
- - `get_environment_overview` - Get environment details with full node list
336
- - `get_environment_health` - Get a comprehensive health dashboard: node counts by type, run statuses, failed runs in last 24h, stale nodes, dependency health, and overall health score. This walks all paginated environment runs before scoring, so it can take longer on busy environments.
453
+ #### Describe
337
454
 
338
- #### Skills
455
+ - 🧰 `coa_describe` — Fetch a section of COA's self-describing documentation by topic + optional subtopic. Also exposed as `coalesce://coa/describe/*` [resources](#coa-describe-topics-sourced-from-the-cli)
339
456
 
340
- - `personalize_skills` - Export bundled skill files to a local directory for customization; creates editable `coalesce_skills.{name}.md` and `user_skills.{name}.md` pairs (idempotent — never overwrites existing files)
457
+ #### Write and deploy
341
458
 
342
- #### Lineage & Impact
459
+ - 🧰 `coa_plan` — Generate a deployment plan JSON by diffing the local project against a cloud environment. Writes `coa-plan.json` (configurable via `out`). Non-destructive
460
+ - 🧰 `coa_create` — Run DDL (CREATE/REPLACE) against the warehouse for selected nodes. Preflight-gated. ⚠️
461
+ - 🧰 `coa_run` — Run DML (INSERT/MERGE) to populate selected nodes. Preflight-gated. ⚠️
462
+ - 🧰 `coa_deploy` — Apply a plan JSON to a cloud environment. Verifies the plan file exists before running. ⚠️
463
+ - 🧰 `coa_refresh` — Run DML for selected nodes in an already-deployed environment (no local project required). ⚠️
343
464
 
344
- - `get_upstream_nodes` - Walk the full upstream dependency graph for a node and return every ancestor with depth level (no depth limit)
345
- - `get_downstream_nodes` - Walk the full downstream dependency graph for a node and return every dependent with depth level (no depth limit)
346
- - `get_column_lineage` - Trace a column through the entire pipeline upstream and downstream via column-level references
347
- - `analyze_impact` - Analyze downstream impact of changing a node or specific column — returns impacted counts, grouped by depth, and critical path
348
- - `propagate_column_change` - Update all downstream columns after a column rename or data type change ⚠️
349
- - `search_workspace_content` - Search across node SQL, column names, descriptions, and config values using the lineage cache as a searchable index
350
-
351
- ## Snowflake Exploration via Cortex Code
465
+ ## Snowflake exploration via Cortex Code
352
466
 
353
467
  This server manages node definitions, not live warehouse data. For Snowflake data questions (tables, schemas, row counts, sample data, permissions), add [Cortex Code](https://ai.snowflake.com) as a companion MCP server. The agent will automatically route Snowflake questions to cortex tools.
354
468
 
@@ -374,17 +488,23 @@ This server manages node definitions, not live warehouse data. For Snowflake dat
374
488
 
375
489
  The agent will see both servers' tools and route Snowflake data questions to cortex and node/pipeline questions to Coalesce tools.
376
490
 
377
- ## Notes
491
+ ## Notes and conventions
378
492
 
493
+ - **Credential resolution order.** For every Coalesce/Snowflake credential field: env var wins when set, otherwise the `~/.coa/config` profile selected by `COALESCE_PROFILE` (default `[default]`) fills in. Call `diagnose_setup` to see which source supplied each value — the `source` tags in its output read `env`, `profile:default`, etc.
494
+ - **Profile file is optional.** If `~/.coa/config` doesn't exist, the server falls back to env-only mode. Startup never fails because of a missing or malformed profile file — it just logs a stderr warning.
495
+ - **SQL override is disallowed.** Nodes are built via YAML/config (columns, transforms, join conditions), not raw SQL. Template generation strips `overrideSQLToggle`, and write helpers reject `overrideSQL` fields.
379
496
  - **Caching:** Large responses are auto-cached to disk. Use `cache_workspace_nodes` and similar tools when you want a reusable snapshot. Configure the threshold with `COALESCE_MCP_AUTO_CACHE_MAX_BYTES`.
380
497
  - **Repo-backed tools:** Set `COALESCE_REPO_PATH` to your local Coalesce repo root (containing `nodeTypes/`, `nodes/`, `packages/`) or pass `repoPath` on individual tool calls. The server does not clone repos or install packages.
381
- - **SQL override is disallowed.** Nodes are built via YAML/config (columns, transforms, join conditions), not raw SQL. Template generation strips `overrideSQLToggle`, and write helpers reject `overrideSQL` fields.
498
+ - **COA CLI versioning:** The bundled COA CLI is pinned to an exact alpha version. It is *not* a floating `@next` tag — every release of this MCP ships with a known-good COA build. Changelog scanning and bump policy live in [docs/RELEASES.md](docs/RELEASES.md).
499
+ - **COA describe cache:** COA describe output is cached under `~/.cache/coalesce-transform-mcp/coa-describe/<coa-version>/` after first access. Cache is version-keyed — upgrading the MCP automatically invalidates stale content.
382
500
 
383
501
  ## Links
384
502
 
385
503
  - [Coalesce Docs](https://docs.coalesce.io/docs)
386
504
  - [Coalesce API Docs](https://docs.coalesce.io/docs/api/authentication)
505
+ - [Coalesce CLI (`coa`)](https://docs.coalesce.io/docs/cli)
387
506
  - [Coalesce Marketplace Docs](https://docs.coalesce.io/docs/marketplace)
507
+ - [Model Context Protocol](https://modelcontextprotocol.io/)
388
508
 
389
509
  ## License
390
510