
AI Tools
v0.1.5
active
transform-rules-mcp
io.github.vinhphatfsg/transform-rules-mcp
MCP server for CSV/JSON data transformation using YAML rules
Documentation
Transform Rules
A Rust CLI and library to transform CSV/JSON data into JSON using YAML rules.
Features
- Input formats: CSV and JSON with nested record extraction
- Rule-based mapping: Declarative YAML rules with static validation
- Expressions: String ops (concat, replace, trim), numeric ops (+, -, *, /), date formatting
- Lookups: Array lookups from external context data (lookup, lookup_first)
- Conditions: Conditional mapping with comparisons, regex, and logical ops
- DTO generation: Generate type definitions for Rust, TypeScript, Python, Go, Java, Kotlin, Swift
- MCP server: Available as a Model Context Protocol server for AI assistants
Installation
Homebrew (recommended)
brew install vinhphatfsg/tap/transform-rules
Other platforms
Download prebuilt binaries from GitHub Releases:
- macOS (Apple Silicon):
transform-rules-<TAG>-aarch64-apple-darwin.tar.gz - macOS (Intel):
transform-rules-<TAG>-x86_64-apple-darwin.tar.gz - Linux (x86_64):
transform-rules-<TAG>-x86_64-unknown-linux-gnu.tar.gz - Windows (x86_64):
transform-rules-<TAG>-x86_64-pc-windows-msvc.zip
Quick Start
Transform user data from an external API response to your schema:
rules.yaml
version: 1
input:
format: json
json:
records_path: "users"
mappings:
- target: "id"
source: "user_id"
- target: "name"
source: "full_name"
- target: "email"
expr:
op: "concat"
args:
- { ref: "input.username" }
- "@example.com"
input.json
{ "users": [{ "user_id": 1, "full_name": "Alice", "username": "alice" }] }
Run
transform-rules transform -r rules.yaml -i input.json
Output
[{ "id": 1, "name": "Alice", "email": "alice@example.com" }]
Rule Structure
version: 1
input:
format: json|csv
json:
records_path: "path.to.array" # Optional
mappings:
- target: "output.field"
source: "input.field" # OR value: <literal> OR expr: <expression>
type: string|int|float|bool
when: <expression> # Optional condition
For full rule specification, see docs/rules_spec_en.md (English) or docs/rules_spec_ja.md (Japanese).
DTO Generation
Generate type definitions from your rules:
transform-rules generate -r rules.yaml -l typescript
Output:
export interface Record {
id: number;
name: string;
email: string;
}
Supported languages: rust, typescript, python, go, java, kotlin, swift
Library Usage (Rust)
use transform_rules::{parse_rule_file, transform};
let rule = parse_rule_file(&std::fs::read_to_string("rules.yaml")?)?;
let output = transform(&rule, &std::fs::read_to_string("input.json")?, None)?;
MCP Server
An MCP server (transform-rules-mcp) is included for AI assistant integration:
claude mcp add transform-rules -- transform-rules-mcp
MCPB
https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-aarch64-apple-darwin.mcpbInstall Command
# mcpb: https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-aarch64-apple-darwin.mcpbMCPB
https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-apple-darwin.mcpbInstall Command
# mcpb: https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-apple-darwin.mcpbMCPB
https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-unknown-linux-gnu.mcpbInstall Command
# mcpb: https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-unknown-linux-gnu.mcpbMCPB
https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-pc-windows-msvc.mcpbInstall Command
# mcpb: https://github.com/vinhphatfsg/transform-rules-rs/releases/download/v0.1.5/transform-rules-mcp-v0.1.5-x86_64-pc-windows-msvc.mcpb