MCP Server

Reference for the LakeOps Model Context Protocol server: endpoints, auth, scopes, and every tool an agent can call. To set up a client, follow Connect Your Agent. For worked prompts, see Manage the Lakehouse.

Endpoints and transport

LakeOps runs in data regions around the world. Each region has its own MCP server at your region's API host plus /mcp, for example https://api.lakeops.dev/mcp. Connect Your Agent generates the URL and client config for your region.

  • •Transport: stateless Streamable HTTP. Every JSON-RPC message is a POST answered with JSON. There is no session and no SSE stream; GET returns 405. Raw HTTP callers must send Accept: application/json, text/event-stream.
  • •Capabilities: tools, prompts, and prompt-argument completions.
  • •Legacy path: /api/mcp on the same host serves the same server. Use /mcp for new setups.

Authentication and tenant isolation

MCP requests pass through the same authentication filter as the REST API. Send an organization API key (created in Organization > API Keys) as Authorization: Bearer <key>. The organization comes from the key, never from tool arguments, so an agent cannot reach another tenant's data.

CaseResult
No key, or an invalid, revoked, or expired keyHTTP 401
Key not owned by an organization, or no LakeOps workspace for it on that hostHTTP 403
Valid key with at least one scopeConnected. Each tool checks its own scope when called.
Tool called without its scopeTool error scope '…' required; nothing runs

Permissions and scopes

You pick scopes when you create the key. A key can hold the global wildcards, domain scopes, or both. The same scopes apply to the REST API.

ScopeGrants
readRead in every domain. Required on its own by analyze_*, get_table_events, and get_lake_health.
writeWrite in every domain, including tables:delete but not catalogs:admin. Does not include read.
catalogs:readlist_catalogs.
catalogs:writeCatalog registration and refresh (REST).
catalogs:adminEditing or deleting a catalog and reading its properties, with secrets masked (REST). Includes catalogs:read and catalogs:write. Must be granted explicitly: write does not include it. Web sessions need the organization admin role.
tables:readTable discovery and inspection tools, query_compaction, get_compaction_job_status.
tables:writeexecute_optimization; REST table operations such as rename, rollback, properties, and table deletion. Does not unlock the MCP delete_table tool.
tables:deletedelete_table over MCP. REST table deletion checks tables:write instead.
policies:readlist_policies.
policies:writecreate_policy, update_policy, enable_policy, disable_policy, execute_policy.
query:readAd-hoc SQL over REST. No MCP tool uses it.

Within a domain, write implies read: a policies:write key can also call list_policies. Across domains nothing is implied, and the global write wildcard does not grant read.

Tools

The server registers 31 tools. Clients discover them with the standard tools/list call. Arguments marked * are required. Every argument is a string except hardDelete, which also accepts a boolean. JSON payloads such as config and policy are passed as JSON strings.

Agents should resolve names with list_catalogs, list_namespaces, or search_tables before calling table-scoped tools. Nested namespaces are dot-separated (for example analytics.staging).

Discovery and read

Return structured JSON.

