data-transformer
Provides safe, deterministic inspection, transformation, validation, and diffing of structured data (JSON, CSV, YAML, Parquet) via schema-aware MCP tools.
README
BatchTicket
BatchTicket (CLI: adt) is a deterministic structured-data transducer for Agent workflows. Like the small ticket that travels with a production or shipping batch, each run carries a versioned plan and an explicit account of what execution changed. That account does not claim the mapping was semantically correct.
It is not another jq or SQL dialect. DuckDB, JSON Schema, PyYAML, and standard parsers own established execution work. This project owns the Agent contract around them.
Version 0.2.0 is an unreleased source release candidate. The project is licensed under the
Apache License 2.0. The stable technical identifiers remain
agent-data-transformer, data-transformer, adt, and the four data_* MCP tools.
What is implemented
- Inspect JSON, JSONL, CSV, TSV, YAML, and Parquet without returning full payloads.
- Discover bounded nested record sets in JSON/YAML envelopes and profile their logical fields.
- Compare a source record shape with a target JSON Schema, surface only structural mapping candidates, and emit an executable draft plan only after explicit compatible mappings.
- Safe Transformation Plan v1 with no raw code, SQL, shell, jq, regex, or template execution.
- Filter, project, drop, rename, sort, limit, deduplicate, cast, derive, explode, join, group, pivot, unpivot, flatten, unflatten, and tree mutation.
- JSON Schema plus non-null, unique, row-count, field, and type assertions.
- Schema-aware keyed or unkeyed diff.
- Dry-run with real destination preflight, staged atomic publication, and overwrite protection.
- Whole-call worker isolation with cumulative source/byte/row/item/depth/time/RSS/temp limits.
- A byte ceiling over the complete serialized response, including samples, shapes, execution effects, diffs, validation failures, and errors.
- One strict typed Plan v1 model generates runtime validation, the published JSON Schema, and the live MCP schema.
- One shared core with CLI and four task-level MCP tools.
Install and run
Development checkout:
git clone https://github.com/tetracoralla/BatchTicket.git
cd BatchTicket
uv sync --frozen --extra dev
uv run adt inspect examples/users.json --select 'data.users[*]'
uv run adt inspect examples/users.json --select 'data.users[*]' \
--target-schema target.schema.json --mappings mappings.json
uv run adt transform examples/adults.plan.yaml
uv run adt transform examples/adults.plan.yaml --dry-run
uv run adt validate examples/users.json --select 'data.users[*]' \
--assertions examples/users.assertions.json
ADT_WORKSPACE_ROOT=/absolute/granted/workspace uv run adt mcp
Build a platform-specific plugin that does not need the repository, uv, a Python
installation, or a network connection at runtime:
uv run python scripts/build_plugin.py
uv run python scripts/probe_plugin.py \
dist/plugin/data-transformer-0.2.0-darwin-arm64
codex plugin marketplace add dist/plugin
codex plugin add data-transformer@data-transformer-local
The build produces a plugin directory, a .tar.gz archive, and a SHA-256 checksum in
dist/plugin/. Install or copy the complete generated directory; the repository-root
.mcp.json is development configuration, while the generated plugin's .mcp.json invokes
its bundled executable directly. The generated local marketplace points Codex at that
self-contained directory. Rebuilding with --replace refuses symlinked output roots or
generated targets before deleting or overwriting anything.
The generated self-contained bundle is currently a local validation artifact, not a public release asset. It incorporates a Python runtime, Python packages, and native libraries whose third-party license materials are not yet assembled into the archive. Do not upload the plugin directory, archive, or checksum to a GitHub Release. This does not restrict publishing or using the Apache-2.0 source repository; see the release checklist.
The example transformation returns two records inline and reports through execution_effects that one input row was removed. File output is opt-in through output.path; existing files are never replaced unless output.overwrite is explicitly true.
CLI paths are explicit user paths and may be absolute. MCP file paths are a narrower
capability: the server first uses workspaces granted through the MCP roots protocol. A
single root is selected automatically; when several roots are granted, pass their exact
root name in the tool's optional workspace field. Hosts without roots support may pass
an explicit ADT_WORKSPACE_ROOT as a compatibility grant. Tool paths remain relative to
the selected root, and absolute, parent, URI, and symlink escapes are rejected. Inline-only
MCP calls do not require a workspace grant.
Codex CLI 0.148 does not currently pass MCP roots to local plugin servers. For a cold CLI
host test, launch Codex with ADT_WORKSPACE_ROOT set to the exact test workspace. Read-only
tools can run under approval=never; data_transform has conditional file-output
capability and therefore requires an approval-capable host policy even when a particular
call returns data inline. A blocked call is an authorization result, not permission to
fall back to shell or model-side data rewriting.
Deterministic schema adaptation
data_inspect accepts an optional target_schema and mappings object. It can select a
unique nested record set by structural evidence, suggest exact or normalized-name matches,
and report incompatible, missing, duplicated, omitted, or dropped fields. It does not use
fuzzy synonyms, casts, or defaults. The v1 adapter maps top-level record fields and supports
an object schema or an array whose items is one object schema. Composed/reference schemas
and ambiguous record sets remain explicitly unresolved.
When every required field has an explicit compatible mapping,
adaptation.status is ready and adaptation.draft_plan is a normal Transformation Plan
v1. Run that plan through data_transform; the adapter does not create a separate execution
path or fifth public tool.
Library API
from data_transformer import DataTransformer
result = DataTransformer().transform(
{
"version": "1",
"sources": {"rows": {"inline": [{"x": 2}, {"x": 4}]}},
"steps": [
{
"op": "derive",
"field": "doubled",
"expr": {"multiply": [{"field": "x"}, {"value": 2}]},
}
],
}
)
Public calls return status: ok, status: dry_run, or status: error with a stable error.code. Successful transformations expose runtime-observed changes under execution_effects; they do not leak stack traces or DuckDB internals.
See the product model, Transformation Plan v1, and the review contract. Contributions are described in CONTRIBUTING.md, security reports in SECURITY.md, and notable changes in CHANGELOG.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。