Skip to main content
Glama

ectype-mcp

An MCP (Model Context Protocol) server that lets AI agents create and check realistic synthetic tables with the local Ectype engine.

What it is and why

An agent that needs a table usually invents one: it reasons about distributions, writes a NumPy script, runs it and checks nothing. With this server the agent makes one tool call instead:

  • One call. create_table_from_spec takes a short JSON spec and writes the rows (.csv or .parquet) plus a fingerprint (.dfp) for more rows later.

  • Rules hold on every row. Constraints such as date_diff_days(ship_date, order_date) >= 1 are enforced on every generated row, and validation confirms it.

  • The result says how the rows compare with the spec. Each column and correlation is checked, stated against achieved, with a one-line summary and a verdict.

  • Same seed, same file. Same spec (or fingerprint), rows and seed give a byte-identical file.

  • Everything local. No network requests, no port, no cloud. File access is confined to folders you name.

Real tables work too: describe_table and profile_table learn a table's structure and a fingerprint, generate_rows makes look-alike rows, and no cell value of a real table appears in any result.

Measured (cold-start experiment): eight agents that saw only the tool list made 24 data requests. 24 of 24 first calls returned without an error, 19 of 24 first attempts fully met the request, and 23 of 24 were met within five attempts (the one miss asked for hourly timestamps, which the spec cannot express).

Less to write, and checked. A spec and its call are about a third to half the size of the NumPy script an agent would otherwise write: 0.3 to 0.5 times as many characters, roughly 200 tokens against 400 to 600 per table. The result comes back with every column and rule checked, so the agent writes no checking code either.

Related MCP server: Faker MCP Server

Install

Into any Python 3.11 to 3.13 environment:

pip install ectype-mcp
ectype-mcp --version            # ectype-mcp 0.1.0
ectype-mcp --help

This installs the engine, ectype-data, with it.

From a checkout, with uv:

cd ectype-mcp
uv sync
uv run ectype-mcp --version     # ectype-mcp 0.1.0

Add it to an MCP client

The server speaks MCP over stdio. Most clients take a configuration of this shape:

{
  "mcpServers": {
    "ectype": {
      "command": "ectype-mcp",
      "args": ["--root", "/path/to/project"]
    }
  }
}

The exact file and keys depend on your client; check its documentation. If ectype-mcp is not on the client's PATH, give the full path to the executable in your environment (for example .venv/bin/ectype-mcp, or .venv\Scripts\ectype-mcp.exe on Windows). Every file the server reads or writes must be inside a --root folder; repeat --root for more folders.

Tested with Claude Code.

A worked example

A recorded session with ectype-mcp 0.1.0 and ectype-data 0.2.0, over stdio. The calls and results are real; only the folder prefix of the paths is removed.

The request: 50,000 orders placed during 2024 by customers numbered 1 to 5,000. Each order ships one to seven days after it is placed, has at least one item (2.5 on average) at a unit price of about $30, comes 70% from the web and 30% from stores, is returned 3% of the time, and carries a total. Orders with more items have slightly lower unit prices.

The call: create_table_from_spec, with the spec abbreviated:

{
  "output_path": "orders.parquet",
  "rows": 50000,
  "seed": 42,
  "spec": {
    "name": "orders",
    "columns": [
      {"name": "order_id", "type": "identifier", "kind": "int_sequence"},
      {"name": "order_date", "type": "datetime", "start": "2024-01-01", "end": "2024-12-31"},
      {"name": "quantity", "type": "numeric", "dist": "negbinom", "mean": 1.5, "r": 3, "shift": 1},
      "... five more columns ..."
    ],
    "derived": {"total": "round(quantity * unit_price, 2)"},
    "constraints": ["date_diff_days(ship_date, order_date) >= 1",
                    "date_diff_days(ship_date, order_date) <= 7"],
    "correlations": [{"columns": ["quantity", "unit_price"], "rho": -0.3}]
  }
}
{
  "output_path": "orders.parquet",
  "rows": 50000,
  "seed": 42,
  "spec": {
    "name": "orders",
    "columns": [
      {"name": "order_id", "type": "identifier", "kind": "int_sequence"},
      {"name": "customer_id", "type": "numeric", "dist": "uniform", "lo": 0.5, "hi": 5000.5, "decimals": 0, "dtype": "Int64"},
      {"name": "order_date", "type": "datetime", "start": "2024-01-01", "end": "2024-12-31"},
      {"name": "ship_date", "type": "datetime", "start": "2024-01-02", "end": "2025-01-07"},
      {"name": "quantity", "type": "numeric", "dist": "negbinom", "mean": 1.5, "r": 3, "shift": 1},
      {"name": "unit_price", "type": "numeric", "dist": "lognormal", "mu": 3.4, "sigma": 0.6, "decimals": 2},
      {"name": "channel", "type": "categorical", "probs": {"web": 0.7, "store": 0.3}},
      {"name": "returned", "type": "boolean", "p": 0.03}
    ],
    "derived": {"total": "round(quantity * unit_price, 2)"},
    "constraints": ["date_diff_days(ship_date, order_date) >= 1",
                    "date_diff_days(ship_date, order_date) <= 7"],
    "correlations": [{"columns": ["quantity", "unit_price"], "rho": -0.3}]
  }
}

