Convert between TOML and JSON via @mukundakatta/toml-mcp
How do I parse TOML configuration into JSON and convert JSON objects back to TOML using an MCP server? Need support for nested tables, array-of-tables, inline tables, multiline strings, dates, comments, and Unicode values. Must handle round-trips faithfully.
@mukundakatta/toml-mcp v0.1.0 — TOML ↔ JSON bidirectional conversion
Install & run: npm install @mukundakatta/toml-mcp → entry point dist/server.js, stdio transport.
Tools (2)
| Tool | Params | Returns |
|---|---|---|
to_json | {text: string} | {value: {...}} JSON wrapper |
to_toml | {value: object} | Raw TOML text string |
Verified trace — 12 calls, 100% success, p50=1ms
to_json — simple config:
{"name":"to_json","arguments":{"text":"[server]\nhost = \"localhost\"\nport = 8080\n\n[database]\nname = \"mydb\"\nmax_connections = 10\nenabled = true"}}
→ {"value":{"server":{"host":"localhost","port":8080},"database":{"name":"mydb","max_connections":10,"enabled":true}}}to_json — nested tables + array of tables:
{"name":"to_json","arguments":{"text":"title = \"Config\"\n\n[owner]\nname = \"Emin\"\n\n[[fruits]]\nname = \"apple\"\ncolor = \"red\"\n\n[[fruits]]\nname = \"banana\"\ncolor = \"yellow\"\n\n[database]\nports = [5432, 5433, 5434]\nconnection_max = 5000"}}
→ {"value":{"title":"Config","owner":{"name":"Emin"},"fruits":[{"name":"apple","color":"red"},{"name":"banana","color":"yellow"}],"database":{"ports":[5432,5433,5434],"connection_max":5000}}}to_json — inline table + multiline string + date:
{"name":"to_json","arguments":{"text":"name = \"TOML Test\"\npoint = { x = 1, y = 2 }\nmultiline = \"\"\"\nline 1\nline 2\nline 3\"\"\"\ncreated = 2026-06-20T10:30:00Z"}}
→ {"value":{"name":"TOML Test","point":{"x":1,"y":2},"multiline":"line 1\nline 2\nline 3","created":"2026-06-20T10:30:00.000Z"}}to_json — comments (stripped):
{"name":"to_json","arguments":{"text":"# This is a comment\nkey = \"value\" # inline comment\n\n[section]\n# Another comment\nnum = 42"}}
→ {"value":{"key":"value","section":{"num":42}}}to_json — Unicode:
{"name":"to_json","arguments":{"text":"greeting = \"Merhaba dünya 🌍\"\nauthor = \"Müslüm Gürses\""}}
→ {"value":{"greeting":"Merhaba dünya 🌍","author":"Müslüm Gürses"}}to_json — empty string: → {"value":{}} (no error)
to_json — invalid TOML: → isError: true, "toml failed: Invalid TOML document: incomplete key-value..." with line/column pointer
to_toml — simple object:
{"name":"to_toml","arguments":{"value":{"server":{"host":"localhost","port":8080},"database":{"name":"mydb","enabled":true}}}}
→ "[server]\nhost = \"localhost\"\nport = 8080\n\n[database]\nname = \"mydb\"\nenabled = true\n"to_toml — array of tables:
{"name":"to_toml","arguments":{"value":{"title":"Config","fruits":[{"name":"apple","color":"red"},{"name":"banana","color":"yellow"}]}}}
→ "title = \"Config\"\n\n[[fruits]]\nname = \"apple\"\ncolor = \"red\"\n\n[[fruits]]\nname = \"banana\"\ncolor = \"yellow\"\n"to_toml — deep nesting: {a:{b:{c:{d:"deep"}}}} → [a.b.c]\nd = "deep" (dotted keys)
to_toml — special values: null silently dropped; floats, negatives, empty strings preserved
Round-trip verified: to_toml({app:{name:"tani",version:"1.0"},features:["registry","exchange","governance"]}) → TOML → to_json back → identical structure
Key gotchas
- ⚠️ `to_json` param is `text` NOT `toml` — using
tomlcauses"Cannot read properties of undefined (reading '0')"cryptic error - `to_json` wraps result in `{value: ...}` — the parsed object is one level deeper than expected
- `to_toml` returns raw TOML text — NOT JSON; read
content[0].textdirectly, don't JSON.parse it - `null` values silently dropped in
to_tomloutput (omitted, no error) - Dates converted to ISO 8601 strings with
.000Zsuffix - Comments stripped during parse (expected TOML spec behavior)
- Deep nesting uses dotted keys (
[a.b.c]not[a]\n[a.b]\n[a.b.c]) - Empty object → just a newline character
- Invalid TOML → clear error with line number and caret pointer
- Unicode fully safe — Turkish chars, emoji preser
{ "server": "@mukundakatta/toml-mcp", "version": "0.1.0", "transport": "stdio", "entry": "dist/server.js", "tools": ["to_json", "to_toml"], "calls": 12, "success_rate": "100%", "p50_ms": 1, "tested_features": ["simple_config", "nested_tables", "array_of_tables", "inline_tables", "multiline_strings", "dates", "comments", "unicode", "empty_input", "invalid_input", "round_trip", "special_values", "deep_nesting"] }