MCP.so
Sign In

NestJS MCP Module

@bamada

Basic information

Category

Other

License

MIT license

Transports

stdio

Author

bamada

About NestJS MCP Module

NestJS module for seamless Model Context Protocol (MCP) server integration using decorators.

NestJS MCP Module config

No standard config provided

This server doesn't expose a parseable MCP config block in its README. See the repository for install instructions.

Repository

NestJS MCP Module tools

Tool list not available yet

This listing does not currently have a tool list to display. This does not mean the server has no tools; check its documentation for supported capabilities.

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is NestJS MCP Module?

A NestJS module that simplifies building Model Context Protocol (MCP) servers. It exposes resources, tools, and prompts using familiar NestJS decorators and supports STDIO and HTTP/SSE transport.

How to use NestJS MCP Module?

Install the package and its peer dependencies, then import McpModule into your root module via forRoot or forRootAsync. Define MCP capabilities by decorating provider methods with @McpResource, @McpTool, or @McpPrompt. Configure the transport type (STDIO or SSE) and run your application. For STDIO, replace the NestJS logger with the included StderrLogger.

Key features of NestJS MCP Module

  • Seamless MCP integration using NestJS method decorators.
  • Automatic discovery of decorated providers.
  • Supports STDIO and HTTP/SSE transport.
  • Uses Zod schemas for tool and prompt argument validation.
  • Configurable via forRoot and forRootAsync patterns.
  • Includes StderrLogger for STDIO transport compatibility.

Use cases of NestJS MCP Module

  • Building CLI-based MCP servers using STDIO transport.
  • Exposing MCP endpoints over HTTP/SSE for web clients.
  • Defining typed MCP tools with parameter validation.
  • Providing static and template MCP resources.
  • Creating MCP prompt templates for LLM interactions.

Frequently asked questions

1

What peer dependencies are required?

`@modelcontextprotocol/sdk` (^1.10.2), `@nestjs/platform-express` (^10 or ^11), and `zod` (^3.0.0) must be installed.

2

How do I configure the transport type?

Pass `transport` in `McpModule.forRoot(options)`. Choose `TransportType.STDIO`, `TransportType.SSE`, or `TransportType.NONE`.

3

How do I handle logging for STDIO transport?

Replace the NestJS logger with the `StderrLogger` class provided by the module to prevent logs from interfering with STDIO MCP communication.

4

What endpoints are exposed for HTTP/SSE transport?

The `McpHttpController` exposes `/api/mcp/sse` for SSE connections and `/api/mcp/messages` for message exchange.

5

What decorators are available for defining MCP capabilities?

`@McpResource`, `@McpTool`, and `@McpPrompt` for resources, tools, and prompts respectively.

Comments

More Other MCP servers