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
POSTanswered with JSON. There is no session and no SSE stream; GET returns 405. Raw HTTP callers must sendAccept: application/json, text/event-stream. - •Capabilities: tools, prompts, and prompt-argument completions.
- •Legacy path:
/api/mcpon the same host serves the same server. Use/mcpfor 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.
| Case | Result |
|---|---|
| No key, or an invalid, revoked, or expired key | HTTP 401 |
| Key not owned by an organization, or no LakeOps workspace for it on that host | HTTP 403 |
| Valid key with at least one scope | Connected. Each tool checks its own scope when called. |
| Tool called without its scope | Tool 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.
| Scope | Grants |
|---|---|
read | Read in every domain. Required on its own by analyze_*, get_table_events, and get_lake_health. |
write | Write in every domain, including tables:delete but not catalogs:admin. Does not include read. |
catalogs:read | list_catalogs. |
catalogs:write | Catalog registration and refresh (REST). |
catalogs:admin | Editing 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:read | Table discovery and inspection tools, query_compaction, get_compaction_job_status. |
tables:write | execute_optimization; REST table operations such as rename, rollback, properties, and table deletion. Does not unlock the MCP delete_table tool. |
tables:delete | delete_table over MCP. REST table deletion checks tables:write instead. |
policies:read | list_policies. |
policies:write | create_policy, update_policy, enable_policy, disable_policy, execute_policy. |
query:read | Ad-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.
| Tool | Scope | Details |
|---|---|---|
list_catalogsread-only | catalogs:read | Every 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-only | tables:read | Namespaces in a catalog and their child tables. query filters on namespace path.args: catalog*, query |
search_tablesread-only | tables:read | Find 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-only | tables:read | Size, 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-only | tables:read | Current columns, identifier_columns, partition_by, sort_by, schema_id, and format_version.args: catalog*, namespace*, table* |
get_table_metadataread-only | tables:read | Raw Iceberg metadata plus ai_context: resolved schema, partition and sort columns, current snapshot stats, refs, and properties.args: catalog*, namespace*, table* |
get_table_insightsread-only | tables:read | Why 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-only | tables:read | Adaptive 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-only | tables:read | Stats, 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-only | tables:read | Per-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-only | tables:read | Top 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-only | tables:read | Full-scan cost metrics (files, bytes, average file size, deletes, snapshots, manifests) and cost_signals[] warnings.args: catalog*, namespace*, table* |
get_table_eventsread-only | read | Operation 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-only | read | Org-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-only | policies:read | Governance 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.
| Tool | Scope | Details |
|---|---|---|
query_compactionread-only | tables:read | Plan 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-only | tables:read | Status 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.
| Tool | Scope | Details |
|---|---|---|
analyze_table_healthread-only | read | Quick health check from stats, insights, and recent events.args: catalog*, namespace*, table* |
analyze_table_maintenanceread-only | read | Full maintenance decision: profile, effective policies, and the last 20 events. Can recommend doing nothing.args: catalog*, namespace*, table* |
analyze_critical_triageread-only | read | CRITICAL and WARNING tables with top insights, ranked for on-call. limit defaults to 20, max 50.args: catalog, limit |
analyze_compactionread-only | read | Small-file, high-delete, and CRITICAL tables, with compaction planning instructions.args: catalog |
analyze_storage_reclaimread-only | read | Measured 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-only | read | 30-day dashboard and CRITICAL tables, as an executive summary.args: catalog |
analyze_policy_gapsread-only | read | Maintenance insights next to existing policies, with missing or misconfigured policies.args: catalog |
Policies
Edit saved policy definitions, or run one now.
| Tool | Scope | Details |
|---|---|---|
create_policychanges config | policies:write | Create 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 config | policies:write | Change fields on an existing policy. policy holds only the fields to change.args: type*, id*, policy* |
enable_policychanges config | policies:write | Re-enable a disabled policy.args: id* |
disable_policychanges config | policies:write | Pause a policy without deleting it.args: id* |
execute_policydestructive | policies:write | Run 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.
| Tool | Scope | Details |
|---|---|---|
execute_optimizationdestructive | tables:write | Run 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_tabledestructive | tables:delete | Remove 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.
| type | Example config | Notes |
|---|---|---|
COMPACT_DATA_FILES | {"whereClause": "1=1"} | whereClause is a SQL predicate on file metadata; default 1=1 (all files). Other compaction fields are accepted but not applied on this path today. |
EXPIRE_SNAPSHOTS | {"olderThan": 1767225600000, "retainLast": 5} | olderThan is epoch milliseconds. cleanExpiredMetadata and cleanExpiredFiles default to false. |
REMOVE_ORPHAN_FILES | {"olderThanDays": 7} | Default 3 days, clamped to 1–90. |
REWRITE_MANIFESTS | {} | No fields. |
REWRITE_POSITION_DELETE_FILES | {} | No fields. Run before REMOVE_DANGLING_DELETES. |
REMOVE_DANGLING_DELETES | {} | No fields. |
CREATE_SNAPSHOT_TAGS | {"tagNameTemplate": "eod-{yyyy}-{MM}-{dd}"} | tagNameTemplate is required and needs a {yyyy}, {MM}, {dd}, {HH}, or {ww} token (UTC). maxRefAgeMs is optional. |
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 };instructionscontains the preloaded data and the report format the agent should follow. - •Failures set
isError: trueand 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.
| Prompt | Arguments |
|---|---|
analyze_table_health | catalog, namespace, table |
analyze_table_maintenance | catalog, namespace, table |
analyze_critical_triage | catalog (optional), limit (optional) |
analyze_compaction | catalog (optional) |
analyze_storage_reclaim | catalog (optional) |
analyze_lake_health | catalog (optional) |
analyze_policy_gaps | catalog (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_FILESbeforeREMOVE_DANGLING_DELETES. - •Doing nothing is a valid outcome, for example on a stale table with little read or write activity.