The result, trimmed:

{
  "summary": "Wrote 50,000 rows to orders.parquet and the fingerprint to orders.dfp. All 9 checks match the spec. Validation passed.",
  "spec_status": "matches",
  "validation": {
    "passed": true,
    "structure": "5/5 checks ok",
    "rules": "2/2 hard rules hold on every row",
    "sealed": "40/40 targets passed; 0 failed beyond sampling noise",
    "...": "..."
  },
  "checks": [
    {"item": "quantity", "asked": "negbinom mean 2.5, sd 1.5", "got": "mean 2.49, sd 1.49", "ok": true, "by_rules": false},
    {"item": "unit_price", "asked": "lognormal median 29.96", "got": "median 30.14, mean 35.96", "ok": true, "by_rules": false},
    {"item": "channel", "asked": "web 0.7, store 0.3", "got": "web 0.697, store 0.303", "ok": true, "by_rules": false},
    {"item": "quantity ~ unit_price", "asked": "rank correlation -0.3", "got": "rank correlation -0.285", "ok": true, "by_rules": false},
    "..."
  ]
}

Two follow-up calls. Ten times the rows from the saved fingerprint, then an independent check of the new file:

generate_rows  {"fingerprint_path": "orders.dfp", "output_path": "orders-big.parquet", "rows": 500000, "seed": 1}
  -> "Wrote 500,000 rows to orders-big.parquet. All 9 checks match the spec."
validate_rows  {"fingerprint_path": "orders.dfp", "table_path": "orders-big.parquet"}
  -> passed: true; "2/2 hard rules hold on every row"; "40/40 targets passed; 0 failed beyond sampling noise"

The seven tools

Tool

Does

Writes

create_table_from_spec

spec (no data) -> rows file + fingerprint + checks

yes

profile_table

real table -> fingerprint + description

yes

generate_rows

fingerprint -> rows file

yes

validate_rows

rows (+ optional real holdout) vs fingerprint -> verdict

no

compare_fingerprints

fingerprint vs fingerprint -> drift verdict

no

describe_table

real table -> description

no

inspect_fingerprint

fingerprint -> what it holds

no

Paths are absolute or relative to the first --root. Existing files are never replaced unless you pass overwrite: true. Results are small JSON objects (paths, counts, names, verdicts), never table rows. The examples below are real results, trimmed with ....

create_table_from_spec

The main tool. Arguments: spec (or spec_path, a .json file holding it), output_path, rows (default 1000), seed (default 0), fingerprint_path (default: output_path with .dfp), overwrite (default false).

