by rekog-labs
Effortlessly create Model Context Protocol servers for exposing AI tools, resources, and prompts within NestJS applications.
MCP Nest provides a NestJS module that enables developers to define and expose AI tools, resources, and prompt templates as MCP endpoints, leveraging NestJS's dependency injection and guard system.
npm install @rekog/mcp-nest @modelcontextprotocol/sdk zod@^3
AppModule using McpModule.forRoot({ name: 'my-mcp-server', version: '1.0.0' }).@Tool (or define resources and prompts) to expose them via MCP.Q: Do I need a separate server to run MCP? A: No. The MCP server runs inside your existing NestJS application.
Q: Which transports are supported? A: HTTP with Server‑Sent Events, streamable HTTP responses, and STDIO for CLI‑based usage.
Q: How is authentication handled? A: Use NestJS guards; the module also offers a built‑in OAuth authorization server (beta) or can integrate with external providers like Keycloak or Auth0.
Q: Can I use TypeORM with the built‑in auth server?
A: Yes, install @nestjs/typeorm and typeorm as optional peer dependencies.
Q: How are tool parameters validated?
A: Define Zod schemas in the @Tool decorator; validation occurs automatically before the method is invoked.
A NestJS module to effortlessly expose tools, resources, and prompts for AI, from your NestJS applications using the Model Context Protocol (MCP).
With @rekog/mcp-nest you define tools, resources, and prompts in a way that's familiar in NestJS and leverage the full power of dependency injection to utilize your existing codebase in building complex enterprise ready MCP servers.
Are you interested to build ChatGPT widgets (with the OpenAI SDK)?
Find out how to do that with @rekog/MCP-Nest in this repository MCP-Nest-Samples/pizzaz-openai-apps-sdk
npm install @rekog/mcp-nest @modelcontextprotocol/sdk zod@^3
If you use the built-in authorization server with the TypeORM store, install the following optional peer dependencies:
npm install @nestjs/typeorm typeorm
// app.module.ts
import { Module } from '@nestjs/common';
import { McpModule } from '@rekog/mcp-nest';
import { GreetingTool } from './greeting.tool';
@Module({
imports: [
McpModule.forRoot({
name: 'my-mcp-server',
version: '1.0.0',
}),
],
providers: [GreetingTool],
})
export class AppModule {}
// greeting.tool.ts
import { Injectable } from '@nestjs/common';
import { Tool, Context } from '@rekog/mcp-nest';
import { z } from 'zod';
@Injectable()
export class GreetingTool {
@Tool({
name: 'greeting-tool',
description: 'Returns a greeting with progress updates',
parameters: z.object({
name: z.string().default('World'),
}),
})
async sayHello({ name }, context: Context) {
await context.reportProgress({ progress: 50, total: 100 });
return `Hello, ${name}!`;
}
}
The playground directory contains working examples for all features.
Refer to playground/README.md for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.