1. Conduid
  2. AI
  3. Nestjs MCP
MCP server · AI

Nestjs MCP

An opinionated MCP module for NestJS

Unclaimed last commit 10 months ago zodmcpsseaimodelcontextprotocolnestjs
51Fair

Scored yesterday · breakdown

About Nestjs MCP

Nestjs MCP is an MCP server published by orbit-codes in the AI category: an opinionated MCP module for NestJS. It has been installed 0 times through Conduid.

The repository has 12 stars and 1 forks, with the last commit 10 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues (0) before depending on it in production.

Install

Install
npx nestjs-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

Ask AI about Nestjs MCP

Powered by Claude · Grounded in docs

I know everything about Nestjs MCP. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

Releases

v1.1.1v1.1.1
v1.1.0v1.1.0
v1.0.18v1.0.18
v1.0.17v1.0.17

README

NestJS MCP Package

A NestJS integration for the Model Context Protocol (MCP), allowing you to easily create MCP servers with NestJS's dependency injection and decorator-based architecture.

Installation

npm i @orbit-codes/nestjs-mcp @modelcontextprotocol/sdk zod

Features

  • 🚀 Seamless integration with NestJS using decorators
  • 🛠️ Expose MCP resources, tools, and prompts with simple annotations
  • 🔄 Support for both HTTP/SSE and stdio transports
  • 📦 Compatible with both ESM and CommonJS
  • 🧩 Dynamic module configuration
  • ✅ Well-tested and production-ready

Quick Start

Register the Module

import { Module } from '@nestjs/common';
import { MCPModule } from '@orbit-codes/nestjs-mcp';

@Module({
  imports: [
    MCPModule.register({
      name: 'MyMCPServer',
      version: '1.0.0',
      // Optional configuration
      sseEndpoint: '/mcp/sse',
      messagesEndpoint: '/mcp/messages',
      globalApiPrefix: '/api',
      capabilities: {
        // Your server capabilities
      },
    }),
  ],
})
export class AppModule {}

Create Resources

import { Injectable } from '@nestjs/common';
import { Resource } from '@orbit-codes/nestjs-mcp';

@Injectable()
export class UsersService {
  private users = [
    { id: '1', name: 'John Doe', email: 'john@example.com' },
    { id: '2', name: 'Jane Smith', email: 'jane@example.com' },
  ];

  @Resource({
    name: 'users',
    description: 'Access user information',
    parameters: {
      id: 'string',
    },
  })
  async getUser(uri, params) {
    const { id } = params;
    const user = this.users.find(u => u.id === id);
    
    if (!user) {
      throw new Error(`User with ID ${id} not found`);
    }
    
    return {
      uri: uri.href,
      text: JSON.stringify(user),
    };
  }
}

Create Tools

import { Injectable } from '@nestjs/common';
import { Tool } from '@orbit-codes/nestjs-mcp';

@Injectable()
export class CalculatorService {
  @Tool({
    name: 'add',
    description: 'Add two numbers together',
    parameters: {
      a: 'number',
      b: 'number',
    },
  })
  async add(params) {
    const { a, b } = params;
    const result = a + b;
    return result.toString();
  }
}

Create Prompts

import { Injectable } from '@nestjs/common';
import { Prompt } from '@orbit-codes/nestjs-mcp';

@Injectable()
export class PromptService {
  @Prompt({
    name: 'greeting',
    description: 'Generate a personalized greeting',
    template: 'Hello, {{name}}! Welcome to {{application}}.',
    parameters: {
      name: 'string',
      application: 'string',
    },
  })
  async greetingParameters(params) {
    // You can modify or add to the parameters here
    return {
      currentTime: new Date().toLocaleTimeString(),
    };
  }
}

Advanced Configuration

Async Configuration

You can also configure the MCP module asynchronously:

import { Module } from '@nestjs/common';
import { MCPModule } from '@orbit-codes/nestjs-mcp';
import { ConfigModule, ConfigService } from '@nestjs/config';

@Module({
  imports: [
    ConfigModule.forRoot(),
    MCPModule.registerAsync({
      imports: [ConfigModule],
      useFactory: (configService: ConfigService) => ({
        name: configService.get('MCP_SERVER_NAME'),
        version: configService.get('MCP_SERVER_VERSION'),
        sseEndpoint: configService.get('MCP_SSE_ENDPOINT', '/mcp/sse'),
        messagesEndpoint: configService.get('MCP_MESSAGES_ENDPOINT', '/mcp/messages'),
      }),
      inject: [ConfigService],
    }),
  ],
})
export class AppModule {}

API Reference

Decorators

@Resource(options)

Marks a method as an MCP resource handler.

  • name: The name of the resource
  • description: Description of the resource
  • parameters: Parameter schema definition

@Tool(options)

Marks a method as an MCP tool handler.

  • name: The name of the tool
  • description: Description of the tool
  • parameters: Parameter schema definition

@Prompt(options)

Marks a method as an MCP prompt handler.

  • name: The name of the prompt
  • description: Description of the prompt
  • template: The prompt template with placeholders
  • parameters: Parameter schema definition

Module Options

  • name: The name of the MCP server
  • version: The version of the MCP server
  • sseEndpoint: The endpoint for SSE (default: '/mcp/sse')
  • messagesEndpoint: The endpoint for messages (default: '/mcp/messages')
  • globalApiPrefix: Optional API prefix for all endpoints
  • capabilities: Optional capabilities object

Formatting and Linting

# Format the codebase
pnpm format

# Check formatting
pnpm format:check

# Lint the codebase
pnpm lint

# Run all checks
pnpm check

License

MIT

README mirrored from the source repository yesterday. The original is authoritative.

Questions

About Nestjs MCP

How do I install Nestjs MCP?

Run npx nestjs-mcp, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is Nestjs MCP safe to use with an AI agent?

Its trust score is 51 out of 100 (fair). It passes 0 of 1 static security checks; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Nestjs MCP still maintained?

The last commit was 10 months ago, with 0 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.