NestJS MCP Server Module
A NestJS module that allows services to be exposed as an MCP server with Server-Sent Events transport, facilitating tool discovery and execution by clients.
What is NestJS MCP Server Module?
NestJS MCP Server Module is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to nestjs module that allows services to be exposed as an mcp server with server-sent events transport, facilitating tool discovery and execution by clients.
A NestJS module that allows services to be exposed as an MCP server with Server-Sent Events transport, facilitating tool discovery and execution by clients.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A NestJS module that allows services to be exposed as an MCP
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @rekog/mcp-nestManual Installation
npx -y @rekog/mcp-nestConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use NestJS MCP Server Module
The NestJS MCP Server Module (@rekog/mcp-nest) is a TypeScript library that lets you expose any NestJS service as a fully compliant Model Context Protocol server with minimal configuration. It integrates into the NestJS dependency injection system so your existing services, repositories, and guards can be used directly as MCP tools, resources, and prompts. Teams building backend services use it to make their APIs discoverable and callable by AI assistants like Claude without writing a separate MCP adapter layer.
Prerequisites
- Node.js 18 or higher
- An existing NestJS application (NestJS 10+)
- npm or yarn package manager
- The @modelcontextprotocol/sdk and zod packages (installed alongside @rekog/mcp-nest)
- An MCP-compatible client such as Claude Desktop to test the exposed tools
Install the package and its peer dependencies
Install @rekog/mcp-nest along with its required peer dependencies: the MCP SDK and zod for schema validation.
npm install @rekog/mcp-nest @modelcontextprotocol/sdk zod@^4Import McpModule in your AppModule
Add McpModule.forRoot() to the imports array of your root AppModule. Provide the server name and version — these are reported to MCP clients during the handshake.
import { McpModule } from '@rekog/mcp-nest';
import { Module } from '@nestjs/common';
@Module({
imports: [
McpModule.forRoot({
name: 'my-mcp-server',
version: '1.0.0',
}),
],
})
export class AppModule {}Decorate a service method as an MCP Tool
Use the @Tool decorator on any NestJS injectable service method. Define input parameters with a zod schema. The method is automatically registered and callable by MCP clients.
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 personalized greeting',
parameters: z.object({
name: z.string().default('World'),
}),
})
async sayHello({ name }: { name: string }, context: Context) {
await context.reportProgress({ progress: 50, total: 100 });
return `Hello, ${name}!`;
}
}Register your tool class as a NestJS provider
Add the tool class to the providers array of the module where it is defined. NestJS will inject it and mcp-nest will discover it automatically.
import { Module } from '@nestjs/common';
import { GreetingTool } from './greeting.tool';
@Module({
providers: [GreetingTool],
})
export class GreetingModule {}Start your NestJS application
Start the application normally. The MCP server is embedded and serves requests over HTTP+SSE or Streamable HTTP on the same port as your NestJS application.
npm run start:devConfigure your MCP client to connect
Point your MCP client at the running NestJS server. The SSE endpoint is available at /mcp/sse by default.
{
"mcpServers": {
"my-nestjs-mcp": {
"url": "http://localhost:3000/mcp/sse"
}
}
}NestJS MCP Server Module Examples
Client configuration
MCP client configuration for connecting to a NestJS application running with @rekog/mcp-nest. The server is embedded in the NestJS app and served over SSE.
{
"mcpServers": {
"nestjs-mcp-server-module": {
"url": "http://localhost:3000/mcp/sse"
}
}
}Prompts to try
Example prompts to use when your NestJS service is connected as an MCP server in Claude Desktop.
- "Call the greeting-tool with name set to Alice"
- "List all available tools from the NestJS MCP server"
- "Use the database query tool to find all users created this week"
- "Call the product search tool and return items matching 'headphones'"
- "Execute the report-generation tool for the Q4 2024 period"Troubleshooting NestJS MCP Server Module
Tools are not discovered by the MCP client after decorating with @Tool
Ensure the class containing the @Tool decorator is added to the providers array of a NestJS module, and that module is imported into your AppModule. Without being registered as a provider, mcp-nest cannot discover the decorated methods.
zod validation errors when calling tools
The parameters schema must be a zod object schema (z.object(...)). If you see validation errors, check that the input types match what is defined in the schema. Upgrade zod to a version compatible with the constraint zod@^4 as specified in the peer dependencies.
SSE connection drops or tools return timeout errors
SSE connections are long-lived. Ensure your reverse proxy or load balancer (nginx, ALB, etc.) is configured to allow long-lived HTTP connections and has appropriate timeout settings. Set proxy_read_timeout 3600s in nginx for SSE endpoints.
Frequently Asked Questions about NestJS MCP Server Module
What is NestJS MCP Server Module?
NestJS MCP Server Module is a Model Context Protocol (MCP) server that nestjs module that allows services to be exposed as an mcp server with server-sent events transport, facilitating tool discovery and execution by clients. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install NestJS MCP Server Module?
Install via npm with the command: npx -y @rekog/mcp-nest. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with NestJS MCP Server Module?
NestJS MCP Server Module works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is NestJS MCP Server Module free to use?
Yes, NestJS MCP Server Module is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
NestJS MCP Server Module Alternatives — Similar Developer Tools Servers
Looking for alternatives to NestJS MCP Server Module? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up NestJS MCP Server Module in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use NestJS MCP Server Module?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.