PluginBench
MCP Server
Active
MIT

io.github.mdefrance/autocarver MCP Server

io.github.mdefrance/autocarver

Automatically bin dataset columns into optimal, drift-robust buckets for classification and regression models.

What is the io.github.mdefrance/autocarver MCP server?

AutoCarver is an MCP server that qualifies dataset columns and processes them against a target using exhaustive search to find optimal, drift-robust bins. It supports binary, multiclass, ordinal, and continuous targets, with built-in dev-set and cross-validation robustness checks, and integrates with LLM assistants for AI-assisted feature carving.

AutoCarver turns raw numeric, categorical, and ordinal columns into optimal, human-readable bins in a single supervised pass. It uses exhaustive search to guarantee the best bin combination for a given min_freq, max_n_mod, and metric (Tschuprow's T or Cramér's V), and validates every candidate grouping on held-out data to prevent overfitting. The MCP server lets you qualify and carve columns through LLM tool calls, fully on your machine.

How to install io.github.mdefrance/autocarver

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "autocarver": {
      "command": "python",
      "args": [
        "autocarver",
        "-m",
        "AutoCarver.mcp"
      ]
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • qualify_columns — Analyze and infer feature types (numeric, categorical, ordinal) from a dataset
  • carve_features — Fit a carver against a target and generate optimal bins for all declared features
  • transform_data — Apply fitted carver bins to new data
  • get_summary — Retrieve per-bin statistics, target rates, and carving history

Use cases

  • Automatically bin features for credit scoring and risk modeling with guaranteed optimality
  • Validate bin stability on held-out dev sets and cross-validation folds to catch overfitting before production
  • Reduce feature dimensionality by grouping under-represented modalities while preserving target association
  • Audit and override bin boundaries interactively, then persist carvers as JSON for reproducible scoring
  • Use an LLM assistant to qualify columns and propose carving strategies without writing code

io.github.mdefrance/autocarver MCP server FAQ

What is AutoCarver?

AutoCarver is a feature binning library that uses exhaustive search to find optimal, drift-robust bins for numeric, categorical, and ordinal features. It supports binary, multiclass, ordinal, and continuous targets, with built-in robustness checks on dev sets and cross-validation folds.

Is AutoCarver free?

Yes, AutoCarver is open-source and available on PyPI under the license specified in the repository.

How do I use the MCP server with Claude or Cursor?

Install with `pip install "autocarver[mcp]"`, then add the server config to your client's MCP configuration file (`.vscode/mcp.json` for VS Code or `claude_desktop_config.json` for Claude Desktop) pointing to `python -m AutoCarver.mcp`. Your LLM can then qualify and carve columns via tool calls.

Does AutoCarver require authentication?

No, AutoCarver runs fully on your machine. Your dataset is never sent to external services — only your LLM provider sees what the assistant shares.

What makes AutoCarver's binning optimal?

AutoCarver performs exhaustive search over all admissible bin combinations for a fixed min_freq, max_n_mod, and metric (Tschuprow's T by default). It checks every valid combination and returns the one with the highest association score, guaranteeing no better grouping exists under those constraints.

How does AutoCarver prevent overfitting?

Every candidate bin combination is validated on a held-out dev set and optional cross-validation folds at fit time. Any combination whose target rates flip or whose buckets fall below min_freq is rejected immediately, catching overfitting before production.

README (reference)

Source of truth, from the repository.

<!-- mcp-name: io.github.mdefrance/autocarver --> </p> <p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/artwork/auto_carver_logo_dark.svg"> <img alt="AutoCarver Logo" src="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/artwork/auto_carver_logo_light.svg" width="80%"> </picture> </p>

PyPI Python License SPEC 0 Docs Tests Coverage

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/_static/animations/readme_full_pipeline_dark.svg"> <img alt="AutoCarver in one loop: discretize, rank groupings, carve" src="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/_static/animations/readme_full_pipeline_light.svg" width="100%"> </picture> </p>

AutoCarver turns raw numeric, categorical, and ordinal columns into optimal, drift-robust, human-readable bins in a few lines of code. Stop losing model performance to suboptimal manual binning — and stop discovering overfit bins in production monitoring.

  • Provably optimal — exhaustive search: for a fixed min_freq, max_n_mod and metric (Tschuprow's T by default, or Cramér's V), no other admissible bin combination scores higher. It checked them all so you don't have to.
  • Robust by construction — every candidate grouping is vetoed unless it holds on a held-out dev set (and optional CV folds), at fit time rather than in monitoring.
  • Define → carve → model — declare your Features, fit a carver, transform: the whole feature set is carved in one supervised pass, not one notebook per feature. One carver per target type — BinaryCarver, MulticlassCarver, OrdinalCarver, ContinuousCarver (regression) — all with the identical API.
  • AI-assisted — a local MCP server lets your LLM assistant qualify and carve columns through tool calls, fully on your machine.

On the Titanic quick start, Fare collapses from 72 pre-carving modalities to 2 bins while its association with survival rises: Tschuprow's T 0.18 raw → 0.29 carved.

Built for credit scoring, fraud detection, and risk modeling.

🆕 What's New

📊 Cross-validated robustness. fit now accepts a cv argument for extra held-out robustness views on top of (or instead of) a dev set: carver.fit(X, y, cv=5). Accepts an int, any scikit-learn splitter, or explicit index pairs, resolved via sklearn.model_selection.check_cv — folds veto over-fit combinations but never reorder them (ranks stay anchored to the full train set). See Cross-validation folds.

🤖 LLM & MCP integration. AutoCarver now ships a local Model Context Protocol server: point an MCP-aware assistant (VS Code Copilot, Claude Desktop, Cursor, …) at a data file and let it qualify the columns and carve them against your target through tool calls. The server runs fully on your machine — your dataset is never sent to AutoCarver or any external service (only your own LLM provider sees what the assistant shares). Carving quality depends on the LLM, so have a human confirm the feature definitions before production use. See the LLM & MCP guide.

pip install "autocarver[mcp]"

Once configured, just ask your assistant:

Qualify the columns in titanic.csv and carve them against Survived.

The assistant infers feature types, proposes a carving, and returns the summary table — no code written by hand.

<details> <summary>Client config</summary>

Add to .vscode/mcp.json (VS Code / GitHub Copilot) or claude_desktop_config.json (Claude Desktop, under mcpServers instead of servers):

{
  "servers": {
    "autocarver": {
      "command": "python",
      "args": ["-m", "AutoCarver.mcp"]
    }
  }
}

If you use uv, point command at uv instead so it resolves the environment for you:

{
  "servers": {
    "autocarver": {
      "command": "uv",
      "args": ["run", "python", "-m", "AutoCarver.mcp"]
    }
  }
}
</details>

Install

pip install autocarver

Quick Start

Open in Colab

You already have a DataFrame and a target — that's the first box ticked before you start:

  • Load data
  • Split train / dev
  • Declare features by type
  • Fit the carver, validated on the dev set
  • Inspect the carved bins
  • Persist

The rest is the snippet below — binary classification on the Titanic dataset:

<!-- quick-start:start -->
from pathlib import Path

import pandas as pd
from sklearn.model_selection import train_test_split

from AutoCarver import BinaryCarver, Features

# 1. Load data
url = "https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv"
data = pd.read_csv(url)
target = "Survived"

# 2. Train / dev split, stratified on the target
train, dev = train_test_split(data, test_size=0.33, random_state=42, stratify=data[target])

# 3. Declare features by type
features = Features(
    categoricals=["Sex"],
    numericals=["Age", "Fare", "Siblings/Spouses Aboard", "Parents/Children Aboard"],
    ordinals={"Pclass": ["1", "2", "3"]},
)

# 4. Fit the carver (dev set drives the robustness checks)
carver = BinaryCarver(features=features)
train_processed = carver.fit_transform(train, train[target], X_dev=dev, y_dev=dev[target])
dev_processed = carver.transform(dev)

# 5. Inspect the carved buckets, target rate, and association
carver.summary

# 6. Persist for later use
carver.save(Path("titanic_carver.json"))

# 7. Load the carver back in
carver = BinaryCarver.load(Path("titanic_carver.json"))
dev_processed = carver.transform(dev)
<!-- quick-start:end -->

min_freq and max_n_mod are the only two knobs that matter to start with — the defaults (0.02 / 5) reflect common scoring practice, and every behavioral toggle lives in one ProcessingConfig object. Scan, adjust, move on.

For multiclass classification use MulticlassCarver (one binning per feature, against the full K-class target) — or OneVsRestCarver for a separate binning per class; for ordinal targets use OrdinalCarver; for regression use ContinuousCarver — the API is identical. To pre-select features by target association and inter-feature redundancy, pipe the carved output through ClassificationSelector or RegressionSelector with features=carver.features (the carver carves its own copy, so your original features stay raw).

What you get

Two questions worth answering before your next model review: can you defend every bin boundary of your current model to a stakeholder — and can you show each one holds on data it has never seen? AutoCarver makes both a one-liner:

  • No performance left on the table — exhaustive search over admissible bin combinations maximizes Tschuprow's T (default) or Cramér's V: for fixed min_freq, max_n_mod and metric, no other combination scores higher, so you never wonder whether a better grouping existed.

  • Stop silent overfitting before production — bins that only exist in your training sample degrade quietly under drift. Every candidate combination is validated on a dev set (and optional CV folds): any whose target rates flip or whose buckets fall below min_freq is rejected at fit time, not discovered in monitoring.

  • First-class ordinal features — OrdinalDiscretizer enforces your declared modality order, so under-represented levels are merged with their nearest neighbour instead of being collapsed by frequency.

  • You are the final auditor — carver.features.summary and carver.features.history expose the bin definitions, per-bin target rate / frequency, and the full carving trace; disagree with a boundary and you can override it, and transform applies your fix like any carved bin:

    feature = carver.features("Siblings/Spouses Aboard")  # any carved feature; labels are [0, 1, 2]
    feature.group([1], 2)  # merge two bins you consider equivalent
    
  • Interpretable buckets — human-readable boundaries you can audit, document, and ship to a scorecard.

  • Dimensionality reduction — groups under-represented modalities and caps bins per feature (max_n_mod), which is especially useful before one-hot encoding.

  • Feature pre-selection — ClassificationSelector / RegressionSelector rank features by target association and filter on inter-feature correlation.

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/_static/hero_chart_dark.svg"> <img alt="Raw feature vs AutoCarver buckets: frequency and target rate before/after supervised binning" src="https://raw.githubusercontent.com/mdefrance/AutoCarver/main/docs/source/_static/hero_chart_light.svg" width="100%"> </picture> </p>

Titanic Age, one BinaryCarver.fit call: 84 raw values collapse to 3 buckets with a monotonic survival rate.

How does it compare?

Manual binningAutoCarveroptbinningsklearn KBinsDiscretizer
Algorithmeyeballing distributions, notebook by notebookexhaustive search over admissible combinationsCART pre-binning, then CP solver (CP-SAT default; MIP optional)quantile / uniform / k-means — unsupervised
Optimality for given min_freq / max_n_mod / metricnone — first acceptable grouping winsguaranteed — best of every admissible combinationprovably optimal over its pre-bins, under its constraintsn/a — no target objective
Target typesany, at ~1 feature/hourbinary, multiclass, ordinal, continuousbinary, multiclass, continuousn/a
All feature types in one fit (numeric, categorical, ordinal, NaN)each feature is its own projectyes — declared ordinal order enforced, NaN as its own modalityyes via BinningProcess; no first-class ordinal type (user_splits workaround)numeric only; NaN raises
Held-out dev-set robustness checkrarely — too tedious to script per featureyes — dev set + optional k-fold CV, built into fitno (script CV yourself)no
Per-bin stats + carving history after fitscattered notebook cellscarver.summary, carver.historybinning_tableno

All three libraries are sklearn-Pipeline compatible; AutoCarver adds JSON round-trip persistence (carver.save("...json")) and feature pre-selection helpers (ClassificationSelector, RegressionSelector). The full feature matrix, side-by-side runnable snippets, and a "when to pick which" guide live on the comparison page.

Documentation

Full reference, tutorials, and end-to-end notebook examples on ReadTheDocs.

Related MCP servers

Agent-to-agent communication bridge for multi-agent systems

1
JavaScript
View repository →

Multi-agent billing and cost allocation tracking

0
JavaScript
View repository →

Constitutional guardrails and loop detection for AI agents

0
JavaScript
View repository →

Record and replay AI agent execution for debugging

0
JavaScript
View repository →

Security scanning and threat detection for AI agents

0
JavaScript
View repository →

Agent tracing, cost tracking, anomaly detection for LLM agents

0
JavaScript
View repository →