jsonsafe-mcp
# `jsonsafe-mcp` — Offline Lossless `BigInt` JSON/JSONL, `RFC 6902` Diff & 5-Target Schema MCP Server, CLI & GitHub Action
[](https://glama.ai/mcp/servers/z121245017-ai/jsonsafe-mcp)
Zero-dependency, 100% offline **Model Context Protocol (`MCP`) Server**, **CLI**, and **GitHub Action** enabling AI coding agents (Claude Desktop, Claude Code, Cursor, Windsurf, Antigravity) and pull-request CI pipelines to inspect **`.json`** and **`1,000+` row `.jsonl` / `NDJSON`** payloads **without `JSON.parse()` IEEE-754 float64 truncation (`> 2^53 - 1`)**, decode **Twitter / Discord / Epoch 64-bit Snowflake timestamps**, recursively un-escape **nested stringified JSON logs**, compute **lossless `RFC 6902` JSON Patches** catching `1-ULP` `int64` mutations, and emit **TypeScript**, **Zod v3**, **Go `struct`**, **PostgreSQL `CREATE TABLE`**, and **JSON Schema Draft 2020-12** definitions.
## MCP Tools Exposed (`stdio`)
| Tool | Purpose | Safety Annotations |
| :--- | :--- | :--- |
| `inspect_lossless_bigint_json` | Parses raw JSON or multi-line `.jsonl` streams offline without IEEE-754 float64 rounding, flagging unsafe `int64`/`uint64`/decimal paths, decoding Snowflake UTC timestamps, catching duplicate keys, and previewing JWT claims. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `infer_multi_target_schema` | Infers unified types across single JSON payloads or `1,000+` `.jsonl` rows (optional `?`, `\| null`, UUID, ISO-8601 timestamps, and `string \| bigint` hazards) into TypeScript, Zod v3, Go `struct`, PostgreSQL DDL, and JSON Schema Draft 2020-12. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `diff_lossless_rfc6902_patch` | Computes a lossless `RFC 6902` JSON Patch (`add`, `remove`, `replace`) between two JSON snapshots, catching `1-ULP` `int64` Snowflake mutations (`...82593` -> `...82594`) that `JSON.parse()` silently misses. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
| `unescape_nested_json_logs` | Recursively un-escapes double- or triple-escaped JSON string fields inside gateway, Kafka, CloudWatch, or OpenTelemetry `.json`/`.jsonl` logs while preserving exact 64-bit integers. | `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: false` |
## Quick Start (MCP Client & Local CLI)
```bash
# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/jsonsafe-mcp
# List MCP tool schemas from terminal
npx -y github:z121245017-ai/jsonsafe-mcp --list
# Audit a JSONL stream for unsafe 64-bit integers (exits 2 on IEEE-754 truncation hazards)
npx -y github:z121245017-ai/jsonsafe-mcp --input ./events.jsonl --fail-on-unsafe
# Generate TypeScript / Zod / Go / PostgreSQL / JSON Schema from multi-row JSONL
npx -y github:z121245017-ai/jsonsafe-mcp --input ./events.jsonl --target ts --root-name OrderEvent
# Invoke any MCP tool directly via --cli
npx -y github:z121245017-ai/jsonsafe-mcp --cli diff_lossless_rfc6902_patch '{"leftContent":"{\"id\":1861928374659182593}","rightContent":"{\"id\":1861928374659182594}"}'
```
### Claude Desktop / Cursor / Windsurf / Antigravity Config
```json
{
"mcpServers": {
"jsonsafe": {
"command": "npx",
"args": ["-y", "github:z121245017-ai/jsonsafe-mcp"]
}
}
}
```
### Docker (`node:22-alpine`, non-root `USER node`)
```bash
docker build -t jsonsafe-mcp .
docker run -i --rm jsonsafe-mcp
```
## GitHub Action (`z121245017-ai/jsonsafe-mcp@v1`)
Block silent 64-bit Snowflake ID corruption, high-precision financial decimal rounding, and duplicate JSON keys in API fixtures and golden test snapshots:
```yaml
name: JsonSafe Precision & Schema Gate
on:
pull_request:
paths:
- '**/*.json'
- '**/*.jsonl'
permissions:
contents: read
jobs:
jsonsafe:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit JSON/JSONL fixtures for IEEE-754 int64 rounding
uses: z121245017-ai/jsonsafe-mcp@v1
with:
paths: 'fixtures'
fail-on-unsafe: 'true'
schema-target: 'ts'
schema-output: 'generated/fixtures.d.ts'
```
## IEEE-754 `float64` vs Lossless `JsonSafe` Reference Matrix
| Numeric Literal Class | Example Raw Literal | Standard `JSON.parse()` Output | `jsonsafe-mcp` Verdict & TypeScript / SQL Mapping |
| :--- | :--- | :--- | :--- |
| **Safe 53-Bit Integer** | `9007199254740991` | `9007199254740991` (Exact) | `SAFE` -> `number` / `BIGINT` |
| **Signed 64-Bit Snowflake** | `1861928374659182593` | `1861928374659182600` (**Corrupted `-7` ULP!**) | `UNSAFE int64` -> `string \| bigint` / `BIGINT` + UTC timestamp |
| **Unsigned `uint64`** | `18446744073709551615` | `18446744073709552000` (**Corrupted!**) | `UNSAFE uint64` -> `string \| bigint` / `NUMERIC(20, 0)` |
| **Financial / Crypto Decimal** | `192837.123456789012345678` | `192837.12345678902` (**Truncated!**) | `UNSAFE decimal` -> `string` / `NUMERIC(38, 18)` |
## Commercial Air-Gapped Browser Workbench & Developer Suite
Need a zero-install **Bilingual Air-Gapped Browser Workbench (`connect-src 'none'`)** or Chrome DevTools MV3 Inspector for pasting production API responses, decoding JWT timestamps offline, and exporting 5-target schemas without touching the terminal?
Explore **JsonSafe BigInt & Schema Studio** and our full offline developer utility catalog at **[https://z121245017-ai.github.io/](https://z121245017-ai.github.io/)**.
## Verification
```bash
npm test
```
## License
MIT License — `0` external npm dependencies, `0` network calls, `100%` local deterministic execution.
TDQS
Scored across 4 tools
Each tool targets a distinct JSON-safety concern: inspection, schema inference, diffing/patching, and log unescaping. The main overlap is between inspect_lossless_bigint_json and unescape_nested_json_logs, since both parse JSON/.jsonl logs, but their descriptions clarify analysis versus transformation.
All tool names follow a consistent snake_case verb-first pattern with descriptive noun phrases. The convention is predictable across the set, even though the names are long and specialized.
Four tools is well-scoped for a focused JSON safety utility. Each tool covers a distinct workflow—inspection, schema inference, patch diffing, and log unescaping—without obvious filler.
The surface covers several important JSON-safety workflows, but there are notable gaps such as applying RFC 6902 patches, safe serialization/stringification, and explicit validation or repair operations. Agents may need external tools to complete patch-apply and encode-side workflows.