LeakageLens MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LeakageLens MCP Audit data/train.csv for leakage before training. Target=churned, entity=customer_id, split=split."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LeakageLens MCP
Dataset forensics for AI coding agents. LeakageLens catches target leakage, cross-split entities, time leakage, PII, identifier features, class imbalance, and preprocessing-before- split errors before an agent trains a misleading model.
It is not a “chat with CSV” server. The dataset remains local; the MCP client receives bounded,
structured evidence and an explicit pass, review, or block verdict.
Why MCP?
Any MCP-compatible coding agent can discover the same audit tools and guidance without a custom integration. Resources provide experiment policy, prompts enforce a review workflow, and tools return typed evidence. The core engine works without an LLM; an optional Gemini check reasons about whether features exist at prediction time.
Related MCP server: COUE
Quick start
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
leakagelens examples/leaky_churn.csv \
--target churned --split split --entity customer_id --time-column signup_date
pytest -q
python evals/benchmark.pyExpected demo verdict: block, with direct-target, entity-overlap, PII, identifier, and semantic
leakage findings.
Connect an MCP client
Example local configuration:
{
"mcpServers": {
"leakagelens": {
"command": "/absolute/path/to/.venv/bin/leakagelens-mcp",
"env": {
"LEAKAGELENS_DATA_ROOT": "/absolute/path/to/leakagelens-mcp"
}
}
}
}Then ask your agent:
Review
examples/leaky_churn.csvbefore training a churn model. The target ischurned, the entity iscustomer_id,signup_dateis the time column, andsplitdefines train/test.
Remote transport
MCP_TRANSPORT=streamable-http LEAKAGELENS_DATA_ROOT="$PWD" leakagelens-mcpOr run the container with a read-only data mount:
docker build -t leakagelens-mcp .
docker run --rm -p 8000:8000 -v "$PWD/examples:/data:ro" leakagelens-mcpMCP surface
Primitive | Name | Purpose |
Tool |
| Bounded schema, missingness, uniqueness, and samples |
Tool |
| Leakage, PII, split, identifier, and metric checks |
Tool |
| AST audit of split/preprocessing order |
Tool |
| Optional Gemini semantic review |
Resource |
| Minimum valid experiment contract |
Prompt |
| Reusable pre-training workflow |
All file tools are restricted to LEAKAGELENS_DATA_ROOT to avoid arbitrary host-file access.
Detection design
Direct leakage: equality, near-perfect numeric association, deterministic categorical maps
Semantic leakage: outcome-like and target-derived column names
Split leakage: entity overlap and invalid chronological boundaries
Privacy: PII column names and value-pattern scans
Pipeline leakage: Python AST detects fitting or resampling before the split
Evaluation risk: imbalance-aware metric recommendations
Every finding includes a stable code, severity, evidence, affected columns, and remediation. The
risk score is deterministic: critical 30, high 15, medium 7, low 3, capped at 100.
Optional Gemini review
pip install -e '.[gemini]'
export GEMINI_API_KEY='...'
export GEMINI_MODEL='gemini-2.5-flash'Only column names/types and the user-provided prediction moment are sent. Raw rows are not sent. Security decisions never depend solely on the model.
Benchmark
evals/benchmark.py generates 35 reproducible scenarios: 25 seeded leakage/privacy/evaluation
cases and 10 clean negative controls. It reports scenario recall and false-block rate. Add cases
before adding heuristics; this prevents a growing collection of unmeasured rules.
Current synthetic benchmark result: 35/35 scenarios passed, 100% scenario recall, 0% false-block rate. These figures validate the included seeded cases; they are not estimates of performance on arbitrary real-world datasets.
Current boundaries
Statistical association is a warning, not proof of leakage.
Semantic rules cannot know feature availability without a prediction-time contract.
The AST audit recognizes common scikit-learn patterns, not arbitrary dynamic Python.
This release audits supplied splits; it does not mutate the user’s dataset.
Architecture
MCP client → FastMCP tools → path boundary → audit engine → typed findings
├── dataframe checks
├── split validation
├── Python AST audit
└── optional Gemini reviewDevelopment
ruff check .
pytest -q
python evals/benchmark.pySee HELPER_GUIDE.md for a concise code walkthrough.
Available Tools
4 toolsaudit_datasetC
Detect target, entity and temporal leakage, PII, identifiers, and metric risks.
Inputs: path (required), split, entity, target, +1 more.
audit_training_codeA
Statically detect preprocessing or resampling before the train/test split.
Inputs: path (required). Returns: result
profile_datasetA
Profile a local CSV, Parquet, or JSONL without sending the full dataset to the model.
Inputs: path (required), sample_rows.
review_feature_availabilityC
Optionally ask Gemini which features may be unavailable at the prediction moment.
Inputs: path (required), target (required), prediction_time (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct stage of leakage detection: profiling, dataset auditing, code auditing, and feature availability review. However, profile_dataset and audit_dataset could be confused by an agent since both operate on datasets, though their descriptions help separate general profiling from leakage-specific auditing.
All tool names consistently follow a verb_noun pattern using lowercase snake_case: profile_dataset, audit_dataset, audit_training_code, and review_feature_availability. This makes the tool set predictable and easy to navigate.
Four tools is well-scoped for a specialized leakage-detection server. Each tool has a clear, non-redundant role, and the count feels appropriate rather than thin or bloated.
The tool surface covers the core leakage-detection workflow: profile data, audit data for leakage, audit training code, and verify feature availability. Minor gaps exist around remediation or actionable reporting after an audit, but the main detection loop is complete.
Maintenance
Related MCP Connectors
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Check AI work against requirements and return structured verdicts, findings, and repair steps.
Pre-execution governance for AI agents. Deterministic PASS/FAIL/REVIEW verdicts, replayable proof.
Deterministic pre-execution audit for trading agents. PASS/WAIT/FAIL, reproducible verdict_hash.
Related MCP Servers
- AlicenseAqualityBmaintenanceEvidence-backed, read-only codebase diagnostics for coding agents: secrets, dependency, RLS, and source-impact audits with a verify loop and PR review verdicts. Never writes files or uses the network by default.7101 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to audit AI/ML projects for production readiness through deterministic static analysis, check ML system descriptions, compare model configurations, and generate readiness reports or deployment checklists. It returns scored, evidence-based findings with explicit unknowns while never executing submitted code or accessing the network.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to run deterministic, read-only local repository audits for risky GitHub workflows, undocumented environment variables, possible credentials, and conflicting dependency configuration, returning structured findings without sending source code to a service.43 npmMIT
- AlicenseBqualityCmaintenanceEnables local privacy scanning and masking of secrets and PII, verifies test-suite integrity to prevent silent fake success, and inspects or blocks destructive terminal and SQL commands before execution.4Apache 2.0