← Back to directory
M

MCP Nest

Community
NestJS module to effortlessly create MCP servers
GitHub source repository ↗
★ 702 Stars Category · Dev Tools Very popular Source revision f5328268abb9
51FMRS · D
Reliability
8/20
Security and permissions
8/20
Maintenance
12/20
Documentation
13/20
Setup experience
10/20

This server is ideal for developers wanting to turn their NestJS codebase into an MCP server. It offers strong integration within the NestJS ecosystem with native microservice support for tools, resources, and prompts. However, it requires NestJS experience and may not be suitable for non-NestJS projects.

Read the FMRS scoring method →

MCP Nest is a NestJS module to effortlessly expose tools, resources, and prompts for AI from your NestJS applications using the Model Context Protocol (MCP). It runs as a CustomTransportStrategy for NestJS microservices, making tools/resources/prompts real @MessagePattern handlers, so guards, pipes, interceptors, and exception filters apply natively. It supports Streamable HTTP and STDIO transports and serves both the 2025-era protocol and the stateless 2026-07-28 revision concurrently. Leverage NestJS dependency injection to define tools, resources, and prompts via decorators, with features like dynamic capabilities, resource templates, prompts, guard-based authentication, built-in or external authorization servers (OAuth), and server mutation.

Tools

The tool list has not been reviewed yet.

Setup

In your NestJS project, run npm install @rekog/mcp-nest @modelcontextprotocol/server @modelcontextprotocol/core @modelcontextprotocol/node zod@^4. Optionally, for the built-in authorization server, install @rekog/mcp-nest-auth; for TypeORM store, install @nestjs/typeorm and typeorm. Then follow the README quick start guide using McpStrategy and @McpController decorator.

Fit and risk

Best for

  • NestJS developers wanting to integrate AI tools seamlessly into existing backends
  • Teams needing secure, scalable, and testable MCP servers
  • Projects requiring fine-grained authorization and observability within a microservice architecture

Not for

  • Non-NestJS users, as it is strictly NestJS-based
  • Developers wanting to use different transports like SSE (only Streamable HTTP and STDIO are supported)
  • Those seeking a no-code solution to create MCP servers without writing TypeScript or NestJS code

Required permissions

  • Requires a Node.js and npm environment
  • When running STDIO transport, the process stdout must be reserved for the protocol
  • For HTTP transport, an accessible endpoint is needed; external authorization servers (like OAuth) may require network access

Risks and side effects

  • As a relatively new module, its API may evolve (e.g., migration from v1 to v2)
  • When using external authorization servers, careful handling of OAuth flows is required
  • Depending on ctx.reportProgress may be ineffective on legacy stateless clients with stateful sessions

Troubleshooting

  1. For HTTP transport, ensure you call mcp.setHttpAdapter(app.getHttpAdapter()) and app.startAllMicroservices() before app.listen()
  2. For STDIO servers, disable logging or redirect logs to stderr because stdout is used for the protocol
  3. Verify that transports are included in the transports array and that transport types are supported

Use cases

Expose AI tools, resources, and prompts from an existing NestJS application.
Build enterprise-ready MCP servers while leveraging NestJS DI, guards, pipes, and interceptors.
Serve both modern and stateless MCP protocol revisions over Streamable HTTP and STDIO transports.

Supported clients

Supported clients have not been confirmed yet.