npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mrzadexinho/docguard

v0.1.0

Published

API documentation drift detector MCP server — find where your docs lie before your users do

Readme

docguard

npm version License: MIT

API documentation drift detector MCP server. Find where your docs lie — before your users do.

Problem

API docs drift from code constantly. A developer adds a route, forgets to update the OpenAPI spec. Another removes an endpoint but the docs still list it. Parameters change, status codes change — the spec becomes fiction.

docguard compares your OpenAPI spec against actual code routes and reports exactly what's out of sync. No live traffic needed, no LLM calls — pure static analysis.

Quick Start

As MCP Server

Works with any MCP-compatible client — Claude Code, Claude Desktop, Cursor, Windsurf, VS Code (Copilot), Continue.dev, Zed, Cline, and more.

{
  "mcpServers": {
    "docguard": {
      "command": "npx",
      "args": ["-y", "@mrzadexinho/docguard"]
    }
  }
}

As Library

import { parseSpec, extractRoutes, compareDrift, formatDriftReport } from '@mrzadexinho/docguard';
import { readFileSync } from 'fs';

// Parse your OpenAPI spec
const spec = parseSpec(readFileSync('openapi.yaml', 'utf-8'));

// Extract routes from code
const code = extractRoutes(readFileSync('src/routes.ts', 'utf-8'), 'src/routes.ts');

// Compare and report drift
const drift = compareDrift(spec.routes, code.routes);
console.log(formatDriftReport(drift));

MCP Tools

| Tool | Description | |------|-------------| | check_drift | Compare OpenAPI spec against code routes. Reports undocumented routes, stale docs, and parameter mismatches | | extract_routes | Scan a code file and extract API routes with methods, paths, and parameters | | validate_spec | Validate OpenAPI spec for structure and completeness (missing operationIds, summaries, responses) |

What It Detects

| Drift Type | Severity | Description | |-----------|----------|-------------| | Undocumented route | Error | Route exists in code but path is completely missing from spec | | Undocumented method | Warning | Path exists in spec but this HTTP method isn't documented | | Stale documentation | Error | Endpoint in spec but no matching route in code | | Stale method | Warning | Path exists in code but this HTTP method was removed | | Parameter mismatch | Warning | Path params differ between spec and code |

Framework Support

Auto-detects and extracts routes from:

| Framework | Patterns detected | |-----------|-------------------| | Express | app.get(), router.post(), app.use('/prefix', router) | | FastAPI | @app.get(), @router.post(), APIRouter(prefix=...) | | Hono | app.get(), app.post(), .basePath() |

Spec Support

  • OpenAPI 3.x (YAML and JSON)
  • Swagger 2.0 (JSON)
  • Path parameter extraction ({id} normalized to :id)
  • Base path from servers[0].url or basePath

Example Output

# API Documentation Drift Report

**8 spec routes, 10 code routes, 4 drift issue(s):**
- 2 route(s) in code but missing from spec
- 1 route(s) in spec but missing from code (stale docs)
- 1 parameter mismatch(es)

## Undocumented Routes (in code, not in spec)

[ERROR] GET /health exists in code but is completely missing from spec
  Code: src/routes.ts:12

[ERROR] POST /webhooks exists in code but is completely missing from spec
  Code: src/routes.ts:45

## Stale Documentation (in spec, not in code)

[ERROR] DELETE /users/:id documented in spec but not found in code (stale docs)
  Spec: operationId: deleteUser

## Parameter Mismatches

[WARNING] Path parameter mismatch on GET /users/:id
  Spec params: id
  Code params: userId

Architecture

docguard/
  src/
    spec/            # OpenAPI spec parsing
      types          # SpecRoute, SpecParam, SpecResponse
      parser         # Parse OpenAPI 3.x / Swagger 2.0
    routes/          # Code route extraction
      types          # CodeRoute, FrameworkType
      express        # Express route extractor
      fastapi        # FastAPI route extractor
      hono           # Hono route extractor
      detector       # Auto-detect framework, multi-file extraction
    drift/           # Drift detection engine
      types          # DriftFinding, DriftType, DriftSeverity
      comparator     # Compare spec vs code routes
      reporter       # Format drift report (markdown)
    mcp/             # MCP server layer
      tools/         # 3 MCP tools
  tests/             # 77 tests mirroring src/ structure

Prerequisites

  • Node.js >= 20.0.0
  • An OpenAPI spec file (YAML or JSON)

Development

git clone https://github.com/mrzadexinho/docguard.git
cd docguard
npm install
npm run build
npm test

License

MIT