rekog-labs/MCP-Nest
A NestJS module to effortlessly create Model Context Protocol (MCP) servers for exposing AI tools, resources, and prompts.
What it solves
It simplifies the process of building Model Context Protocol (MCP) servers within the NestJS framework. Instead of building a server from scratch, developers can use familiar NestJS patterns to expose tools, resources, and prompts to AI agents, allowing them to integrate existing enterprise codebase logic into AI workflows.
How it works
The library implements MCP as a NestJS microservice transport strategy. By using the @McpController() decorator, developers can define methods as MCP tools (using @Tool with Zod validation), resources, or prompts. These are then served via multiple transport options, including Streamable HTTP and STDIO. It leverages NestJS's dependency injection system, meaning that guards, pipes, interceptors, and exception filters work natively with MCP handlers.
Who it’s for
Backend developers using NestJS who want to create MCP servers to provide AI agents with access to their application's data and functionality.
Highlights
- NestJS Integration: Uses a
CustomTransportStrategyso that standard NestJS middleware (guards, pipes, interceptors) applies to AI tools. - Dual-Era Protocol Support: A single endpoint can concurrently serve both the 2025-era and the 2026-07-28 stateless protocol revisions.
- Multi-Transport Support: Supports both Streamable HTTP and STDIO transports.
- Enterprise Ready: Includes support for fine-grained per-tool authorization and integration with both built-in and external authorization servers (e.g., Keycloak, Auth0).
- Zod Validation: Automatic discovery and validation of tool parameters using Zod.
Related
- Project
- Dispatch
- Project
- Project
- Project