apishield-mcp
Provides a GitHub Action to gate OpenAPI/Swagger breaking changes in pull requests, with inline ::error workflow annotations and Markdown step summaries.
apishield-mcp — Offline OpenAPI & JSON Payload Breaking-Change MCP Server, CLI & GitHub Action
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 detect breaking API contract changes across OpenAPI 3.0/3.1, Swagger 2.0, and raw Before/After JSON payload samples.
Built on formal contravariant request and covariant response variance rules so subtle mobile/mini-program crash vectors (nullable: false -> true on responses, widened response enums breaking exhaustive decoders, narrowed request enums, int64 -> string wire-type shifts, added required headers, and removed 2xx status codes) are caught before merge.
MCP Tools Exposed (stdio)
Tool | Purpose | Safety Annotations |
| Audits OpenAPI |
|
| Infers normalized JSON schemas from raw Before/After API response or request/response JSON samples and detects breaking field removals, nullability shifts, and type mutations. |
|
| Produces customer-facing Markdown changelogs alongside RFC 8594 |
|
| Boolean CI gate checking candidate specs or payload samples against mobile/mini-program backward-compatibility thresholds and minimum compatibility scores. |
|
Related MCP server: guardrails-mcp-server
Quick Start (MCP Client & Local CLI)
# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/apishield-mcp
# List MCP tool schemas from terminal
npx -y github:z121245017-ai/apishield-mcp --list
# Diff two OpenAPI files directly from CLI (exits 2 when breaking hazards are found)
npx -y github:z121245017-ai/apishield-mcp --base ./openapi-v1.yaml --head ./openapi-v2.yaml --strict
# Invoke any MCP tool directly via --cli
npx -y github:z121245017-ai/apishield-mcp --cli diff_json_payload_samples '{"beforeJson":"{\"orderId\":\"A1\",\"couponTitle\":\"VIP\"}","afterJson":"{\"orderId\":\"A1\",\"couponTitle\":null}"}'Claude Desktop / Cursor / Windsurf / Antigravity Config
{
"mcpServers": {
"apishield": {
"command": "npx",
"args": ["-y", "github:z121245017-ai/apishield-mcp"]
}
}
}Docker (node:22-alpine, non-root USER node)
docker build -t apishield-mcp .
docker run -i --rm apishield-mcpGitHub Action (z121245017-ai/apishield-mcp@v1)
Block breaking OpenAPI 3.0/3.1 and Swagger 2.0 changes in pull requests with inline ::error workflow annotations and Markdown step summaries:
name: OpenAPI Backward-Compatibility Gate
on:
pull_request:
paths:
- 'api/**'
- '**/*openapi*.yaml'
- '**/*openapi*.json'
permissions:
contents: read
jobs:
apishield-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Audit OpenAPI changes against origin/main
uses: z121245017-ai/apishield-mcp@v1
with:
paths: 'api'
baseline-ref: 'origin/main'
strict-mobile-gate: 'true'You can also compare two explicit files (base-file and head-file) in CI:
- name: Compare v1 and candidate OpenAPI contracts
uses: z121245017-ai/apishield-mcp@v1
with:
base-file: 'contracts/v1/openapi.yaml'
head-file: 'contracts/candidate/openapi.yaml'
strict-mobile-gate: 'true'Contravariant Request vs Covariant Response Rules
Contract Direction | Safe (MINOR / PATCH) | Breaking ( |
Request ( | Add optional param/field, relax | Add required header/query/body field without default, narrow request |
Response ( | Add new field, promote | Remove field, demote |
Endpoint & Auth | Add new route or optional auth alternative | Remove path/HTTP method, add mandatory auth to public route, drop existing auth scheme |
Verification
npm testLicense
MIT License — 0 external npm dependencies, 0 network calls, 100% local deterministic execution.
Available Tools
4 toolsdiff_json_payload_samplesARead-onlyIdempotent
Infers normalized JSON schemas from raw Before/After API response or request/response JSON payload samples and detects breaking field removals, nullability shifts, and type mutations.
Inputs: afterJson, afterPath, beforeJson, beforePath, +1 more.
diff_openapi_breaking_changesBRead-onlyIdempotent
Audits OpenAPI 3.0/3.1 and Swagger 2.0 specs (JSON or YAML) using contravariant request and covariant response variance rules (nullable, enum, required, status/auth changes) and recommends SemVer bumps.
Inputs: basePath, baseSpec, headPath, headSpec, +1 more.
generate_api_release_changelogBRead-onlyIdempotent
Produces customer-facing Markdown API release changelogs alongside RFC 8594 Deprecation/Sunset HTTP header snippets and BFF adapter migration checklists.
Inputs: mode, basePath, baseSpec, headPath, +3 more.
validate_contract_backward_compatBRead-onlyIdempotent
Evaluates a boolean CI gate checking candidate OpenAPI specs or JSON payload samples against mobile/mini-program backward-compatibility thresholds.
Inputs: mode, basePath, baseSpec, headPath, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The two diff tools are clearly separated by input type (OpenAPI/Swagger specs vs raw JSON payload samples), and the changelog tool is a distinct output-generation operation. The main overlap is between diff_openapi_breaking_changes and validate_contract_backward_compat, which both assess compatibility of OpenAPI specs; descriptions distinguish a detailed variance report from a boolean threshold gate, but an agent could still pick the wrong one for a quick check.
All four names follow a consistent snake_case verb_object pattern (diff_*, generate_*, validate_*) with the domain object embedded. Prefixes map predictably to operation type, making the set easy to scan and reason about.
Four tools is a tight, purposeful surface for a narrow API-contract-compatibility domain, and each tool covers a distinct stage (spec diff, payload diff, changelog, CI gate). It is on the lean side with no tooling for baseline/version management, but nothing feels redundant.
The set covers the core lifecycle: detect breaking changes in specs and payloads, gate CI, and communicate via changelog with deprecation headers and migration checklists. Minor gaps exist around baseline/snapshot storage and retrieval of specs to diff against, which agents must supply themselves.
Maintenance
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Free MCP server of security & dev API tools -- supply-chain, CVE, DNS, WHOIS, OFAC, Cosmos SDK.
Experimental MCP server for current empirical verification of explicit public HTTPS endpoint claims.
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP security server for AI coding agents. 12 tools: pre-install guardian, vulnerability audit, supply-chain attack detection via static code analysis, and CycloneDX 1.6 SBOM generation. Zero runtime dependencies.1578 npm15Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.111 npm1MIT
- FlicenseAqualityBmaintenanceAI-native HTTP security testing MCP server — 18 tools with raw HTTP/1.1 + HTTP/2 control18-
- AlicenseNot gradedqualityFmaintenanceLightweight MCP security proxy — compression (up to 86%) + SSRF protection + allow/deny + audit + rate limiting + injection detection53 npm180MIT