JUHE API Marketplace
rekog-labs avatar
MCP Server

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.

512
GitHub Stars
11/22/2025
Last Updated
No Configuration
Please check the documentation below.
  1. Home
  2. MCP Servers
  3. MCP-Nest

README Documentation

NestJS MCP Server Module

CI Code Coverage NPM Version NPM Downloads NPM License

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.

Features

  • 🚀 Multi-Transport Support: HTTP+SSE, Streamable HTTP, and STDIO
  • 🔧 Tools: Expose NestJS methods as MCP tools with automatic discovery and Zod validation
    • 🛠️ Elicitation: Interactive tool calls with user input elicitation
    • 📊 Progress Notifications: Real-time progress updates for long-running operations
    • 🌐 HTTP Request Access: Full access to request context within MCP handlers
  • 📁 Resources: Serve content and data through MCP resource system
  • 📚 Resource Templates: Dynamic resources with parameterized URIs
  • 💬 Prompts: Define reusable prompt templates for AI interactions
  • 🔐 Guard-based Authentication: Guard-based security with OAuth support
  • 🏠 Built-in Authorization Server — Using the built-in Authorization Server for easy setups. (Beta)
  • 🌐 External Authorization Server — Securing your MCP server with an external authorization server (Keycloak, Auth0, etc).
  • 💉 Dependency Injection: Leverage NestJS DI system throughout MCP components

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

Installation

npm install @rekog/mcp-nest @modelcontextprotocol/sdk zod@^3

Optional dependencies

If you use the built-in authorization server with the TypeORM store, install the following optional peer dependencies:

npm install @nestjs/typeorm typeorm

Quick Start

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

Documentation

  • Tools Guide - Define and expose NestJS methods as MCP tools
  • Resources Guide - Serve static and dynamic content
  • Resource Templates Guide - Create parameterized resources
  • Prompts Guide - Build reusable prompt templates
  • Built-in Authorization Server - Secure your MCP server with built-in OAuth
  • External Authorization Server - Securing your MCP server with an external authorization server (Keycloak, Auth0, etc)
  • Server examples - MCP servers examples (Streamable HTTP, HTTP, and STDIO) and with Fastify support

Playground

The playground directory contains working examples for all features. Refer to playground/README.md for details.

Quick Actions

View on GitHubView All Servers

Key Features

Model Context Protocol
Secure Communication
Real-time Updates
Open Source

Boost your projects with Wisdom Gate LLM API

Supporting GPT-5, Claude-4, DeepSeek v3, Gemini and more.

Enjoy a free trial and save 20%+ compared to official pricing.

Learn More
JUHE API Marketplace

Accelerate development, innovate faster, and transform your business with our comprehensive API ecosystem.

JUHE API VS

  • vs. RapidAPI
  • vs. API Layer
  • API Platforms 2025
  • API Marketplaces 2025
  • Best Alternatives to RapidAPI

For Developers

  • Console
  • Collections
  • Documentation
  • MCP Servers
  • Free APIs
  • Temp Mail Demo

Product

  • Browse APIs
  • Suggest an API
  • Wisdom Gate LLM
  • Global SMS Messaging
  • Temp Mail API

Company

  • What's New
  • Welcome
  • About Us
  • Contact Support
  • Terms of Service
  • Privacy Policy
Featured on Startup FameFeatured on Twelve ToolsFazier badgeJuheAPI Marketplace - Connect smarter, beyond APIs | Product Huntai tools code.marketDang.ai
Copyright © 2025 - All rights reserved