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.

コメント

「その他」の他のコンテンツ