MCP-Nest
CLAUDE.md732 starsChanged 2 months agoMITView on GitHub
Dual-era: one endpoint serves both the 2025-era protocol (initialize handshake, sessions) and the new stateless revision 2026-07-28. Each POST is classified with the SDK's own classifyInboundRequest; modern traffic goes to createMcpHandler, 2025 traffic to the existing wiring. GET/DELETE, statefulMode, enableJsonResponse and sessionIdGenerator are all legacy-era only. See docs/protocol-revisions.md and SPEC-2026-07-28-SUPPORT.md. Do not read LATEST_PROTOCOL_VERSION from the SDK as "the newest revision we speak" — it is 2025-11-25; the modern revision string is not exported and must be written literally.
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Do not read LATEST_PROTOCOL_VERSION from the SDK as "the newest revision we speak" — it is 2025-11-25.
- Distinctive: line 62
don't run linting, I don't care about it or formatting
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
What this repo is
This is a NestJS package that lets users expose their existing NestJS providers as MCP tools, resources, and prompts, with DI, guards, pipes, interceptors, and filters applying natively.
Dual-era: one endpoint serves both the 2025-era protocol (initialize handshake, sessions)
and the new stateless revision 2026-07-28. Each POST is classified with the SDK's own
classifyInboundRequest; modern traffic goes to createMcpHandler, 2025 traffic to the
existing wiring. GET/DELETE, statefulMode, enableJsonResponse and sessionIdGenerator
are all legacy-era only. See docs/protocol-revisions.md and SPEC-2026-07-28-SUPPORT.md.
Do not read LATEST_PROTOCOL_VERSION from the SDK as "the newest revision we speak" — it is
2025-11-25; the modern revision string is not exported and must be written literally.
Packages
packages/mcp-nest→@rekog/mcp-nest(core).McpStrategy(a NestJSCustomTransportStrategy),@McpController, the@Tool/@Resource/@ResourceTemplate/@Promptdecorators, Streamable HTTP + STDIO transports, and per-tool authorization primitives (@ToolScopes/@ToolRoles). Deliberately dependency-light.packages/mcp-nest-auth→@rekog/mcp-nest-auth(optional). A built-in OAuth authorization server (McpAuthModule): your Nest app itself implements the MCP auth spec — dynamic client registration, consent, token issuance — while federating user login to an IdP (GitHub, Google, Keycloak…). Users who already have an MCP-spec-compliant authz server don't need this package at all; they just expose protected-resource metadata (seedocs/external-authorization-server.md).
Layout
docs/— user-facing guides;docs/README.mdis the index. Most docs have a matching runnable project inexamples/under the same name.examples/<project>— standalone npm projects consuming the published or local packages.tests/— unit/integration specs for the packages (bun test).e2e/— separate suite drivingexamples/with a pinned old MCP client to check backward compatibility.
Commands
npm test/npm run test:watch— bun test overtests/andpackages/**/*.spec.ts. Most specs are parameterised over both protocol eras viadescribe.each(ERAS); run one era withbun test tests/ -t "modern era"(or"legacy era").npm run e2e— e2e suite driven by a pinned OLD MCP client;npm run e2e:localbuilds firstnpm run examples:local/npm run examples:published— repoint examples at local vs published packages- Each
examples/<project>is a standalone npm project — seeexamples/README.md
Gotchas
- There is no
McpModule. v2 is a NestJS microservice transport strategy (McpStrategy) plus@McpController. Seedocs/migration-to-v2.md. Anything you recall aboutMcpModule.forRoot()is v1 and will not compile. @rekog/mcp-nest-authships as a separate package so core stays free oftypeorm/passport/@nestjs/jwt. Import every auth symbol from it, not from core.- Tool methods are
(args, context, request)—requestisundefinedunder STDIO. - MRTR (Multi Round-Trip Requests,
2026-07-28): handlers returninputRequired({...})and read the retry's answers viaMcpContext.getAcceptedContent/getInputResponse/getRequestState. TherequestState.verifyhook andinputRequiredshim knobs areMcpServerOptions. Works on both eras (the SDK shim converts on legacy). Seedocs/mrtr.md. - Tool
parametersaccept any Standard Schema, not just Zod (zodis not a core dependency). jest.config.jsat the root is a dead leftover; tests run underbun test.- The only root lockfile is
package-lock.json(CI usesnpm ci). Do not add a rootbun.lock. - Releases: create a GitHub release
vX.Y.Z→publish.yml. Security patches release themselves (auto-release.yml, Dependabot auto-merge, rollback on a failed smoke test); seeSECURITY-AUTOMATION-PLAN.mdbefore touching.github/workflows/.
Directives
- don't run linting, I don't care about it or formatting
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

