Skip to main content
Glama

certguard-mcp — Offline X.509 Chain, SPKI Key Parity & RFC 6125 SAN MCP Server, CLI & GitHub Action

z121245017-ai/certguard-mcp MCP server

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 audit X.509 PEM/DER certificate chains, prove mathematical SubjectPublicKeyInfo (SPKI) parity across Certificate, CSR, and Private Key without exposing private key scalars, validate RFC 6125 wildcard SubjectAltName coverage, and extract gateway hexadecimal serial numbers & SHA-256 SPKI pins.

MCP Tools Exposed (stdio)

Tool

Purpose

Safety Annotations

audit_x509_pem_chain

Decodes X.509 PEM or Base64 DER bundles, detects scrambled Leaf -> Intermediate order, missing intermediates, weak SHA-1/<2048-bit RSA keys, and expiry countdowns, plus emits topologically healed Leaf -> Intermediate fullchain.pem.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

verify_spki_key_and_csr_match

Verifies mathematical SubjectPublicKeyInfo match across Certificate, PKCS#10 CSR, and PKCS#8/PKCS#1/SEC1 Private Key locally in memory without ever outputting private key scalar bytes.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

check_hostname_rfc6125_san

Validates target hostnames and IPv4/IPv6 literals against X.509 SubjectAltName DNS/IP entries per RFC 6125, catching bare-apex *.example.com and multi-level a.b.example.com wildcard traps.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

extract_cert_serial_and_spki_pins

Extracts uppercase contiguous Hex serial numbers (serial_no for WeChat Pay v3 / mTLS gateways), colon-separated SHA-256 thumbprints, and Base64 SHA-256 SPKI pins (pin-sha256).

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

Related MCP server: TLS Radar

Quick Start (MCP Client & Local CLI)

# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/certguard-mcp

# List MCP tool schemas from terminal
npx -y github:z121245017-ai/certguard-mcp --list

# Audit a fullchain.pem bundle and verify RFC 6125 hostname coverage (exits 2 on blocking findings)
npx -y github:z121245017-ai/certguard-mcp --cert ./certs/fullchain.pem --hostname api.example.com --strict

# Invoke any MCP tool directly via --cli
npx -y github:z121245017-ai/certguard-mcp --cli verify_spki_key_and_csr_match '{"certPath":"./certs/fullchain.pem","keyPath":"./certs/server.key"}'

Claude Desktop / Cursor / Windsurf / Antigravity Config

{
  "mcpServers": {
    "certguard": {
      "command": "npx",
      "args": ["-y", "github:z121245017-ai/certguard-mcp"]
    }
  }
}

Docker (node:22-alpine, non-root USER node)

docker build -t certguard-mcp .
docker run -i --rm certguard-mcp

GitHub Action (z121245017-ai/certguard-mcp@v1)

Audit public .pem, .crt, and .cer X.509 certificate bundles in pull requests and scheduled workflows for imminent expiry, inverted Leaf -> Intermediate chains, weak keys, and RFC 6125 SAN mismatches:

name: X.509 Certificate Chain & Expiry Gate

on:
  pull_request:
    paths:
      - 'certs/**'
      - '**/*.pem'
      - '**/*.crt'
  schedule:
    - cron: '15 3 * * 1'

permissions:
  contents: read

jobs:
  certguard:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Audit repository public X.509 certificates
        uses: z121245017-ai/certguard-mcp@v1
        with:
          paths: 'certs'
          min-days-remaining: '30'
          fail-on-expiring: 'true'

Security & Privacy Guarantees

  • Zero Private Scalar Output: verify_spki_key_and_csr_match derives the public SubjectPublicKeyInfo digest in memory and verifies RSA/EC mathematical self-consistency (2^(e*d) === 2 mod n / curve scalar point match) while never returning private scalar d, prime factors p/q, or raw private key PEM/DER bytes.

  • Zero External Dependencies & Zero Network Calls: Pure JavaScript ASN.1 DER/PEM decoder running locally on Node.js >= 20.

Verification

npm test

License

MIT License — 0 external npm dependencies, 0 network calls, 100% local deterministic execution.

Available Tools

4 tools
audit_x509_pem_chainA
Read-onlyIdempotent

Decodes X.509 PEM or Base64 DER certificate bundles, detects scrambled Leaf -> Intermediate CA order, missing intermediates, weak SHA-1/<2048-bit RSA keys, and expiry countdowns.

Inputs: certPem, certPath, stripRoot, minDaysRemaining, +1 more.

check_hostname_rfc6125_sanA
Read-onlyIdempotent

Validates target hostnames and IPv4/IPv6 literals against X.509 SubjectAltName DNS/IP entries per RFC 6125, catching bare-apex *.example.com and multi-level wildcard traps.

Inputs: certPem, certPath, hostname, hostnames.

extract_cert_serial_and_spki_pinsA
Read-onlyIdempotent

Extracts uppercase contiguous Hex serial numbers (for WeChat Pay v3 serial_no and mTLS gateways), SHA-256 certificate thumbprints, and Base64 SHA-256 SPKI pins.

Inputs: certPem, certPath, includeChain.

verify_spki_key_and_csr_matchA
Read-onlyIdempotent

Verifies mathematical SubjectPublicKeyInfo (SPKI) match across Certificate, PKCS#10 CSR, and PKCS#8/PKCS#1/SEC1 Private Key locally without exposing private key scalars.

Inputs: csrPem, keyPem, certPem, csrPath, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a distinct, non-overlapping check: chain ordering/strength audit, SPKI-to-CSR-to-key matching, RFC 6125 hostname/SAN validation, and serial/thumbprint/pin extraction. There is no plausible scenario where an agent would confuse one for another.

    Naming Consistency4/5

    All four tools follow a consistent verb_noun snake_case pattern (audit_, verify_, check_, extract_) with descriptive domain qualifiers. Names are long and packed with qualifiers, but the convention is uniform and readable.

    Tool Count4/5

    Four tightly scoped tools fit a focused certificate-validation server and each earns its place. It is on the lean side, but nothing is redundant or filler.

    Completeness3/5

    The surface covers chain inspection, key/CSR matching, hostname validation, and pin extraction, but has notable gaps for a cert-guard domain: no revocation checking (OCSP/CRL), no chain signature/trust-anchor verification, and no self-signed or expiry-only summary tool. Agents can work around some of this externally, but revocation is a real dead end.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A local MCP server for AI-assisted PKI and ASN.1 workflows, providing tools for certificate parsing, key management, and PKCS#12 processing.
      28
      49 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Free SSL/TLS scanning and Let's Encrypt certificate issuance (private key stays local), plus certificate-expiry monitoring via one MCP server. Public scan and cert tools need no account.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      A domain security and privacy checker MCP server that runs locally, performing DNS, TLS, HTTP, and RDAP lookups to generate a scored report covering certificates, email authentication, DNS, and web security headers.
      3
      307 npm
      GPL 3.0