Packages

@rekog/mcp-nest

2.0.10 · 13 Nov 2026MIT464k / weekRepositoryHomepagenpmAtom feed

Your version

2.0.0

major29 Jul 2026Where it was published

2.0.10 is the newest release of 2.x.

In short

1 breaking2 security

  • Breaking

    It's a breaking change — jump to

  • Security

    SSRF-guarded fetcher, and RFC 9207 iss on authorization responses.

  • Security

    community-contributed security fixes are accepted, but no new features or

Release note

The section about @rekog/mcp-nest of a note shared by several packages.

v2 is a ground-up rewrite of how MCP-Nest plugs into NestJS, and it delivers
the two things people kept asking for: serve the newest MCP clients without
thinking about it, and build MCP servers the way you already build NestJS apps
guards, interceptors, pipes, filters, and DI, on every tool.

Upgrading an existing v1 server? It's a breaking change — jump to
Upgrading from v1.


Highlights

Modern-era MCP clients work out of the box

MCP shipped a revision — 2026-07-28 — that deletes the initialize
handshake and protocol sessions entirely. It's a clean break with no deprecation
period: old clients and new clients literally cannot talk to the same
single-era server.

MCP-Nest serves both eras concurrently, on one endpoint, by default — and
your tool code doesn't change at all. A 2024 client and a 2026 client can hit
the same /mcp in the same process, and each gets served correctly.

new StreamableHttpTransport();                            // dual-era — the default
new StreamableHttpTransport({ protocol: 'modern-only' }); // 2026-07-28 only
new StreamableHttpTransport({ protocol: 'legacy-only' }); // pre-2026 behaviour

There's nothing to configure. Era is a per-request fact, decided by whoever
called you.

Your tools are first-class NestJS handlers

This is the big one. Every @Tool, @Resource, @ResourceTemplate, and
@Prompt is now a real @MessagePattern handler on an @McpController(), so
the entire NestJS pipeline applies natively — no bespoke machinery bolted on
top:

@McpController()
@UseGuards(ApiKeyGuard)                  // gate the whole capability class
@UseInterceptors(MetricsInterceptor)     // time and log every tool call
export class OrdersController {
  constructor(private readonly orders: OrdersService) {} // real DI, real services

  @Tool({
    name: 'refund-order',
    description: 'Refunds an order',
    parameters: z.object({ id: z.string() }),
  })
  @ToolScopes(['orders:write'])          // per-tool authorization
  @UseFilters(DomainErrorFilter)         // your own error mapping
  @UsePipes(new ValidationPipe({ transform: true, whitelist: true }))
  async refund(@Payload() { id }: { id: string }, @Ctx() ctx: McpContext) {
    await ctx.reportProgress({ progress: 1, total: 2 });
    const receipt = await this.orders.refund(id);
    return { content: [{ type: 'text', text: `Refunded ${receipt.id}` }] };
  }
}

class-validator DTOs, custom pipes, request-scoped providers, @UseFilters,
RpcException — all of it just works, because these are ordinary Nest RPC
handlers now.

Bring your own schema library

parameters and outputSchema are no longer Zod-only. Any Standard Schema
validator that emits JSON Schema works — Zod, ArkType, Valibot — or hand it a
raw JSON Schema object:

@Tool({ name: 'add', description: 'Adds two numbers', parameters: type({ a: 'number', b: 'number' }) })   // ArkType
@Tool({ name: 'echo', description: 'Echoes', parameters: { type: 'object', properties: { text: { type: 'string' } } } }) // raw JSON Schema

Existing Zod code is untouched — this is a widening, not a migration.

Own the MCP route like any other controller

McpHttpControllerFor(transport) turns a transport into a real Nest controller
you own, with the full HTTP pipeline — guards, interceptors, filters,
versioning, middleware:

@Controller('mcp')
@UseGuards(McpAuthJwtGuard)
@UseInterceptors(HttpTimingInterceptor)
export class McpHttpController extends McpHttpControllerFor(mcpTransport) {}

That's also where authentication belongs now — a normal Nest guard, not a
module option.

Several MCP servers in one app, and tools registered at runtime

Named servers give each endpoint its own isolated tool set
(@McpController({ server: 'admin' }) + McpStrategy({ server: 'admin' })),
and the strategy can register and remove tools, resources, and prompts at
runtime — now emitting proper listChanged notifications so connected clients
refresh.

A hardened built-in OAuth server

@rekog/mcp-nest-auth (now its own package, so core stays free of typeorm,
passport, and @nestjs/jwt) gained real security work: token
audience/issuer/type validation, PKCE S256 enforcement, scope narrowing at
/authorize, an opt-in consent screen, Client ID Metadata Documents with an
SSRF-guarded fetcher, and RFC 9207 iss on authorization responses.


v1 → v2 at a glance

v1 (1.9.x)v2 (2.0.0)
How MCP plugs into NestMcpModule.forRoot() generating HTTP controllersa NestJS microservice CustomTransportStrategy (McpStrategy)
Where tools live@Injectable() classes in providers@McpController() classes in controllers
Guards / pipes / interceptors / filters on toolsbespoke, partialnative NestJS — tools are real @MessagePattern handlers
TransportsHTTP+SSE, Streamable HTTP, STDIOStreamable HTTP, STDIO (HTTP+SSE removed)
Protocol revisions2025-era onlydual-era: 2025-era and the stateless 2026-07-28 revision on one endpoint
OAuth authorization serverbundled in coreseparate package @rekog/mcp-nest-auth
MCP SDK@modelcontextprotocol/sdk v1@modelcontextprotocol/{core,node,server} v2

Verified on main at the time of writing: 851 unit/integration tests pass, 0
fail
(56 files, both protocol eras). The example-driven e2e/ suite — which
boots every examples/<project> as a real subprocess and drives it with a
pinned old client (@modelcontextprotocol/sdk@1.10.0) and a modern
2026-07-28 client — last ran 316 pass / 0 fail across 16 files. The old
client passing unmodified is the backward-compatibility proof for 2025-era
consumers.


v1 status

v1 lives on the v1 branch and is in security-patch-only maintenance:
community-contributed security fixes are accepted, but no new features or
general bug fixes from maintainers. Existing v1 users can stay on 1.9.x as
long as they need. New projects should start on v2.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.