Token导航 LogoToken导航TokenDH.com
JSON-validate logo
开发工具未说明官方级别未说明来源级核验

JSON-validate

MCP Server

一个用于验证JSON数据是否符合JSON Schema规范并提供修复功能的服务器工具。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
开发工具TypeScriptClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

BUZDOLAPCI

提供方

BUZDOLAPCI

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

json验证

MCP服务器,用于根据JSON模式验证JSON并修复格式错误/无效的JSON。

特性

  • validate_json:根据JSON模式验证JSON实例(支持draft-07)
  • 解释验证:获取人类可读的解释,并修复验证错误的建议
  • 维修_儿子:尝试修复无效的JSON以匹配模式(保守方法)

安装

npm install
npm run build

用法

STDIO传输(默认)

npm start
# or
node dist/index.js

HTTP传输

npm start -- --transport http --port 3000
# or
TRANSPORT=http PORT=3000 node dist/index.js

Claude桌面配置

添加到您的Claude桌面配置(~/.config/claude/claude_desktop_config.json):

{
  "mcpServers": {
    "json-validate": {
      "command": "node",
      "args": ["/path/to/json-validate/dist/index.js"]
    }
  }
}

工具

validate_json

根据JSON模式验证JSON实例。

输入:

{
  "schema": {
    "type": "object",
    "properties": {
      "name": { "type": "string" },
      "age": { "type": "integer", "minimum": 0 }
    },
    "required": ["name"]
  },
  "instance": {
    "name": "John",
    "age": 30
  }
}

输出(成功):

{
  "ok": true,
  "data": {
    "valid": true,
    "errors": []
  },
  "meta": {
    "source": "json-validate",
    "retrieved_at": "2024-01-15T10:30:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

输出(验证错误):

{
  "ok": true,
  "data": {
    "valid": false,
    "errors": [
      {
        "path": "/age",
        "keyword": "minimum",
        "message": "must be >= 0",
        "params": { "limit": 0 },
        "schemaPath": "#/properties/age/minimum"
      }
    ]
  },
  "meta": {
    "source": "json-validate",
    "retrieved_at": "2024-01-15T10:30:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

解释验证

获取人类可读的验证错误解释。

输入:

{
  "errors": [
    {
      "path": "",
      "keyword": "required",
      "message": "must have required property 'name'",
      "params": { "missingProperty": "name" },
      "schemaPath": "#/required"
    }
  ]
}

输出:

{
  "ok": true,
  "data": {
    "explanations": [
      {
        "path": "",
        "error": "must have required property 'name'",
        "explanation": "The required property \"name\" is missing at root.",
        "suggestion": "Add the missing property \"name\" with an appropriate value."
      }
    ]
  },
  "meta": {
    "source": "json-validate",
    "retrieved_at": "2024-01-15T10:30:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

维修_儿子

尝试修复无效的JSON以匹配架构。

特征:

  • 解析格式错误的JSON(尾随逗号、单引号、无引号键)
  • 应用架构默认值
  • 在以下情况下删除其他属性 additionalProperties: false
  • 安全时的强制类型(例如。, "123"123 对于数字模式)
  • 保守:除非模式要求默认值,否则从不发明未知字段

输入:

{
  "schema": {
    "type": "object",
    "properties": {
      "name": { "type": "string" },
      "age": { "type": "integer" },
      "active": { "type": "boolean", "default": true }
    },
    "additionalProperties": false
  },
  "instance_or_text": "{'name': 'John', 'age': '30', 'extra': 'field',}"
}

输出:

{
  "ok": true,
  "data": {
    "repaired": {
      "name": "John",
      "age": 30,
      "active": true
    },
    "changes": [
      {
        "path": "/extra",
        "action": "removed",
        "from": "field",
        "reason": "Property not allowed by schema (additionalProperties: false)"
      },
      {
        "path": "/age",
        "action": "coerced",
        "from": "30",
        "to": 30,
        "reason": "Coerced string to integer"
      },
      {
        "path": "/active",
        "action": "defaulted",
        "to": true,
        "reason": "Applied schema default value"
      }
    ],
    "parseErrors": [
      "Standard JSON parse failed, attempting repairs...",
      "JSON repaired successfully with syntax fixes"
    ]
  },
  "meta": {
    "source": "json-validate",
    "retrieved_at": "2024-01-15T10:30:00.000Z",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

CLI选项

Usage: json-validate [options]

Options:
  -t, --transport   Transport type: 'stdio' or 'http' (default: stdio)
  -p, --port      HTTP server port (default: 3000)
  -H, --host     HTTP server host (default: 127.0.0.1)
  -l, --log-level  Log level: 'debug', 'info', 'warn', 'error' (default: info)
  -h, --help              Show this help message

环境变量

变量描述默认值
TRANSPORT运输类型: stdiohttpstdio
PORTHTTP服务器端口3000
HOSTHTTP服务器主机127.0.0.1
LOG_LEVEL日志级别: debug, info, warn, errorinfo

发展

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type check
npm run typecheck

# Build
npm run build

响应信封

所有工具均以标准信封格式返回响应:

成功:

{
  "ok": true,
  "data": { ... },
  "meta": {
    "source": "json-validate",
    "retrieved_at": "ISO-8601 timestamp",
    "pagination": { "next_cursor": null },
    "warnings": []
  }
}

错误:

{
  "ok": false,
  "error": {
    "code": "INVALID_INPUT | PARSE_ERROR | INTERNAL_ERROR",
    "message": "Human readable message",
    "details": { ... }
  },
  "meta": {
    "retrieved_at": "ISO-8601 timestamp"
  }
}

许可证

麻省理工学院

目录标签

目录标签

开发工具TypeScriptClaudeJSON验证本地部署数据修复JSONSchema

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP