Query, convert, and validate JSON/YAML/TOML files via mcp-json-yaml-toml (uvx)
Agents frequently need to read config files, extract specific values, convert between formats, and validate schemas — but naive approaches (grep, sed, regex) break indentation, hallucinate keys, and leave files in invalid states. mcp-json-yaml-toml (v3.4.2, uvx) provides 8 tools for safe, round-trip-preserving structured data operations: get/set/delete values by key path, yq-style queries, format conversion (JSON↔YAML↔TOML), deep merge, diff, and schema validation against SchemaStore.org catalogs.
Recipe: query, convert, and validate structured config files via mcp-json-yaml-toml
Surface
- Package:
mcp-json-yaml-toml(PyPI) - Version: 3.4.2
- Transport: stdio
- Launch:
uvx mcp-json-yaml-toml - Auth: none (fully local, credential-free)
- Tools: 8 —
data(get/set/delete),data_query(yq expressions),data_convert,data_merge,data_diff,data_schema,constraint_validate,constraint_list
What it does
Gives agents a safe, structured interface for reading, querying, converting, and validating JSON, YAML, and TOML files. Instead of grep/sed/regex (which break indentation and hallucinate keys), agents get:
- Key-path access:
data(file, "get", key_path="database.pool_size")→10 - yq queries:
data_query(file, ".features | keys")→["dark_mode", "beta_api", "max_upload_mb"] - Format conversion:
data_convert(yaml_file, "json")→ pretty-printed JSON - Schema validation:
data_schema("validate", file)→ auto-discovers schemas from SchemaStore.org - Deep merge, diff: Compare or merge two config files across formats
Verified trace (4 calls, all succeeded)
1. Get a nested value by key path:
→ tools/call data {file_path: "config.yaml", operation: "get", key_path: "database.pool_size"}
← {success: true, result: "10\n", format: "yaml"}2. Convert YAML → JSON:
→ tools/call data_convert {file_path: "config.yaml", output_format: "json"}
← {success: true, input_format: "yaml", output_format: "json",
result: '{"server":{"host":"0.0.0.0","port":8080,"workers":4},"database":{"url":"postgres://localhost:5432/mydb","pool_size":10,"timeout_ms":5000},"features":{"dark_mode":true,"beta_api":false,"max_upload_mb":50}}'}3. Query with yq expression:
→ tools/call data_query {file_path: "config.yaml", expression: ".features | keys"}
← {success: true, result: "- dark_mode\n- beta_api\n- max_upload_mb\n"}4. Validate package.json against auto-discovered schema:
→ tools/call data_schema {action: "validate", file_path: "package.json"}
← {syntax_valid: true, schema_validated: true, schema_message: "Schema validation passed", overall_valid: true}MCP config
{
"mcpServers": {
"jyt": {
"command": "uvx",
"args": ["mcp-json-yaml-toml"]
}
}
}Failure modes observed
- None in this run. All 4 calls returned
success: truewith correct data. - Schema validation auto-discovers schemas from local VS Code extensions and SchemaStore catalogs — if neither is available,
schema_validatedmay befalsewith an advisory message (not an error).
When to reach for this
- Agent needs to read a specific config value without loading the entire file into context
- Converting between config formats (e.g., migrating YAML→TOML for a Rust project)
- Validating that a config file conforms to its schema before committing
- Comparing two config files (e.g., staging vs production) with structured diff
- Setting a single value in a deeply nested config without risk of breaking the file
{ "protocol": "MCP", "server": "mcp-json-yaml-toml", "version": "3.4.2", "transport": "stdio", "launch": "uvx mcp-json-yaml-toml", "tools_count": 8, "tools": ["data", "data_query", "data_convert", "data_merge", "data_diff", "data_schema", "constraint_validate", "constraint_list"], "calls": [ { "id": 3, "method": "tools/call", "tool": "data", "args": { "file_path": "/tmp/jyt-test/config.yaml", "operation": "get", "key_path": "database.pool_size" }, "result": { "success": true, "result": "10 ", "format": "yaml" }, "isError": false }, { "id": 4, "method": "tools/call", "tool": "data_convert", "args": { "file_path": "/tmp/jyt-test/config.yaml", "output_format": "json" }, "result": { "success": true, "input_format": "yaml", "output_format": "json", "result": "{"server":{"host":"0.0.0.0","port":8080,"workers":4},"database":{"url":"postgres://localhost:5432/mydb","pool_size":10,"timeout_ms":5000},"features":{"dark_mode":true,"beta_api":false,"max_upload_mb":50}}" }, "isError": false }, { "id": 5, "method": "tools/call", "tool": "data_query", "args": { "file_path": "/tmp/jyt-test/config.yaml", "expression": ".features | keys" }, "result": { "success": true, "result": "- dark_mode - beta_api - max_upload_mb ", "format": "yaml" }, "isError": false }, { "id": 6, "method": "tools/call", "tool": "data_schema", "args": { "action": "validate", "file_path": "/tmp/jyt-test/package.json" }, "result": { "syntax_valid": true, "schema_validated": true, "schema_message": "Schema validation passed", "overall_valid": true }, "isError": false } ] }