A runtime diagnostics layer for local data engineering labs that wraps PostgreSQL-like and Databricks-like toy implementations with MCP tooling. Exposes 47 operations including explain_run for traced execution timelines, project_run_regression for full test suites with explainability, health_check and benchmark_calls for SLO tracking, and memory_search for incident retrieval. Built for teams running onboarding workshops or teaching storage internals who want runtime operations accessible through structured tooling instead of shell scripts. The explain layer treats both successful runs and controlled failure scenarios as first-class traced events, so you can inspect idempotency conflicts or concurrency storms the same way you'd review a prod incident.
Runnable Python and Rust data-system internals with an MCP-native runtime copilot layer.
This repository combines two things:
Requirements:
Setup:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install "psycopg[binary]"
Run end-to-end flow:
cargo run --bin e2e_flow
Run core demos:
.venv/bin/python mini_pg_like.py
.venv/bin/python mini_databricks_clone.py
cargo run --bin mini_pg_like
cargo run --bin mini_databricks_clone
mini_pg_like.py: PostgreSQL-like toy engine with heap table, B-tree index, and planner output.mini_databricks_clone.py: Databricks-like toy platform with versioning, partitions, DAGs, and events.src/bin/mini_pg_like.rs: Rust PostgreSQL-like demo.src/bin/mini_databricks_clone.rs: Rust Databricks-like demo.src/lib.rs, src/common.rs, src/pg.rs: shared Rust core modules.mcp_engine_server.py: MCP runtime adapter for diagnostics and regression workflows.Most internals content stops at diagrams. This project stays runnable and inspectable:
This repo also includes a minimal MCP server that wraps the lab operations:
mcp_engine_server.py.cursor/mcp.jsonCurrent MCP tool list for this release (47 tools total):
Engine state and runtime:
init_engineinsert_rowupsert_rowcreate_indexexplain_customerreindex_projectrun_e2e_flowExplainability and demos:
explain_rundemo_explain_rundemo_explain_run_failuredemo_explain_semantic_failuredemo_explain_idempotency_conflictdemo_explain_concurrency_failure_stormexplain_regression_suiteTrace and retrieval:
record_tool_tracesimilar_incidentsrefresh_trace_pathrefresh_docs_pathmemory_upsertmemory_searchSLO and ROI:
health_checkbenchmark_callsscenario_load_testcapture_roi_baselinereport_drift_bugdecision_gateSchema evaluation (verdict + report via MCP, no external Postgres):
schema_load_toolschema_explain_toolschema_evaluate_toolschema_evaluate_full_toolProject contract and regression:
project_manifestproject_capabilitiesproject_tool_catalogproject_get_defaultsproject_run_regressionproject_capture_baselineproject_compare_baselineGeneric project state:
project_list_entitiesproject_get_entityproject_upsert_entityproject_delete_entityproject_append_eventproject_ingest_traceproject_explain_runproject_export_stateGeneric heuristics:
project_list_heuristicsproject_run_heuristicFor machine-readable discovery, prefer:
project_tool_catalogproject_get_defaultsCurrent heuristic profiles available through project_run_heuristic:
pain_structurenaive_biasprice_distributionliquidity_signalsprice_liquidity_matrixcross_categorysale_formatspeed_signalstrust_signalsIf Cursor MCP auto-discovery is enabled, restart Cursor and connect mini-data-engine.
Default MCP runtime data paths are under tests/artifacts/mcp/*.
If Cursor keeps asking for MCP or command approval on every call, apply this once:
"security.workspace.trust.enabled": true
In Cursor, open Settings -> Agents -> Auto-Run and set:
Auto-run mode: Run in SandboxMCP Allowlist: add mini-data-engine tools you use oftenCommand Allowlist: add frequently used safe commandsKeep this repo opened as the same trusted workspace and reload the window once.
Notes:
Fastest way to see the new explainability use case in action through MCP:
demo_explain_run
That single tool call creates a traced run, records step-level events under one run_id,
and returns an explanation with:
You can then replay the same explanation directly with:
explain_run(run_id="...")
Use explain_regression_suite when you want regression checks to run through MCP and come back as explainable run summaries instead of isolated test output.
The suite drives the current validation surface through the MCP layer, attaches run_id traces, and returns explain output for each check so regressions can be inspected with the same mechanism used for runtime incidents.
It currently runs:
python -m unittest discovercargo test, including the current engine_cli integration testshealth_checkbenchmark_callsscenario_load_testThe explainability demos intentionally include both positive and negative controls:
demo_explain_run as expected_successdemo_explain_run_failure as expected_failuredemo_explain_semantic_failure as expected_failuredemo_explain_idempotency_conflict as expected_failuredemo_explain_concurrency_failure_storm as expected_failureThat means the suite is not only checking that the happy path stays green. It also checks that the explain layer still classifies and summarizes known failure classes correctly.
The current regression surface covers:
Fastest MCP call for the full regression bundle:
explain_regression_suite
Use it as the top-level MCP regression entrypoint when you want one answer that includes:
The MCP layer is an access interface, not the core product idea. The core of the repository is the runnable lab itself.
Product note:
PRODUCT_NOTE_RUNTIME_EXPLAINABILITY.md
Short note describing the runtime explainability use case, the required signals, and the explain_run MVP.PRODUCT_NOTE_RUNTIME_COPILOT.md
Product framing for Runtime Copilot as an MCP-native operational brain.EXPLAIN_REGRESSION_SUITE_FEASIBILITY.md
Short article describing what this repository validated about explain-first regression suites and where the current denominator still stays narrow.Use in Codex:
codex/skills/runtime-copilot/SKILL.mdcodex/automationsdocs/use-in-codex.mdRun persistent engine CLI (productization path):
# Initialize storage
cargo run --bin engine_cli -- init ./tests/artifacts/engine/data orders
# Insert and upsert (WAL append)
cargo run --bin engine_cli -- insert ./tests/artifacts/engine/data orders 1 4242 50
cargo run --bin engine_cli -- upsert ./tests/artifacts/engine/data orders 1 4242 55
# Build index and explain
cargo run --bin engine_cli -- index ./tests/artifacts/engine/data orders
cargo run --bin engine_cli -- explain ./tests/artifacts/engine/data orders 4242
# Write snapshot and truncate WAL
cargo run --bin engine_cli -- checkpoint ./tests/artifacts/engine/data orders
# Transaction simulation: begin/commit/rollback semantics,
# per-table write lock, snapshot read, and conflict detection
cargo run --bin engine_cli -- tx-demo ./tests/artifacts/engine/data orders
# Crash/restart recovery for transaction journals
cargo run --bin engine_cli -- tx-recovery-list ./tests/artifacts/engine/data orders
cargo run --bin engine_cli -- tx-recovery-commit ./tests/artifacts/engine/data orders <tx_id>
cargo run --bin engine_cli -- tx-recovery-rollback ./tests/artifacts/engine/data orders <tx_id>
mini_pg_like.py: selective predicate switches to Index Scan; non-selective stays Seq Scan.mini_databricks_clone.py: layer-by-layer demo output, workflow DAG order/metrics, and canonical events count from the single write path.mini_pg_like (Rust): same planner behavior with shared core modules.mini_databricks_clone (Rust): same layered demo using shared Rust library code.engine_cli (Rust): persistent snapshot + WAL replay flow with simple operational commands.engine_cli tx-demo: explicit transaction scopes, snapshot reads, per-table write lock, and concurrent upsert conflict detection.engine_cli tx-recovery-*: staged transaction operations survive process restarts via per-transaction journal files and can be committed or rolled back explicitly.e2e_flow: one command runs write path, checkpoint, bronze->silver transform, planner explain, and DuckDB SQL validation on persisted data.TECHNICAL_DESIGN_GENERIC.md captures the architectural discipline behind the code:
Idea -> API -> Runtime -> Storage -> Perf),It is not a separate product claim. It is the review and implementation spine used across the lab.
Build the image from this repo so MCP uses your local code (including schema tools) instead of the GitHub image:
./scripts/docker-build-local.sh
This builds mini-data-engine:local. To drive another project (e.g. threads) with this MCP, set Cursor MCP to use the local image and mount that project as workspace:
.cursor/mcp.json (or merge the mcpServers entry into your Cursor user config).${workspaceFolder} will be that project; the container gets WORKSPACE_ROOT=/workspace and your project mounted at /workspace, so e.g. schema_path="schema.sql" resolves to that project’s file.Example local config (uses mini-data-engine:local and mounts current workspace as /workspace):
{
"mcpServers": {
"mini-data-engine": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "WORKSPACE_ROOT=/workspace",
"-v", "${workspaceFolder}:/workspace",
"-v", "${workspaceFolder}/tests/artifacts:/app/tests/artifacts",
"mini-data-engine:local"
]
}
}
}
Image is published to GHCR:
ghcr.io/kroq86/data-engineering-runtime-lab:latestPull:
docker pull ghcr.io/kroq86/data-engineering-runtime-lab:latest
Use in Cursor MCP config (example):
{
"mcpServers": {
"mini-data-engine": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v",
"${workspaceFolder}/tests/artifacts:/app/tests/artifacts",
"ghcr.io/kroq86/data-engineering-runtime-lab:latest"
]
}
}
}
MCP surface for loom-ops and ops runbooks. Ecosystem: ECOSYSTEM.md
pip install ops-runtime-mcp
ops-runtime-mcp # stdio MCP; see docs/use-in-codex.md
io.github.ericm1018/skillfm-llm-cost-optimizer-openai-anthropic-usage
io.github.mikerawsonnz/llm-orchestration-agent
io.github.mikerawsonnz/authenticated-llm-agent
labforgedev/copilot-memory-mcp
csoai-org/agent-prompt-injection-firewall-mcp
io.github.mikerawsonnz/authenticated-multi-llm-agent