jsonshim

v1.0.2
org.toolkitlabs/jsonshim Checked 4 days ago Published 3 months ago

Recovers malformed LLM JSON.

A one-file MCP stdio server that gives an agent two tools — recover_json and classify_json_failure — for the case where a model was asked for JSON and returned something else. Standard library only, no install, no network call, CC0 1.0. Measured on the same 300 cases as the published leaderboard: 218 of 300 exact, 193 of 275 recoverable, 0 of 25 unrecoverable invented, and 55 false refusals. It never fabricates a value; it pays for that by refusing 55 recoverable documents it could have salvaged. The server file lands at node_modules/jsonshim-mcp/jsonshim_mcp.py.

Summary extracted from the README.

jsonshim-mcp

A one-file MCP stdio server that gives an agent two tools — recover_json and classify_json_failure — for the case where a model was asked for JSON and returned something else. Standard library only, no install, no network call, CC0 1.0.

Measured on the same 300 cases as the published leaderboard: 218 of 300 exact, 193 of 275 recoverable, 0 of 25 unrecoverable invented, and 55 false refusals. It never fabricates a value; it pays for that by refusing 55 recoverable documents it could have salvaged.

Full page with category breakdown: https://toolkitlabs.org/tools/jsonshim-mcp/?s=npm-jsonshim-mcp102

Install

npx -y jsonshim-mcp   # runs the server on stdio
# or: npm i jsonshim-mcp

The server file lands at node_modules/jsonshim-mcp/jsonshim_mcp.py. Or download directly (same bytes): https://toolkitlabs.org/tools/jsonshim-mcp/jsonshim_mcp.py

Configure your MCP client

{
  "mcpServers": {
    "jsonshim": {
      "command": "npx",
      "args": ["-y", "jsonshim-mcp"]
    }
  }
}

The jsonshim-mcp binary is a small Node launcher that runs the shipped jsonshim_mcp.py under python3 -u and pipes stdio straight through. It needs a Python 3.8+ on PATH (set JSONSHIM_PYTHON to an absolute path if yours is elsewhere); it exits non-zero with a readable message if there is none. The server itself installs nothing and imports nothing outside the standard library.

If you would rather point at the file directly, it still lands at node_modules/jsonshim-mcp/jsonshim_mcp.py and python3 <that path> is an equivalent command/args pair.

Tools exposed

tool what it does
recover_json best-effort salvage of malformed model JSON
classify_json_failure names the failure mode without inventing values

Where it sits on the leaderboard

It is weaker than json-repair (264/275 recoverable) and not the same code as jsonshim (282/300 exact). If you want the strongest recovery, this is not it. If you want a conservative MCP tool that refuses rather than invents, it is.

Free leaderboard: https://toolkitlabs.org/leaderboard/?s=npm-jsonshim-mcp102

The full corpora are paid

The open 12 cases per suite are a sample. The full labelled sets — every case with the rationale for its label, and the sealed answers — are EUR 29 each:

Nothing in this package is gated behind them.