MCP.so
登录

NestJS MCP Module

@bamada

关于 NestJS MCP Module

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

基本信息

分类

其他

许可证

MIT license

运行时

node

传输方式

stdio

发布者

bamada

配置

暂无标准配置

该服务器的 README 中没有可解析的 MCP 配置块,请前往代码仓库查看安装说明。

代码仓库

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

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.

FAQ from NestJS MCP Module

What peer dependencies are required?

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

How do I configure the transport type?

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

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.

What endpoints are exposed for HTTP/SSE transport?

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

What decorators are available for defining MCP capabilities?

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

评论

其他 分类下的更多 MCP 服务器