sqlmesh-mcp
v0.3.0MCP server exposing a SQLMesh project (models, plans, column-level lineage, audits) to LLM agents
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_models
List every model in the SQLMesh project with its kind, columns, owner, and description.
get_model
Full detail for one model: rendered query, columns, kind, owner, tags, description.
| Parameter | Type | Description |
|---|---|---|
model_name * | string |
get_model_dependencies
Return the direct upstream and downstream model dependencies.
| Parameter | Type | Description |
|---|---|---|
model_name * | string |
fetch_model_data
Fetch a bounded, optionally column-filtered preview of model data.
| Parameter | Type | Description |
|---|---|---|
model_name * | string | |
columns | ||
limit | integer | |
mask_sensitive | boolean |
server_info
Return server, project, safety, and capability metadata.
start_plan
Start a plan preview in the background and return a job ID.
| Parameter | Type | Description |
|---|---|---|
environment | ||
select_models |
start_run
Start a scheduled model run in the background. Requires confirm=true.
| Parameter | Type | Description |
|---|---|---|
confirm | boolean | |
end | ||
environment | ||
start |
get_job_status
Return the current status and result of an asynchronous plan or run.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
cancel_job
Cancel a queued job. Running SQLMesh operations cannot be interrupted safely.
| Parameter | Type | Description |
|---|---|---|
job_id * | string |
model_impact
Return all transitive upstream and downstream models affected by a change.
| Parameter | Type | Description |
|---|---|---|
model_name * | string |
environment_health
Summarize environment existence, snapshots, and current project drift.
| Parameter | Type | Description |
|---|---|---|
environment * | string |
audit_history
Return recent dataveil audit events without exposing cell values.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
plan
Preview what a plan against an environment would change. Does not apply anything. Returns a plan_id -- pass it to apply_plan to actually apply this exact plan.
| Parameter | Type | Description |
|---|---|---|
environment | ||
select_models |
apply_plan
Apply a previously-previewed plan. THIS CHANGES REAL DATA in the target warehouse. Requires confirm=true. plan_id must come from a plan() call in this same session -- plans aren't kept across server restarts.
| Parameter | Type | Description |
|---|---|---|
plan_id * | string | |
confirm | boolean |
lineage
Column-level lineage: which upstream models/columns does this column depend on.
| Parameter | Type | Description |
|---|---|---|
column * | string | |
model_name * | string |
run_audit
Run audits for a model (or all models if omitted). start/end bound the data checked.
| Parameter | Type | Description |
|---|---|---|
end | ||
model_name | ||
start |
run_test
Run unit tests for a model (or all tests if omitted).
| Parameter | Type | Description |
|---|---|---|
model_name |
diff_environment
Diff the current context against a target environment.
| Parameter | Type | Description |
|---|---|---|
environment * | string |
list_environments
List every environment that exists in this project's state (e.g. prod, dev, ...).
table_diff
Compare two tables or environments and return structured schema/row differences. When comparing environments, pass select_models to choose the models to compare. SQLMesh's console output is suppressed because MCP clients receive the JSON result.
| Parameter | Type | Description |
|---|---|---|
source * | string | |
target * | string | |
limit | integer | |
on | ||
select_models | ||
skip_columns | ||
where |
format
Check or format SQLMesh model and audit files. The default check mode is read-only. Writing formatted files requires confirm=true and is never performed accidentally by an agent.
| Parameter | Type | Description |
|---|---|---|
check | boolean | |
confirm | boolean | |
paths |
run
Execute scheduled/due model runs for an environment. THIS CHANGES REAL DATA. Distinct from plan/apply_plan: this runs already-promoted models for their due intervals (what a cron trigger would do), rather than previewing or promoting structural changes. Requires confirm=true.
| Parameter | Type | Description |
|---|---|---|
confirm | boolean | |
end | ||
environment | ||
start |
profile_model
Aggregate-only profile of a model's columns: null rates, distinct counts, numeric stats, generalized string format signatures (e.g. 'ddd-dd-dddd'). Returns no raw rows or samples; see dataveil's README for its known limits. The model must already be applied (see plan/apply_plan) -- dataveil reads from its current physical snapshot table.
| Parameter | Type | Description |
|---|---|---|
model_name * | string |
propose_cleansing_plan
Everything an agent needs to propose a data-cleansing plan for a model: the aggregate-only profile, a local sensitivity classification per column (PII:EMAIL, PII:SSN, PII:PHONE, ... or "none", each with a match_rate), and the closed operation vocabulary apply_cleansing_plan will accept. This tool does not call an LLM or propose a plan itself -- it's the documented contract an agent (you) reasons over to build one. A plan is a list of {"operation", "column", "params", "rationale"} objects; "operation" must be a key in operation_vocabulary, and only the params li…
| Parameter | Type | Description |
|---|---|---|
model_name * | string |
register_cleansing_plan
Register a cleansing plan for later approval, instead of applying it directly. Only useful when this server requires plan approval (DATAVEIL_REQUIRE_PLAN_APPROVAL=true) -- otherwise apply_cleansing_plan already accepts a plan directly and this tool isn't needed. Validates the plan against the operation vocabulary and the model's schema immediately -- a reviewer should never approve something that would fail at execution time. Read-only: nothing is applied here. Returns a plan_id; pass it to approve_cleansing_plan, then to apply_cleansing_plan.
| Parameter | Type | Description |
|---|---|---|
model_name * | string | |
plan * | array |
approve_cleansing_plan
Mark a plan registered via register_cleansing_plan as approved. This only records who approved it -- apply_cleansing_plan still requires confirm=true on top of this. Approval and confirm=true are two separate gates, not a substitute for each other.
| Parameter | Type | Description |
|---|---|---|
approved_by * | string | |
plan_id * | string |
apply_cleansing_plan
Validate and apply a data-cleansing plan. THIS CHANGES REAL DATA in the model's current physical snapshot table. Requires confirm=true. Default mode: pass `plan` directly, built from propose_cleansing_plan's output -- validated against the operation vocabulary and the model's schema before any step runs, same as always. If this server requires plan approval (DATAVEIL_REQUIRE_PLAN_APPROVAL= true): pass `plan_id` instead, from a plan that was registered (register_cleansing_plan) and then approved (approve_cleansing_plan) by someone else. confirm=true is still re…
| Parameter | Type | Description |
|---|---|---|
model_name * | string | |
confirm | boolean | |
plan | ||
plan_id |