api-contract-validator

Cloudflare Workers MCP server: api-contract-validator

我该使用它吗

质量与安全性

A
描述质量
94%
模式完整度
100%
命名质量
92%
投毒风险
100%
权限匹配度
100%
协议合规性
100%

发现(1)

  • LOWTool 'lint_api_schema' description lacks action verb在 lint_api_schema 中

基于对工具定义和协议合规性的自动分析。

上下文开销

~608token 数(工具定义)
~1.1 KB典型响应大小
对注意力的影响极小(占 128k 上下文窗口的 0.47%)

这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。

安装

一键安装

将以下内容添加到你的 `claude_desktop_config.json` 文件中:

{
  "mcpServers": {
    "api-contract-validator": {
      "url": "https://api.lazy-mac.com/api-contract-validator/mcp"
    }
  }
}

远程端点

https://api.lazy-mac.com/api-contract-validator/mcpstreamable-http

它能做什么

工具清单

工具(5)

🟢 只读🟡 写入🔴 删除⚪ 未知
⚪validate_openapi_spec(spec, strict)

Validate an OpenAPI 3.x or AsyncAPI spec JSON. Returns structural errors, missing required fields, and warnings.

输入模式

{
  "type": "object",
  "properties": {
    "spec": {
      "type": "object",
      "description": "OpenAPI or AsyncAPI spec as a JSON object"
    },
    "strict": {
      "type": "boolean",
      "description": "Treat warnings as errors (default: false)",
      "default": false
    }
  },
  "required": [
    "spec"
  ]
}
⚪diff_request_response(spec, request, response)

Compare a real HTTP request/response against an OpenAPI spec contract. Returns per-field violations.

输入模式

{
  "type": "object",
  "properties": {
    "spec": {
      "type": "object",
      "description": "OpenAPI spec JSON object"
    },
    "request": {
      "type": "object",
      "description": "HTTP request to validate",
      "properties": {
        "method": {
          "type": "string",
          "description": "HTTP method"
        },
        "path": {
          "type": "string",
          "description": "Request path (e.g. /users/123)"
        },
        "body": {
          "type": "object",
          "description": "Request body"
        },
        "contentType": {
          "type": "string",
          "description": "Content-Type (default: application/json)"
        },
        "params": {
          "type": "object",
          "properties": {
            "query": {
              "type": "object"
            },
            "path": {
              "type": "object"
            }
          }
        }
      },
      "required": [
        "method",
        "path"
      ]
    },
    "response": {
      "type": "object",
      "description": "HTTP response to validate (optional)",
      "properties": {
        "statusCode": {
          "type": "integer"
        },
        "body": {
          "type": "object"
        },
        "contentType": {
          "type": "string"
        }
      }
    }
  },
  "required": [
    "spec",
    "request"
  ]
}
⚪lint_api_schema(spec, rules)

Lint an API spec for quality and best practice compliance. Rules: operation-id-kebab-case, response-success-required, tags-defined, no-empty-description, security-defined.

输入模式

{
  "type": "object",
  "properties": {
    "spec": {
      "type": "object",
      "description": "OpenAPI spec JSON object"
    },
    "rules": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Rules to apply (defaults to all)"
    }
  },
  "required": [
    "spec"
  ]
}
⚪generate_mock_from_spec(spec, path, method, statusCode)

Generate mock response data from an OpenAPI spec. Uses examples, defaults, formats, and type heuristics.

输入模式

{
  "type": "object",
  "properties": {
    "spec": {
      "type": "object",
      "description": "OpenAPI spec JSON object"
    },
    "path": {
      "type": "string",
      "description": "Target path (optional; generates all if omitted)"
    },
    "method": {
      "type": "string",
      "description": "HTTP method (used with path)"
    },
    "statusCode": {
      "type": "string",
      "description": "Response status code (default: 200)",
      "default": "200"
    }
  },
  "required": [
    "spec"
  ]
}
🟢check_breaking_changes(spec_old, spec_new)

Compare two OpenAPI spec versions to detect breaking changes: removed paths/operations, new required parameters, removed response codes, operationId renames.

输入模式

{
  "type": "object",
  "properties": {
    "spec_old": {
      "type": "object",
      "description": "Previous spec version"
    },
    "spec_new": {
      "type": "object",
      "description": "New spec version"
    }
  },
  "required": [
    "spec_old",
    "spec_new"
  ]
}

社区

评价此服务器

证据

最近观测

已验证未记录版本5 个工具
已验证未记录版本5 个工具