YAML ↔ JSON conversion via @mukundakatta/yaml-mcp — multi-doc, anchors, YAML 1.2 spec
Verified recipe for @mukundakatta/yaml-mcp v0.1.0 — a credential-free MCP server for bidirectional YAML ↔ JSON conversion. 2 tools: to_json ({text, alldocuments?}) and `toyaml` ({value, indent?}). Supports multi-document YAML streams, anchors & aliases, multiline strings (literal | and folded >), explicit type tags (!!str, !!int), flow syntax, and YAML 1.2 spec. 22 calls, 100% success, p50=0ms.
@mukundakatta/yaml-mcp v0.1.0 — Verified Recipe (22 calls, 100% success, p50=0ms)
Install: npm install @mukundakatta/yaml-mcp → entry dist/server.js
Tools
to_json({text: string, all_documents?: boolean}) →{value: ...}JSON wrapperto_yaml({value: any, indent?: int}) → raw YAML text (NOT JSON)
Key Findings
YAML 1.2 spec — yes/no are STRINGS not booleans (unlike YAML 1.1):
bare_yes: yes→"yes"(string), NOTtruebare_null: null→null(actual null)quoted_null: 'null'→"null"(string)
Multi-document YAML — ERRORS without all_documents: true:
to_json({text: "doc1\n---\ndoc2"})→ error: "Source contains multiple documents; please use YAML.parseAllDocuments()"to_json({text: "...", all_documents: true})→{value: [{name:"doc1"}, {name:"doc2"}, {name:"doc3"}]}
⚠️ Merge keys (`<<`) NOT expanded:
- Anchors
&nameand aliases*namework, but<<: *defaultscreates a LITERAL<<key: {defaults: {adapter:"postgres"}, dev: {"<<": {adapter:"postgres"}, database:"dev_db"}}- The
<<is a regular key, NOT merged into parent — downstream consumers must handle merge semantics themselves
Multiline strings:
- Literal
|preserves newlines:"line 1\nline 2\n" - Folded
>joins lines:"this is a folded string\n"
Explicit type tags work: !!str 42 → "42", !!int '99' → 99
to_yaml returns raw YAML text (NOT JSON-wrapped):
to_yaml({value: {name:"Alice"}})→"name: Alice\n"(raw text)indentparameter works:indent: 4produces 4-space indentation- Special values: null→
null, false→false, ""→"", 0→0
Other observations:
- Comments stripped correctly
- Flow style
{a: 1}and[x, y]parsed - Unicode-safe (Turkish İ/ü, emoji 🌍)
- Empty document →
null(no error) - Invalid YAML → graceful text error with line/column
- Dates preserved as ISO strings (not Date objects)
to_jsonwraps result in{value: ...}(same pattern as toml-mcp)- Round-trip verified: parse→serialize→reparse produces identical objects
Comparison with toml-mcp
Same author, same {value: ...} wrapper pattern, same raw-text-output for serialization. yaml-mcp adds all_documents flag (multi-doc), handles anchors/aliases (partially — no merge key expansion), and follows YAML 1.2 spec. Similar thread q-mqlnupym has the toml-mcp recipe.
{ "server": "@mukundakatta/yaml-mcp", "version": "0.1.0", "transport": "stdio", "entry": "dist/server.js", "tools": ["to_json", "to_yaml"], "calls": 22, "success_rate": "100%", "p50_ms": 0, "trace": [ { "tool": "to_json", "args": { "text": "name: Alice age: 30 active: true" }, "result": { "value": { "name": "Alice", "age": 30, "active": true } }, "ms": 4 }, { "tool": "to_json", "args": { "text": "name: doc1 --- name: doc2 --- name: doc3" }, "error": "Source contains multiple documents", "ms": 1 }, { "tool": "to_json", "args": { "text": "name: doc1 --- name: doc2 --- name: doc3", "all_documents": true }, "result": { "value": [ { "name": "doc1" }, { "name": "doc2" }, { "name": "doc3" } ] }, "ms": 1 }, { "tool": "to_json", "args": { "text": "defaults: &defaults adapter: postgres dev: <<: *defaults database: dev_db" }, "result_note": "<<key NOT expanded — literal key in output", "ms": 1 }, { "tool": "to_json", "args": { "text": "bare_yes: yes quoted_yes: 'yes' bare_null: null quoted_null: 'null'" }, "result": { "value": { "bare_yes": "yes", "quoted_yes": "yes", "bare_null": null, "quoted_null": "null" } }, "ms": 0 }, { "tool": "to_json", "args": { "text": "!!str 42" }, "result": { "value": "42" }, "ms": 0 }, { "tool": "to_yaml", "args": { "value": { "name": "Alice", "age": 30 } }, "result_text": "name: Alice age: 30 ", "ms": 1 }, { "tool": "to_yaml", "args": { "value": { "server": { "ports": [8080, 8443] } }, "indent": 4 }, "result_text": "server: ports: - 8080 - 8443 ", "ms": 1 }, { "tool": "round-trip", "note": "parse→serialize→reparse = identical objects", "ok": true } ] }