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_spectakes a short JSON spec and writes the rows (.csvor.parquet) plus a fingerprint (.dfp) for more rows later. - Rules hold on every row. Constraints such as
date_diff_days(ship_date, order_date) >= 1are 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.
Install
Into any Python 3.11 to 3.13 environment:
pip install ectype-mcp
ectype-mcp --version # ectype-mcp 0.1.1
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.1
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}]
}
}
The full arguments
{
"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), orrules_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 carryby_rules: trueand, when off, suggest a value to state instead. For example, a churn date withmissing 0.8and 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; readspec_statustoo.
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--rootfolder. NUL bytes, Windows device names, alternate data streams and directories are refused. - No silent overwrite. An existing file is refused unless
overwriteis 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
researchpolicy 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.4 (tested with 0.1.1, 0.2.0 and 0.3.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_daysrules, 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
lookuptimes a factor column; noif/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.
Metadata
Release files for ectype-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ectype_mcp-0.1.1.tar.gz | 224.3 kB | With provenance | Details for ectype_mcp-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ectype_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ectype_mcp-0.1.1-py3-none-any.whl |
Total release size: 290.6 kB
Release files / ectype_mcp-0.1.1.tar.gz
| Download URL | ectype_mcp-0.1.1.tar.gz |
|---|---|
| Size | 224.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fa66db532477861e37fe5d2c4b5a2cbec2f83fce4410a9da4d7e01b19c77d87
|
|
BLAKE2b-256 checksum How to use checksums |
eaa8d4197c9a5beb0bf8d7476ac6970fba976fe91f6bb93a404667801dc7676f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / ectype_mcp-0.1.1-py3-none-any.whl
| Download URL | ectype_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 66.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a18759693d434043dfa5ff9c42e6905cb6dc0ce16988d13674e98b6e9013567
|
|
BLAKE2b-256 checksum How to use checksums |
cf1f0c8381d23ab2287e4a02bd30c7a5656cde4d0aaf6604c852cfe9923afa53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for ectype-mcp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ectype_mcp-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.