{
  "output_path": "orders.csv",
  "rows": 2000,
  "seed": 7,
  "spec": {
    "name": "orders",
    "columns": [
      {"name": "order_id", "type": "identifier", "kind": "int_sequence"},
      {"name": "customer_id", "type": "numeric", "dist": "uniform", "lo": 0.5, "hi": 5000.5, "decimals": 0, "dtype": "Int64"},
      {"name": "order_date", "type": "datetime", "start": "2024-01-01", "end": "2024-12-31"},
      {"name": "ship_date", "type": "datetime", "start": "2024-01-02", "end": "2025-01-07"},
      {"name": "quantity", "type": "numeric", "dist": "negbinom", "mean": 1.5, "r": 3, "shift": 1},
      {"name": "unit_price", "type": "numeric", "dist": "lognormal", "mu": 3.4, "sigma": 0.6, "decimals": 2},
      {"name": "channel", "type": "categorical", "probs": {"web": 0.7, "store": 0.3}},
      {"name": "returned", "type": "boolean", "p": 0.03}
    ],
    "derived": {"total": "round(quantity * unit_price, 2)"},
    "constraints": ["date_diff_days(ship_date, order_date) >= 1",
                    "date_diff_days(ship_date, order_date) <= 7"],
    "correlations": [{"columns": ["quantity", "unit_price"], "rho": -0.3}]
  }
}

Result:

{
  "summary": "Wrote 2,000 rows to ...\\orders.csv and the fingerprint to ...\\orders.dfp. All 9 checks match the spec. Validation passed.",
  "spec_status": "matches",
  "output_path": "...\\orders.csv",
  "fingerprint_path": "...\\orders.dfp",
  "rows": 2000,
  "seed": 7,
  "columns": [{"name": "order_id", "dtype": "Int64"}, {"name": "order_date", "dtype": "Date"}, "..."],
  "validation": {
    "passed": true,
    "structure": "5/5 checks ok",
    "rules": "2/2 hard rules hold on every row",
    "sealed": "39/40 targets passed; 0 failed beyond sampling noise",
    "calibration": "41/43 targets passed (optimizer evidence only)",
    "...": "..."
  },
  "checks": [
    {"item": "channel", "asked": "web 0.7, store 0.3", "got": "web 0.702, store 0.298", "ok": true, "by_rules": false},
    {"item": "unit_price", "asked": "lognormal median 29.96", "got": "median 30.3, mean 36.28", "ok": true, "by_rules": false},
    {"item": "ship_date", "asked": "spread evenly 2024-01-02 to 2025-01-07", "got": "2024-01-03 to 2025-01-06, median 2024-07-03", "ok": true, "by_rules": true},
    {"item": "quantity ~ unit_price", "asked": "rank correlation -0.3", "got": "rank correlation -0.318", "ok": true, "by_rules": false},
    "..."
  ],
  "notes": ["98% of the rows drawn broke a rule and were redrawn; the columns still match the spec."]
}

How to read it:

  • summary: one line to act on: what was written, how many checks are off and the first one, and the validation verdict.

  • spec_status: matches (every check passes), differs (a check that no rule explains is off: fix the spec), or rules_shifted (only checks on columns that rules use are off).

  • checks: stated against achieved for each column and correlation, failed ones first. Rules redraw the rows that break them, which can move the columns they use; those checks carry by_rules: true and, when off, suggest a value to state instead. For example, a churn date with missing 0.8 and a rule "churn after signup" came back with "got": "0.872 (to land at 0.8 after the rules, try missing 0.701)".

  • validation: the engine's verdict: structure and dtypes, every rule on every row, and statistics held back from the generator (sealed targets). Validation measures the rows after the rules, so it can pass while a check is off; read spec_status too.

Same spec, rows and seed give the same file. Rows are random draws, so shares land within sampling noise (about 2 to 3 points either way at 1,000 rows), not exactly.

generate_rows

More rows from a saved fingerprint. Arguments: fingerprint_path, output_path, rows, seed, overwrite.

{"fingerprint_path": "orders.dfp", "output_path": "more_orders.parquet", "rows": 20000, "seed": 1}
{
  "summary": "Wrote 20,000 rows to ...\\more_orders.parquet. All 9 checks match the spec.",
  "spec_status": "matches",
  "origin": "authored",
  "rows": 20000,
  "seed": 1,
  "checks": ["..."],
  "notes": ["98% of the rows drawn broke a rule and were redrawn; the columns still match the spec."]
}

For a fingerprint made from a spec the result compares the rows with the spec. For one fitted to real data, spec_status is null and checks is empty; check the rows with validate_rows.

validate_rows

Check a table against a fingerprint. Arguments: fingerprint_path, table_path, optional holdout_path (real rows the fingerprint was not made from), sensitivity (strict | standard | lenient, default standard).

