
MCP for Apache Iceberg: How AI Agents Actually Operate a Data Lake
Purpose-built MCP tools turn AI agents from chat assistants into operational participants that discover, diagnose, and govern Iceberg tables with structured signals.
AI Agents
Intelligence keeps your tables fast, agents get safe, optimized SQL through QueryFlux, and agentic operations run over MCP, each within the limits you set.
LakeOps| Operation | Table | Duration | Impact | Time | Status |
|---|---|---|---|---|---|
| Compact Data Files | customer_orders orders | 4s | 1.24 TB, 16 → 1 files | 57 minutes ago | SUCCESS |
| Expire Snapshots | payment_transactions payments | 27s | 8.2 TB | 4 hours ago | SUCCESS |
| Expire Snapshots | inventory_snapshots_20250702 warehouse | 3s | 2.1 TB | 4 hours ago | SUCCESS |
| Rewrite Manifests | raw_clickstream analytics | 1.9s | 3 → 1 manifests | 5 hours ago | SUCCESS |
| Compact Data Files | product_catalog products | 6m 11.3s | 3,008 → 1,256 files | 6 hours ago | SUCCESS |
Open and runs on your stack
How it works
Give each agent a key with only the scopes it needs, connect any MCP client, and every action stays inside those limits.
Pick read, write, or narrower scopes for each agent in Organization > API Keys.
Point Cursor, Claude Code, Claude Desktop, or any MCP client at your region's /mcp.
Agents check health, plan and run maintenance, and manage policies within scope.
SQL goes through QueryFlux, where read-only, row-limit, and masking guards apply.
Monitoring started at seq #4,812. Everything written from that point on is in scope.
01 · Fast tables
execute_query
SELECT region, sum(amount)
FROM orders
WHERE order_date >= DATE '2026-11-01'
GROUP BY regionmax_rows 1000 · routed to duckdb-local
02 · Query
read_onlyBlocks writes and DDL
row_limitmax_rows 5,000
require_predicateNo full scans on orders
opa_accessMasks email, filters region
HumanApprovalPauses writes for review
03 · Guardrails
Discover
Diagnose
Decide
Act
04 · LakeOps MCP server
triage-agentHealth, insights, signals, plans
maintenance-agentAlso runs compaction and expiry
policy-agentAlso creates and edits policies
05 · Scoped keys
→ analyze_critical_triage
3 critical, 12 warning tables
→ get_table_profile
orders: 42% small files, 214 manifests
06 · Triage
→ query_compaction
18 groups · 970 files · 1.24 TB
→ execute_optimization
COMPACT_DATA_FILES submitted
→ get_table_events
SUCCESS · 970 → 87 files
07 · Act
Manage maintenance, configuration, and lifecycle policies for your data lakehouse
| On | Policy | Type | Next Run | Last Run | Updated | Actions |
|---|---|---|---|---|---|---|
orders_critical | Compact Files | Apr 25, 2026, 8:12 AM | Apr 25, 2026, 03:05 AM | Feb 01, 2025, 3:46 PM | ••• | |
payments_compact | Compact Files | Feb 15, 2026, 12:06 AM | Feb 1, 2025, 02:18 PM | Feb 5, 2025, 4:03 PM | ••• | |
Remove orphan files (e-ip...) For all tables in all catalogs every 7 days | Orphan Files | Apr 25, 2026, 8:12 AM | Apr 25, 2026, 04:07 PM | Jun 23, 2025, 04:01 PM | ••• | |
clickstream_cdc_events_p | Expire Snapshots | Apr 25, 2026, 12:03 AM | Apr 25, 2026, 03:05 AM | Jan 28, 2025, 03:25 PM | ••• | |
sessions_cdc_events_p | Expire Snapshots | Apr 25, 2026, 12:03 AM | Apr 26, 2026, 03:05 AM | Jun 26, 2025, 11:11 PM | ••• | |
global_expire_snapshots Runs snapshot expiration on all tables once a day | Expire Snapshots | Apr 26, 2026, 1:18 PM | Apr 07, 2026, 01:08 PM | Mar 14, 2026, 8:42 AM | ••• | |
manifest_rewrite_weekly Rewrite manifests for all critical tables weekly | Rewrite Manifests | Apr 28, 2026, 2:00 AM | Apr 21, 2026, 02:00 AM | Mar 10, 2026, 9:15 AM | ••• | |
staging_config | Configuration | — | — | Dec 31, 2025, 02:45 PM | ••• |
08 · Policies
LakeOps reads your Iceberg metadata. Data stays in your storage.
Every table's health and what it needs, from the first scan.
Autopilot, on-demand runs, or your own policies.
The challenge
Handing an agent a warehouse key gives it too much power, too little context, and no way to keep the tables it reads healthy.
Agents often get a service account or warehouse key. Whatever that key can do, the agent can do, and every action looks like the same user.
A read-only agent can still scan a petabyte, pull millions of rows, or read columns it should never see.
Small files, piled-up deletes, and bloated manifests turn a simple agent lookup into a long scan.
Most data MCP servers stop at queries. Checking table health or running maintenance still takes a person and a Spark job.
Compare
Raw credentials have no limits, and query-only MCP servers stop at SQL. LakeOps and QueryFlux give agents safe, optimized access and agentic operations over MCP, inside scopes and guardrails.
| Capability | Raw database credentials | Query-only MCP server | LakeOps + QueryFlux |
|---|---|---|---|
| What agents can do | Whatever the credential allows | Run SQL and browse schemas | Query, plus check table health, plan and run maintenance, and manage policies |
| Permissions | The credential's grants | Often a read-only switch | Scoped API keys checked on every tool call, plus per-group SQL guardrails |
| SQL guardrails | None | Read-only, sometimes a row cap | Read-only, row limits, required predicates, row filters and column masks, custom guards |
| Identity and audit | One shared user | Server logs | Agent and conversation on each query, replay in Studio, and every operation in Events |
| Engines | One database | One engine | Routed across Trino, DuckDB, StarRocks, Athena, and more |
| Table health | Not covered | Not covered | Tables maintained so agent queries stay fast |
Query-only MCP servers vary by vendor; details are from public documentation, November 2026.
Results
Benchmarks from production-grade tables across multiple engines and clouds.
Query speed
After compaction + layout optimization
CPU reduction
Compute hours across all engines
Storage saved
Orphans, snapshots & bloat removed
Table health
Autonomous maintenance keeps every table optimized
See it in action
Healthy Iceberg tables for people and agents alike.
FAQ
Three things, the three parts of an agentic lakehouse. Intelligence runs the lakehouse, so the tables agents read stay fast. Agents get safe, optimized access to the data: SQL through QueryFlux, behind guardrails, routed and cached. And agentic operations run over the LakeOps MCP server: agents check health, read insights and maintenance signals, plan and run compaction, expire snapshots, and manage policies, within the scopes of their API key.
Cursor, Claude Code, Claude Desktop, and any client that supports MCP over Streamable HTTP. Each LakeOps region has a hosted server at its API host plus /mcp; you add it to the client with an organization API key. There's nothing to install locally.
With scopes on its API key. A key with read can inspect everything but change nothing; tables:write adds execute_optimization; policies:write adds policy changes; table deletion needs its own scope. Every tool checks its scope when it's called, and a call without the scope runs nothing.
Yes, through QueryFlux's MCP endpoint. Agents use execute_query, list_schemas, describe_table, and explain_query, and each query is routed to an engine such as Trino or DuckDB. Results default to 1,000 rows.
Guardrails run before a query reaches any engine: read_only blocks writes and DDL, row_limit caps results, require_predicate rejects full scans on tables you name, and OPA or Cerbos policies add row filters and column masks. Python script and HTTP webhook guards cover anything else, such as calling your own approval service.
Yes. QueryFlux records every query with its agent and conversation, plus each guardrail decision, and QueryFlux Studio can replay a whole agent session. On the LakeOps side, every maintenance operation an agent starts is recorded in Events.
No. The organization comes from the API key, never from tool arguments, so an agent only ever sees the organization its key belongs to.
Related
Resources
A scoped key, the MCP server, and guarded SQL for your Iceberg tables.