NestJS MCP Server Module

v1.9.9Developer Toolsstable

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.

llmllmsmcpmcp-nestmodel-context-protocol
Share:
650
Stars
0
Downloads
0
Weekly
0/5

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

Expose services as MCP with NestJS
Server-Sent Events transport
Tool discovery and execution
rekog-labs

Maintainer

LicenseMIT License
Languagetypescript
Versionv1.9.9
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @rekog/mcp-nest

Manual Installation

npx -y @rekog/mcp-nest

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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@^4
2

Import 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 {}
3

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}!`;
  }
}
4

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 {}
5

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:dev
6

Configure 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.

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.

Quick Config Preview

{ "mcpServers": { "nestjs-mcp-server-module": { "command": "npx", "args": ["-y", "@rekog/mcp-nest"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides