MCP server for CSV/JSON data transformation using YAML rules
io.github.vinhphatfsg/rulemorph-mcp Model Context Protocol (MCP) Server
The io.github.vinhphatfsg/rulemorph-mcp server is an MCP server for transforming CSV/JSON data using YAML rules. It is positioned around declarative transformations and is associated with tooling and workflows for data pipelines, including ETL-style processing.
🛠️ Key Features
Transforms CSV/JSON data
Uses YAML rules for transformation logic
Supports declarative, rule-based workflows
🚀 Use Cases
CSV/JSON data transformation tasks
ETL and data pipeline style workflows
Declarative rule-driven conversions
⚡ Developer Benefits
Fits into MCP-based integrations
Aligns with YAML-driven configuration for transformation rules
Useful for data-pipeline and code-generation-adjacent workflows
⚠️ Limitations
No details provided about supported formats beyond CSV/JSON, tooling behavior, or configuration constraints
Rulemorph transforms data from external APIs, CSV, JSON, YAML, TOML, XML, HTML, Markdown, and Excel into predictable JSON using declarative YAML/JSON rules.
Instead of adding another custom script for every input source, you can keep transformation behavior in rule files. The same rules can be reused from the CLI, embedded in Rust, served through a local UI/API server, or exposed to AI assistants through MCP.
Rulemorph moves growing transformation code into reviewable, versioned rules.
Normalize vendor API responses into your internal schema
Bring CSV / Excel imports into a JSON pipeline
Extract values from HTML or XML and process them with the same rule model
Review, replace, and version transformation behavior as YAML/JSON
Reuse the same transformation from the CLI, a local API, or an AI assistant
It is not meant to replace application code for arbitrary execution, complex domain logic, or long-running workflow orchestration. For those cases, normal application code or a workflow engine is usually a better fit.
Quick Start
Transform a users array from an external API response into the JSON shape your application expects.
Direct mode can also read CSV or Excel files. CSV headers are inferred from .csv
files; use -H/--headers for headerless CSV. For Excel, select the header row
and data range explicitly:
rulemorph-mcp exposes Rulemorph capabilities to AI assistants through the Model Context Protocol.
transform: transform data
validate_rules: validate rules
generate_dto: generate DTOs
analyze_input: summarize input structure
Claude Code setup:
sh
claude mcp add rulemorph -- rulemorph-mcp
Key Features
Normalize CSV / JSON / YAML / TOML / XML / HTML / Markdown / .xlsx Excel into JSON records
Build output fields with mappings
Transform values with v2 pipe expressions: trim, case conversion, concatenation, numeric operations, lookups, and array operations
Define rule-local custom OPs with defs to reuse typed v2 pipes or mapping bodies
Use numeric helpers such as sqrt, mod, pow, clamp, and range for bounded generated sequences
Control behavior with record_when, when, and asserts
Use steps, branch, and finalize for ordered execution and output-array processing
Generate inferred DTOs for Rust, TypeScript, Python, Go, Java, Kotlin, and Swift. Explicit type wins; dynamic or unsafe shapes fall back to JSON-friendly types.
Inspect semantic traces for built-in and custom OP execution without changing transform output
Run a local UI/API server or expose the same engine through MCP
Input parsers are designed to be conservative. HTML parsing does not execute JavaScript or fetch URLs, Markdown raw HTML is preserved only as source text, and Excel parsing does not execute macros or evaluate formulas. XML DTD/entities and JSON/YAML duplicate keys are rejected to avoid ambiguous or side-effectful input behavior.
Rule Structure
yaml
version:2input:format:json# csv | json | yaml | toml | xml | html | markdown | exceljson:records_path:"items"mappings:-target:"output.field"source:"input.field"type:stringwhen:eq: ["@input.status", "active"]
New rule files should use version: 2. version: 1 rule files are still accepted during migration, but validation and runtime entry points emit a deprecation warning. A later release will move version: 1 rule files behind an explicit legacy opt-in before removing that syntax.
Supported languages: rust, typescript, python, go, java, kotlin, swift
DTO generation uses explicit mapping types first, then infers simple scalar, array, map, and nested object shapes from literals and v2 pipe expressions. If a shape is dynamic or too broad to infer safely, the generated DTO uses each language's JSON fallback type.
Library Usage
toml
[dependencies]rulemorph = "0.3.4"
The html, excel, and markdown input parsers are enabled by default. Library users that only need
core CSV, JSON, YAML, TOML, and XML support can disable them to reduce optional parser dependencies:
toml
[dependencies]rulemorph = { version = "0.3.4", default-features = false }
Re-enable parsers explicitly with features such as ["html"], ["excel"], or ["markdown"].
If a disabled parser is selected by a rule, transformation fails with invalid_input (for Markdown: input format markdown is not enabled in this build).