{"fingerprint_path": "orders.dfp", "table_path": "more_orders.parquet"}
{
  "validation": {
    "passed": true,
    "rows": 20000,
    "structure": "5/5 checks ok",
    "rules": "2/2 hard rules hold on every row",
    "sealed": "40/40 targets passed; 0 failed beyond sampling noise",
    "calibration": "43/43 targets passed (optimizer evidence only)",
    "holdout": null,
    "failure_reasons": [],
    "worst_targets": [],
    "notes": []
  },
  "...": "..."
}

describe_table

Describe a real table without returning any of its values. Argument: table_path. On a fabricated customer table with names and e-mail addresses:

{"table_path": "customers_jan.csv"}
{
  "table": {
    "rows": 5000,
    "column_count": 7,
    "columns": [
      {"name": "full_name", "dtype": "String", "type": "categorical", "role": "pseudonym", "nulls": 0.0, "distinct": 160},
      {"name": "email", "dtype": "String", "type": "string", "role": "identifier", "nulls": 0.0, "distinct": 4900},
      "..."
    ],
    "personal_columns": ["full_name", "email"],
    "identifier_columns": ["customer_id", "email"],
    "suggested_rules": ["monthly_spend >= <value> (bound, high)", "seats >= <value> (bound, high)", "customer_id is unique (unique, high)"],
    "...": "..."
  }
}

Literals taken from real data are masked (<value>).

profile_table

Learn a fingerprint from a real table. Arguments: table_path, fingerprint_path (default: table_path with .dfp), constraints, derived, exclude_columns, personal_columns, joint (gaussian_copula, the fast default, or chain_copula, closest to the source and slower), policy (standard or strict), overwrite.

{"table_path": "customers_jan.csv", "fingerprint_path": "customers_jan_chain.dfp", "joint": "chain_copula", "constraints": ["seats >= 1"]}
{
  "fingerprint_path": "...\\customers_jan_chain.dfp",
  "targets": "21 calibration + 15 sealed",
  "table": {"rows": 5000, "personal_columns": ["full_name", "email"], "...": "..."},
  "notes": ["Generate rows with generate_rows; check them with validate_rows."]
}

Rows generated from this fingerprint carry stand-in tokens such as full_name_qvqr_088 for the names and fresh values for the unique keys; in this run none of the 10,000 generated rows repeated a source name or e-mail address.

compare_fingerprints

Drift between two fingerprints, with no data. Arguments: reference_path (the baseline), candidate_path, sensitivity.

{"reference_path": "customers_jan.dfp", "candidate_path": "customers_feb.dfp"}
{
  "drift": {
    "verdict": "drift",
    "targets_drifted": 4,
    "targets_compared": 35,
    "top_columns": ["monthly_spend score=5.95 (4 targets)"],
    "top_pairs": [],
    "schema_changes": [],
    "warnings": ["full_name: pseudonymised (...): category sets not compared; ...", "..."]
  },
  "...": "..."
}

verdict is no_drift, drift or inconclusive.

inspect_fingerprint

What a .dfp holds. Argument: fingerprint_path.

{"fingerprint_path": "orders.dfp"}
{
  "fingerprint": {
    "name": "orders",
    "origin": "authored",
    "policy": "standard",
    "joint_model": "gaussian_copula",
    "engine_version": "0.2.0",
    "format_version": "0.5.0",
    "targets": "43 calibration + 40 sealed",
    "rules": ["user_1: date_diff_days(ship_date, order_date) >= 1", "user_2: date_diff_days(ship_date, order_date) <= 7"],
    "table": {"relationships": ["total = round(quantity * unit_price, 2)"], "...": "..."},
    "spec": {"name": "orders", "columns": ["..."], "...": "..."}
  }
}

For a fingerprint made from a spec, spec is the engine-format spec: edit it and call create_table_from_spec again.

Errors come back as tool errors with one or two sentences: what is wrong, then what to do. For example: Spec error in column 'price': lognormal has no parameter 'mean'; it takes mu, sigma (optional shift). Hint: .... A compact guide for agents is in docs/for-agents.md.

Limits

Cost. The tool list is a fixed cost of about 18,000 characters (roughly 4,500 tokens) on every request while the server is enabled, which pays off over several tables or when the client caches tool definitions.

Flag

