nestjs-docfy: mock servers, contract testing, and a much sharper MCP server

2026年8月2日7 次浏览来源:Dev.to阅读原文

A few weeks ago I shared nestjs-docfy here — a library that moves Swagger decorators out of NestJS controllers into companion files, docfy-ui as an AI-first reference UI, and docfy-mcp exposing your API catalog to coding agents via /.

Since then the CLI grew a full local dev workflow around the spec itself, and docfy-mcp went from "read the docs" to "verify the API is telling the truth." : a server without the server Spins up a throwaway HTTP server straight from your OpenAPI document — every path returns a schema-shaped response.

Useful for frontend work against an API that isn't built yet, or for pointing an agent at something real instead of a static spec file. : contract testing off the spec Fires a real request at every documented endpoint and validates the live response against its declared schema.

Catches the exact failure mode API docs are famous for: the code moved on, the docs didn't.

CI-friendly, non-zero exit on drift. : zero to configured One command, scaffolds the entry file and wires for you.

No more copy-pasting from the README. : less boilerplate Auto-inserts into the controller so newly generated files are actually wired in — one less manual step per endpoint.

Breaking changes, surfaced in the PR itself now runs a spec diff and posts breaking vs. informational field changes as a PR comment.

You see the blast radius of an API change before merge, not after a consumer files a bug. docfy-mcp: from lookup to verification The MCP server picked up three tools that turn it from a reference into an actual QA loop for agents: — flags spec-quality issues: missing summary/description, missing tags, undocumented 4xx/5xx, duplicate operation IDs — compares the loaded catalog against another spec (a file, a URL, a previous git tag) and reports breaking vs. informational changes — fires real requests at a running server and validates responses against the schema, with a and repeatable for auth, plus a timeout and response-size cap so a runaway endpoint can't hang the agent's turn Combined with /, an agent implementing a client can now lint the spec it's about to consume, diff it against what it saw last session, and contract-test its own integration — all inside the editor, no browser round-trip.

Security hardening shipped alongside: requests are capped and time-boxed, and hitting arbitrary servers is opt-in via an allowlist rather than default-open.

Docs, now in 10 languages nestdocfy.com is fully localized — EN, PT, ES, DE, FR, IT, NL, PL, ZH, JA — same content, same nav, picked up automatically from the browser's locale.

Nothing about the existing setup changes — same , same convention.

Everything above is additive. 🔗 nestjs-docfy on GitHub · 📦 nestjs-docfy on npm · 📦 docfy-mcp on npm · 📖 docs If your API docs drift from reality, or your agent is still guessing your API's shape from stale comments, this release closes both gaps.

分享