{"slug": "nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server", "title": "nestjs-docfy: mock servers, contract testing, and a much sharper MCP server", "summary": "NestJS developer MarvinRF released a major update to nestjs-docfy, adding mock servers, contract testing, and enhanced MCP server tools. The new CLI commands enable developers to spin up schema-based mock servers, run contract tests against live APIs, and scaffold configurations with minimal boilerplate. The MCP server now includes linting, diffing, and contract testing tools, turning it into a QA loop for coding agents, with security hardening and full localization.", "body_md": "A few weeks ago I shared nestjs-docfy here — a library that moves Swagger decorators out of NestJS controllers into companion `*.controller.docs.ts`\n\nfiles, docfy-ui as an AI-first reference UI, and docfy-mcp exposing your API catalog to coding agents via `list_endpoints`\n\n/`get_endpoint`\n\n.\n\nSince 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.\"\n\n`docfy mock`\n\n: a server without the server\n`\\`\n\n`shell`\n\nnpx nestjs-docfy mock --spec openapi.json --port 4010\n\n\\`\\`\n\nSpins 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.\n\n`docfy test`\n\n: contract testing off the spec\n`\\`\n\n`shell`\n\nnpx nestjs-docfy test --spec openapi.json --base-url http://localhost:3000\n\n\\`\\`\n\nFires 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.\n\n`docfy init`\n\n: zero to configured\n`\\`\n\n`shell`\n\nnpx nestjs-docfy init\n\n\\`\\`\n\nOne command, scaffolds the `docfy-export.ts`\n\nentry file and wires `DocfyModule.forRoot()`\n\nfor you. No more copy-pasting from the README.\n\n`--link-controller`\n\n: less boilerplate\n`\\`\n\n`shell`\n\nnpx nestjs-docfy generate --link-controller\n\n\\`\\`\n\nAuto-inserts `@WithDocs()`\n\ninto the controller so newly generated `.controller.docs.ts`\n\nfiles are actually wired in — one less manual step per endpoint.\n\n`docfy-pr-check-reusable.yml`\n\nnow 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.\n\nThe MCP server picked up three tools that turn it from a reference into an actual QA loop for agents:\n\n`lint_spec`\n\n`diff_specs`\n\n`contract_test`\n\n`filter`\n\nand repeatable `--header`\n\nfor auth, plus a timeout and response-size cap so a runaway endpoint can't hang the agent's turnCombined with `list_endpoints`\n\n/`get_endpoint`\n\n, 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.\n\nSecurity hardening shipped alongside: `contract_test`\n\nrequests are capped and time-boxed, and hitting arbitrary servers is opt-in via an allowlist rather than default-open.\n\nnestdocfy.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.\n\nNothing about the existing setup changes — same `DocfyModule.forRoot()`\n\n, same `*.controller.docs.ts`\n\nconvention. Everything above is additive.\n\n`\\`\n\n`shell`\n\nnpm install nestjs-docfy\n\nnpx docfy-mcp --url <your-openapi-json>\n\n\\`\\`\n\n[🔗 nestjs-docfy on GitHub](https://github.com/MarvinRF/nest-docfy) · [📦 nestjs-docfy on npm](https://www.npmjs.com/package/nestjs-docfy) · [📦 docfy-mcp on npm](https://www.npmjs.com/package/docfy-mcp) · [📖 docs](https://www.nestdocfy.com)\n\nIf your API docs drift from reality, or your agent is still guessing your API's shape from stale comments, this release closes both gaps.", "url": "https://wpnews.pro/news/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server", "canonical_source": "https://dev.to/marvin_rocha_24917bf64d0e/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server-568a", "published_at": "2026-08-02 00:15:01+00:00", "updated_at": "2026-08-02 00:38:26.165572+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents"], "entities": ["MarvinRF", "nestjs-docfy", "docfy-mcp", "docfy-ui", "NestJS", "GitHub", "npm"], "alternates": {"html": "https://wpnews.pro/news/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server", "markdown": "https://wpnews.pro/news/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server.md", "text": "https://wpnews.pro/news/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server.txt", "jsonld": "https://wpnews.pro/news/nestjs-docfy-mock-servers-contract-testing-and-a-much-sharper-mcp-server.jsonld"}}