ToolScopeDetails
list_catalogsread-onlycatalogs:readEvery catalog with name, type, uri, warehouse, status (true or false), lastSync, tableCount, and totalSizeBytes. The REST API calls the size totalSizeInBytes. Call this first.args: none
list_namespacesread-onlytables:readNamespaces in a catalog and their child tables. query filters on namespace path.args: catalog*, query
search_tablesread-onlytables:readFind tables. status is HEALTHY, WARNING, or CRITICAL. orderBy accepts tableSizeInBytes, recordCount, deleteFileCount, lastModifiedTime, scanTimestamp, catalogName, namespace, tableName. tableSizeInBytes is live data only; get_table_details has what is really on storage.args: query, catalog, namespace, status, orderBy, orderDir
get_table_detailsread-onlytables:readSize, record count, delete files, status, location, and format for one table. storageBreakdown adds what is really on storage: live data, data held only by old snapshots, the metadata log, unreferenced metadata files, estimated orphan data, and when it was measured. It is null until the table has been scanned.args: catalog*, namespace*, table*
get_schemaread-onlytables:readCurrent columns, identifier_columns, partition_by, sort_by, schema_id, and format_version.args: catalog*, namespace*, table*
get_table_metadataread-onlytables:readRaw Iceberg metadata plus ai_context: resolved schema, partition and sort columns, current snapshot stats, refs, and properties.args: catalog*, namespace*, table*
get_table_insightsread-onlytables:readWhy a table is WARNING or CRITICAL: small files, snapshot or manifest bloat, partition skew, high deletes, stale table, missing ref retention.args: catalog*, namespace*, table*
get_maintenance_signalsread-onlytables:readAdaptive maintenance sample: needs_compaction, needs_expire_snapshots, needs_rewrite_manifests, needs_remove_dangling_deletes, needs_rewrite_position_deletes, scores, accumulation rates, projected trigger times.args: catalog*, namespace*, table*
get_table_profileread-onlytables:readStats, insights, and signals in one call, with health_signals[] and maintenance_decisions. Prefer over calling the three separately.args: catalog*, namespace*, table*
get_partition_distributionread-onlytables:readPer-partition file counts, sizes, records, delete ratios, and size histograms. page is 0-based; pageSize 1–1000 (default 100).args: catalog*, namespace*, table*, snapshot_id, q, page, pageSize
get_hot_partitionsread-onlytables:readTop partitions by files and by records, with skew_signal when the hottest exceeds 10× the average. limit defaults to 20, max 100.args: catalog*, namespace*, table*, snapshot_id, limit
get_table_scan_cost_hintsread-onlytables:readFull-scan cost metrics (files, bytes, average file size, deletes, snapshots, manifests) and cost_signals[] warnings.args: catalog*, namespace*, table*
get_table_eventsread-onlyreadOperation history with per-type details. status is SUBMITTED, RUNNING, SUCCESS, or FAILED; from/to are ISO-8601; limit defaults to 50, max 200. Use it to follow anything you triggered.args: catalog, namespace, table, type, status, from, to, limit
get_lake_healthread-onlyreadOrg-wide summary for the last 30 days: table and catalog counts, health breakdown, storage reclaimed, compaction volume, tablesNeedingOptimization. storageAudit adds real storage vs live data, what reclaims the difference, how old the numbers are, and the tables wasting the most storage with the main cause for each. totalDataSizeBytes is live data only.args: none
list_policiesread-onlypolicies:readGovernance policies with config, cron, and schedule state. scopeKind=TABLE_ATTACHED with catalog, namespace, and table lists the policies attached to that table.args: type, catalog, namespace, scopeKind, table

Compaction planning

Plan only. Use execute_optimization to run compaction.

ToolScopeDetails
query_compactionread-onlytables:readPlan compaction without running it: compaction groups, file stats, and estimated parallelism. where is a SQL predicate on file metadata (1=1 selects every file). config is a JSON string of planner options such as target_file_size or max_parallelism; execute is rejected.args: catalog*, namespace*, table*, where*, config
get_compaction_job_statusread-onlytables:readStatus of a compaction planner job by UUID.args: job_id*

Analysis workflows

Return { title, instructions } with live data preloaded. The agent follows instructions; nothing changes.

ToolScopeDetails
analyze_table_healthread-onlyreadQuick health check from stats, insights, and recent events.args: catalog*, namespace*, table*
analyze_table_maintenanceread-onlyreadFull maintenance decision: profile, effective policies, and the last 20 events. Can recommend doing nothing.args: catalog*, namespace*, table*
analyze_critical_triageread-onlyreadCRITICAL and WARNING tables with top insights, ranked for on-call. limit defaults to 20, max 50.args: catalog, limit
analyze_compactionread-onlyreadSmall-file, high-delete, and CRITICAL tables, with compaction planning instructions.args: catalog
analyze_storage_reclaimread-onlyreadMeasured storage waste, largest tables, and snapshot-bloat insights, with a prioritized cleanup plan that matches each cause to the action that reclaims it.args: catalog
analyze_lake_healthread-onlyread30-day dashboard and CRITICAL tables, as an executive summary.args: catalog
analyze_policy_gapsread-onlyreadMaintenance insights next to existing policies, with missing or misconfigured policies.args: catalog

Policies

Edit saved policy definitions, or run one now.

