{"id":43244018,"url":"https://github.com/bitflight-devops/mcp-json-yaml-toml","last_synced_at":"2026-02-26T21:07:04.942Z","repository":{"id":329822503,"uuid":"1097924863","full_name":"bitflight-devops/mcp-json-yaml-toml","owner":"bitflight-devops","description":"A structured data reader and writer like 'jq' and 'yq' for AI Agents","archived":false,"fork":false,"pushed_at":"2026-02-22T02:25:06.000Z","size":1273,"stargazers_count":6,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-22T09:27:42.095Z","etag":null,"topics":["agentic-workflows","ai-agents","config-management","gemini","jq","json","llm-tools","mcp","mcp-server","model-context-protocol","n8n","openai","schema-validation","stdio-mcp","toml","yaml","yq"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitflight-devops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-11-17T03:05:23.000Z","updated_at":"2026-02-22T01:45:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bitflight-devops/mcp-json-yaml-toml","commit_stats":null,"previous_names":["bitflight-devops/mcp-json-yaml-toml"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/bitflight-devops/mcp-json-yaml-toml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fmcp-json-yaml-toml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fmcp-json-yaml-toml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fmcp-json-yaml-toml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fmcp-json-yaml-toml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitflight-devops","download_url":"https://codeload.github.com/bitflight-devops/mcp-json-yaml-toml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitflight-devops%2Fmcp-json-yaml-toml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29872681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T21:05:00.265Z","status":"ssl_error","status_checked_at":"2026-02-26T20:57:13.669Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-workflows","ai-agents","config-management","gemini","jq","json","llm-tools","mcp","mcp-server","model-context-protocol","n8n","openai","schema-validation","stdio-mcp","toml","yaml","yq"],"created_at":"2026-02-01T12:01:17.738Z","updated_at":"2026-02-26T21:07:04.933Z","avatar_url":"https://github.com/bitflight-devops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/logo.png\" alt=\"JYT Logo\" width=\"600\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003emcp-json-yaml-toml\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eA token-efficient, schema-aware MCP server for safely reading and modifying JSON, YAML, and TOML files\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e •\n  \u003ca href=\"#claude-code-cli\"\u003eCLI Usage\u003c/a\u003e •\n  \u003ca href=\"#available-tools\"\u003eAvailable Tools\u003c/a\u003e •\n  \u003ca href=\"#development\"\u003eDevelopment\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/bitflight-devops/mcp-json-yaml-toml/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/bitflight-devops/mcp-json-yaml-toml/actions/workflows/test.yml/badge.svg\" alt=\"Test\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/bitflight-devops/mcp-json-yaml-toml/actions/workflows/auto-publish.yml\"\u003e\u003cimg src=\"https://github.com/bitflight-devops/mcp-json-yaml-toml/actions/workflows/auto-publish.yml/badge.svg\" alt=\"Publish\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/py/mcp-json-yaml-toml\"\u003e\u003cimg src=\"https://badge.fury.io/py/mcp-json-yaml-toml.svg\" alt=\"PyPI version\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nStop AI coding tools from breaking your data files. No more grep guesswork, hallucinated fields, or non-schema-compliant data added to files. This MCP server gives AI assistants a strict, round-trip safe interface for working with structured data.\n\n## The Problem\n\nAI coding tools often destroy structured data files:\n\n- They **grep** through huge json, yaml, and toml files (like json logs, or AI transcript files) and guess at keys.\n- They **hallucinate** fields that never existed.\n- They use **sed and regex** that leave files in invalid states.\n- They break **YAML indentation** and **TOML syntax**.\n- They can't **validate** changes before writing.\n\n## The Solution\n\n**mcp-json-yaml-toml** provides AI assistants with proper tools for structured data:\n\n- **Token-efficient**: Extract exactly what you need without loading entire files.\n- **Schema validation**: Enforce correctness using SchemaStore.org or custom schemas.\n- **Safe modifications**: **Enforced validation on write**; preserve comments and formatting.\n- **Multi-format**: JSON, YAML, and TOML through a unified interface.\n- **Directive-based detection**: Support for `# yaml-language-server`, `#:schema`, and `$schema` keys in all formats.\n- **Constraint-based guided generation**: Native LMQL support for proactive validation of partial inputs.\n- **Local-First**: All processing happens locally. No data ever leaves your machine.\n- **Transparent JIT Assets**: The server auto-downloads `yq` if missing and fetches missing schemas from SchemaStore.org for local caching.\n\n\u003e [!NOTE]\n\u003e\n\u003e **JSONC Support**: Files with `.jsonc` extension (JSON with Comments) are fully supported for **reading**, **querying**, and **schema validation**. However, **write operations will strip comments** due to library limitations.\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- **Python ≥ 3.11** installed.\n- An **MCP-compatible client** (Claude Code, Cursor, Windsurf, Gemini 2.0, n8n, etc.).\n\n### Installation\n\nThe server uses `uvx` for automatic dependency management and zero-config execution.\n\n#### AI Agents \u0026 CLI Tools\n\n```bash\nuvx mcp-json-yaml-toml\n```\n\n#### Claude Code (CLI)\n\n```bash\nclaude mcp add --scope user mcp-json-yaml-toml -- uvx mcp-json-yaml-toml\n```\n\n#### Other MCP Clients\n\nAdd this to your client's MCP configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"json-yaml-toml\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-json-yaml-toml\"]\n    }\n  }\n}\n```\n\n\u003e [!TIP]\n\u003e See [docs/clients.md](docs/clients.md) for detailed setup guides for Cursor, VS Code, and more.\n\n---\n\n## Schema Discovery \u0026 Recognition\n\nThe server automatically identifies the correct JSON schema for your files using multiple strategies:\n\n1.  **Directives**: Recognizes `# yaml-language-server: $schema=...` and `#:schema ...` directives.\n2.  **In-File Keys**: Detects `$schema` keys in JSON and YAML (also supports quoted `\"$schema\"` in TOML).\n3.  **Local IDE Config**: Discovers schemas from VS Code/Cursor extension settings and caches.\n4.  **SchemaStore.org**: Performs glob-based auto-detection against thousands of known formats.\n5.  **Manual Association**: Use the `data_schema` tool to bind a file to a specific schema URL or name.\n\n---\n\n## LMQL \u0026 Guided Generation\n\nThis server provides native support for **LMQL (Language Model Query Language)** to enable **Guided Generation**. This allows AI agents to validate partial inputs (e.g., path expressions) incrementally before execution.\n\n- **Incremental Validation**: Check partial inputs (e.g., `.data.us`) and get the remaining pattern needed.\n- **Improved Reliability**: Eliminate syntax errors by guiding the LLM toward valid tool inputs.\n- **Rich Feedback**: Get suggestions and detailed error messages for common mistakes.\n\n\u003e [!TIP]\n\u003e See the [Deep Dive: LMQL Constraints](docs/tools.md#deep-dive-lmql-constraints) for detailed usage examples.\n\n---\n\n## Available Tools\n\n| Tool                  | Description                                    |\n| --------------------- | ---------------------------------------------- |\n| `data`                | Get, set, or delete values at specific paths   |\n| `data_query`          | Advanced yq/jq expressions for transformations |\n| `data_schema`         | Manage schemas and validate files              |\n| `data_convert`        | Convert between JSON, YAML, and TOML           |\n| `data_merge`          | Deep merge structured data files               |\n| `constraint_validate` | Validate inputs against LMQL constraints       |\n| `constraint_list`     | List available generation constraints          |\n\n\u003e [!NOTE]\n\u003e Conversion **TO TOML** is not supported due to yq's internal encoder limitations for complex structures.\n\n---\n\n## Development\n\n### Setup\n\n```bash\ngit clone https://github.com/bitflight-devops/mcp-json-yaml-toml.git\ncd mcp-json-yaml-toml\nuv sync\n```\n\n### Testing\n\nash\n\n# Run all tests (coverage included)\n\nuv run pytest\n\n````\n\n### Code Quality\n\nThe project uses `prek` (a Rust-based pre-commit tool) for unified linting and formatting. AI Agents MUST use the scoped verification command:\n\n```bash\n# Recommended: Verify only touched files\nuv run prek run --files \u003cfile edited\u003e\n````\n\n\u003e [!IMPORTANT]\n\u003e Avoid `--all-files` during feature development to keep PR diffs clean and preserve git history.\n\n---\n\n## Project Structure\n\n```text\nmcp-json-yaml-toml/\n├── packages/mcp_json_yaml_toml/  # Core logic\n│   ├── server.py                 # MCP implementation\n│   ├── yq_wrapper.py             # Binary management\n│   ├── schemas.py                # Schema validation\n├── .github/                      # CI/CD and assets\n├── docs/                         # Documentation\n└── pyproject.toml                # Project config\n```\n\n```bash\n# Run all tests (coverage included)\nuv run pytest\n```\n\n### Code Quality\n\nThe project uses `prek` (a Rust-based pre-commit tool) for unified linting and formatting. AI Agents MUST use the scoped verification command:\n\n```bash\n# Recommended: Verify only touched files\nuv run prek run --files \u003cfile edited\u003e\n```\n\n\u003e [!IMPORTANT]\n\u003e Avoid `--all-files` during feature development to keep PR diffs clean and preserve git history.\n\n---\n\n## Project Structure\n\n```mermaid\ngraph TD\n    Repo[mcp-json-yaml-toml]\n    Repo --\u003e Packages[packages/mcp_json_yaml_toml]\n    Repo --\u003e Github[.github]\n    Repo --\u003e Docs[docs]\n    Repo --\u003e Config[pyproject.toml]\n\n    subgraph \"Core Logic\"\n        Packages --\u003e Server[server.py\u003cbr/\u003eMCP Server \u0026 Tools]\n        Packages --\u003e Schemas[schemas.py\u003cbr/\u003eSchema Validation]\n        Packages --\u003e Constraints[lmql_constraints.py\u003cbr/\u003eLMQL Constraints]\n        Packages --\u003e YQ[yq_wrapper.py\u003cbr/\u003eBinary Manager]\n        Packages --\u003e YAML[yaml_optimizer.py\u003cbr/\u003eYAML Anchors]\n        Packages --\u003e TOML[toml_utils.py\u003cbr/\u003eTOML Utils]\n        Packages --\u003e Conf[config.py\u003cbr/\u003eConfig Manager]\n    end\n\n    style Packages fill:#f9f,stroke:#333,stroke-width:2px\n    style Repo fill:#eee,stroke:#333,stroke-width:4px\n```\n\n---\n\n## Token Efficiency Experiment\n\nTwo identical Claude Code sub-agents were given the same task: read `~/.claude.json` and report every MCP server listed, including command, args, and env vars.\n\n### Setup\n\n- **Agent A** — standard prompt, used the built-in `Read` tool\n- **Agent B** — same prompt with one line appended: `You must use the mcp__json-yaml-toml for all file interactions.`\n\nBoth agents used the `sonnet` model.\n\n### Prompts\n\n**Agent A prompt:**\n\n```text\nRead the file ~/.claude.json and report back:\n1. Every MCP server listed in the mcpServers section\n2. For each server: the command, args, and any env vars configured\n\nJust report the raw findings. Do not summarize or interpret.\n```\n\n**Agent B prompt:**\n\n```text\nRead the file ~/.claude.json and report back:\n1. Every MCP server listed in the mcpServers section\n2. For each server: the command, args, and any env vars configured\n\nYou must use the mcp__json-yaml-toml for all file interactions.\n\nJust report the raw findings. Do not summarize or interpret.\n```\n\n### Results\n\nBoth agents returned identical findings (8 MCP servers with correct configs).\n\n| Metric           | Agent A (Read tool) | Agent B (mcp-json-yaml-toml) |\n| ---------------- | ------------------- | ---------------------------- |\n| **Total tokens** | 37,119              | 28,734                       |\n| **Tool uses**    | 4                   | 2                            |\n| **Duration**     | 29.3s               | 12.7s                        |\n\nAgent B used **22.6% fewer tokens** and completed in **43% of the time** with half the tool calls.\n\n### Why\n\nThe `Read` tool loads the entire file into context. `~/.claude.json` is a large file — the agent had to consume all of it to find the `mcpServers` section. The MCP server's `data_query` tool extracted just the `mcpServers` section directly, keeping the context window small.\n\n---\n\n\u003cp align=\"center\"\u003e\n  Built with \u003ca href=\"https://github.com/jlowin/fastmcp\"\u003eFastMCP\u003c/a\u003e, \u003ca href=\"https://github.com/mikefarah/yq\"\u003eyq\u003c/a\u003e, and \u003ca href=\"https://github.com/eth-sri/lmql\"\u003eLMQL\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflight-devops%2Fmcp-json-yaml-toml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitflight-devops%2Fmcp-json-yaml-toml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitflight-devops%2Fmcp-json-yaml-toml/lists"}