MCP Examples¶
These examples show the intended safe shape of MCP workflows. Tool responses return summaries, paths, row counts, validation status, and manifest context, not source rows or generated rows.
Local CSV Folder To Synthetic Dataset¶
- Start the generator server with a narrow workspace root:
TEST_DATA_AGENT_WORKSPACE_ROOT=/path/to/workspace \
python3 -m test_data_agent.mcp_generator_server
- Ask the MCP client to call
profile_csvfor individual CSV files, or use local CLI folder profiling when starting from a folder. - Call
infer_dataset_specwith a safeprofile_pathor safe inlineprofile_payload. - Review the written
DatasetSpec. - Optionally provide reviewed business rules through one
business_rules_pathor structuredbusiness_rules_payload. - Call
generate_datasetwith an explicit seed and output folder. - Call
validate_datasetfor the generated bundle.
Expected final report:
rows: customers=25, orders=25
seed: 12345
validation: passed
synthetic: true
source rows copied: false
For a rule-driven run, the response also includes a compact
business_validation object and business_validation_report_path. The
manifest stores the same summary and the SHA-256 fingerprint of the normalized
rule contract.
Example inline payload:
{
"field_rules": [
{
"table": "customers",
"field": "status",
"required": true,
"allowed_values": ["active", "paused"]
}
]
}
Inline and file inputs are size-bounded. Unknown keys, missing entities or fields, unsupported formula syntax, and concrete PII or secret values are rejected before an output folder is created.
Trino Profile To Synthetic Output¶
- Start the Trino MCP server with allowlisted catalogs and schemas:
TRINO_ALLOWED_CATALOGS=hive,iceberg \
TRINO_ALLOWED_SCHEMAS=dev,test,staging \
TRINO_QUERY_MAX_EXECUTION_TIME=30s \
TRINO_QUERY_MAX_RUN_TIME=45s \
TRINO_QUERY_MAX_SCAN_PHYSICAL_BYTES=1GB \
python3 -m test_data_agent.mcp_trino_server
- Use metadata and profiling tools such as
describe_table,profile_table_safe,profile_column, and rule-profiling tools. - Pass the
profile_table_saferesponse to the generator MCP server'splan_trino_datasettool with a new workspace, count, seed, and output format. - Review
dataset_spec.yamlin that workspace. - Call
approve_dataset_planto generate and validate fresh synthetic data.
The Trino server must remain read-only and bounded. Unsafe SQL, DDL, DML,
unrestricted SELECT *, joins, CTEs, subqueries, and likely PII aliases are
rejected before execution.
Both allowlists are mandatory unless TRINO_ALLOW_UNRESTRICTED=true is set
explicitly. HTTPS is the default; plain HTTP additionally requires
TRINO_ALLOW_INSECURE_HTTP=true and is intended only for isolated local use.
The TRINO_QUERY_MAX_* values are sent as Trino session properties so a query
is terminated by the server when it exceeds its time or scan budget.
The generic run_safe_select tool is excluded from the default MCP surface.
Set TRINO_ENABLE_SAFE_SELECT=true only for a trusted client that needs it;
the planning workflow does not use raw SQL.
Guardrails For AI Clients¶
- Never request production rows for export.
- Never ask MCP tools to return raw PII or generated datasets inline.
- Always use explicit seeds.
- Always review the
DatasetSpecbefore generation for new data domains. - Always review structured business rules; do not place production values, identifiers, PII, credentials, or tokens in rule literals.
- Always inspect
generation_manifest.jsonandvalidation_report.jsonbefore reporting success.