ToolScopeDetails
create_policychanges configpolicies:writeCreate a policy. policy is a JSON string with name, catalogName, executionType (APPLIED, SCHEDULED, MANUAL), cronExpression, namespaces, tableNames, enabled, and config. REMOVE_DANGLING_DELETES and REWRITE_POSITION_DELETE_FILES take no config fields. Pair REMOVE_ORPHAN_FILES with an enabled EXPIRE_SNAPSHOTS or ADAPTIVE_MAINTENANCE policy in the same or broader scope; this isn't enforced.args: type*, policy*
update_policychanges configpolicies:writeChange fields on an existing policy. policy holds only the fields to change.args: type*, id*, policy*
enable_policychanges configpolicies:writeRe-enable a disabled policy.args: id*
disable_policychanges configpolicies:writePause a policy without deleting it.args: id*
execute_policydestructivepolicies:writeRun a SCHEDULED or MANUAL policy now. Not valid for APPLIED policies. Returns immediately; follow progress with get_table_events.args: id*

Table operations

Act on one table directly.

ToolScopeDetails
execute_optimizationdestructivetables:writeRun one maintenance operation on one table once, without saving a policy. Submits a workflow and returns immediately; follow progress with get_table_events. Types and config are below.args: catalog*, namespace*, table*, type*, config
delete_tabledestructivetables:deleteRemove a table from the catalog. Default is a soft delete that leaves data files; hardDelete=true also purges data files asynchronously. Irreversible.args: catalog*, namespace*, table*, hardDelete

Tool annotations match the labels above. Read-only tools carry readOnlyHint. execute_policy, execute_optimization, and delete_table carry destructiveHint, so clients that honor it ask for confirmation before running them.

execute_optimization types

Pass type and an optional config JSON string (default {}). The REST equivalent is POST /api/tables/{catalog}/{namespace}/{table}/policies/{type}/execute with the same config as the request body.

typeExample config
COMPACT_DATA_FILES{"whereClause": "1=1"}
EXPIRE_SNAPSHOTS{"olderThan": 1767225600000, "retainLast": 5}
REMOVE_ORPHAN_FILES{"olderThanDays": 7}
REWRITE_MANIFESTS{}
REWRITE_POSITION_DELETE_FILES{}
REMOVE_DANGLING_DELETES{}
CREATE_SNAPSHOT_TAGS{"tagNameTemplate": "eod-{yyyy}-{MM}-{dd}"}

A successful call returns { "success": true, "type": …, "message": "Optimization execution triggered…" }. The operation then shows up in get_table_events as SUBMITTED, RUNNING, and finally SUCCESS or FAILED.

Responses and errors

  • •Results come back as a single text content item holding JSON. Analysis tools return { title, instructions }; instructions contains the preloaded data and the report format the agent should follow.
  • •Failures set isError: true and return { "error": "…" }. Common messages: scope 'policies:write' required, catalog, namespace, and table are required, Invalid config JSON: ….
  • •Lookups for a name that does not exist return a normal result such as { "error": "Table not found" } or { "error": "Catalog not found" }. Re-run discovery and retry with the exact names.

Built-in prompts

The seven analyze_* workflows are also registered as MCP prompts with the same names. Clients that surface prompts (Claude Desktop, for example) can start them from the prompt menu. Agents that only call tools, such as Cursor, should call the matching analyze_* tool and follow instructions. Both paths are read-only.

PromptArguments
analyze_table_healthcatalog, namespace, table
analyze_table_maintenancecatalog, namespace, table
analyze_critical_triagecatalog (optional), limit (optional)
analyze_compactioncatalog (optional)
analyze_storage_reclaimcatalog (optional)
analyze_lake_healthcatalog (optional)
analyze_policy_gapscatalog (optional)

Prompt arguments support completion/complete: up to 20 live suggestions, with namespace and table completions narrowed by the catalog (and namespace) already chosen. Tool arguments are not autocompleted, which is why agents should call the discovery tools first.

How maintenance decisions work

Adaptive maintenance samples every table and records why each operation should or should not run. get_maintenance_signals returns that sample; get_table_profile folds it together with stats and insights; and analyze_table_maintenance adds the table's policies and recent events and asks the agent for a ranked recommendation.

  • •Expire snapshots before removing orphan files.
  • •Run REWRITE_POSITION_DELETE_FILES before REMOVE_DANGLING_DELETES.
  • •Doing nothing is a valid outcome, for example on a stale table with little read or write activity.