Default

Limit

--root DIR

the current directory

folders the server may read and write (repeatable)

--max-rows N

1,000,000

rows per call

--max-cells N

50,000,000

rows x columns per call

--max-input-mb N

256

largest table file read, in MB

--max-fingerprint-mb N

64

largest .dfp file loaded, in MB

--log-level

WARNING

stderr log level (DEBUG, INFO, WARNING, ERROR)

Fixed: a spec of at most 256 KB and 500 columns, and a result of at most 16,000 characters (long lists are cut with a count of what was left out). One heavy job runs at a time; other calls queue.

The only transport is stdio. The server opens no port. Logs go to stderr, never stdout.

Safety model

The agent is not fully trusted (it may follow instructions injected by content it read), the files are the user's, and real tables may hold personal data. In short:

  • Path confinement. Every path is resolved (.., symlinks and junctions followed) and must end up inside a --root folder. NUL bytes, Windows device names, alternate data streams and directories are refused.

  • No silent overwrite. An existing file is refused unless overwrite is true.

  • Atomic writes. Each output is written to a temporary file next to its destination and moved into place at the end; a failed call leaves no partial files.

  • Limits on rows, cells, file sizes, spec size and result size (above).

  • No network, no code execution. No network requests. Expressions go to the engine's closed grammar (no eval); loading a fingerprint never runs code; spec files are parsed as JSON only.

  • No real cell values in results. For real tables, results carry counts, names, dtypes, roles and verdicts; literals from fitted fingerprints are masked; parser errors that could quote cells are replaced by a generic message.

  • Engine privacy defaults kept. The research policy is not offered, and columns the engine pseudonymised cannot be switched back to real values.

Generated rows are a statistical likeness, not a privacy guarantee. Read SECURITY.md for the threat model, the limits of these measures and how to report a vulnerability.

Versions

Thing

Version

MCP specification

2026-07-28, and older revisions back to 2024-11-05 through the SDK's version negotiation

MCP Python SDK

mcp>=2.3,<3 (built against 2.3.0)

Engine

ectype-data>=0.1.0,<0.3 (tested with 0.1.1 and 0.2.0, fingerprint formats 0.4.0 and 0.5.0)

Python

3.11 to 3.13 (the suite runs on 3.11.9, 3.12.2 and 3.13.2)

What it cannot do yet

The spec cannot yet express these; docs/ENGINE-GAPS.md has the detail and the proposed engine additions.

  • A date defined as an interval after another date (today: two date_diff_days rules, which redraw most rows).

  • A repeating key with realistic group sizes (today: a whole-number uniform).

  • A distribution that depends on a category or a flag, other than through lookup times a factor column; no if/when.

  • Hiding helper columns: every spec column is written to the output.

  • Shares that hold exactly after the rules (the checks suggest a value to state instead).

  • Timestamps on a step (hourly readings) and series per entity.

  • Names, e-mail addresses and other free text in a spec.

  • Mixtures, zero-inflated values and exact counts.

  • Several linked tables.

Development

uv sync                       # installs the package and the dev tools
uv run pytest                 # tests
uv run ruff check .           # lint
uv run mypy                   # type check (strict)

scripts/call_tool.py drives the server over stdio the way a client does. .scratch/ is ignored by git; make a folder there and use it as the root:

uv run python scripts/call_tool.py --root .scratch/try --list --out .scratch/try/tools.json
uv run python scripts/call_tool.py --root .scratch/try create_table_from_spec .scratch/try/args.json

args.json holds the tool's arguments as one JSON object, for example the create_table_from_spec arguments above.

License

Licensed under Apache-2.0. Copyright 2026 ZeroPoint Holdings LLC.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Generate realistic multi-table synthetic datasets from plain English. Supports 18 industry domains, narrative growth curves (Black Friday, Q4 spike, 10x MRR), and 15 locale packs. Works with Claude Desktop, Cursor, Windsurf, Zed, and Continue.
      15
      80
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables language models to run data-quality checks and profiling on local files, using dbt-style assertions like not_null, unique, relationships, and accepted_values.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to ingest CSV/TSV files, profile and categorize tables, generate SQL DDL for multiple engines, and launch background data workflows whose completion and artifacts can be independently verified.
      MIT