decorator-based tool exposure with automatic mcp registration
Exposes NestJS service methods as MCP tools using @Tool() decorators that trigger metadata reflection at module initialization. McpRegistryDiscoveryService scans decorated methods, extracts parameter schemas via Zod validation, and auto-registers them in McpRegistryService without manual endpoint configuration. This integrates directly with NestJS dependency injection, allowing tools to access injected services, database connections, and application state.
Unique: Uses NestJS metadata reflection system combined with Zod schema validation to automatically discover and register tools at module initialization time, eliminating manual MCP server scaffolding while maintaining full access to the NestJS DI container and service ecosystem.
vs alternatives: Faster to implement than manual MCP server setup because it reuses existing NestJS service code and decorators; more type-safe than generic function-calling frameworks because Zod schemas are validated at registration time, not runtime.
multi-transport mcp server with http+sse, streamable http, and stdio support
Provides three transport mechanisms for MCP protocol communication: HTTP+SSE for web clients with real-time streaming, Streamable HTTP for stateless deployments, and STDIO for CLI/desktop applications. The transport layer abstracts the underlying @modelcontextprotocol/sdk server, routing all capability requests through McpExecutorService regardless of transport. Configuration is declarative via McpModule.forRoot(), allowing runtime selection of transports without code changes.
Unique: Abstracts three distinct transport mechanisms behind a unified McpModule configuration, allowing developers to switch transports declaratively without changing tool/resource/prompt implementations. The transport layer is decoupled from capability execution via McpExecutorService, enabling transport-agnostic capability definitions.
vs alternatives: More flexible than single-transport MCP implementations because it supports web (HTTP+SSE), serverless (Streamable HTTP), and CLI (STDIO) clients from one codebase; simpler than building separate MCP servers per transport because configuration is centralized in McpModule.
metadata reflection-based capability discovery at module initialization
Scans NestJS services and controllers at module initialization time using TypeScript metadata reflection to discover @Tool(), @Resource(), and @Prompt() decorators. McpRegistryDiscoveryService extracts decorator metadata (name, description, schema) and registers capabilities in McpRegistryService without manual configuration. This enables zero-configuration capability exposure where decorators are the only required code.
Unique: Uses TypeScript metadata reflection to automatically discover and register capabilities at module initialization, eliminating manual registration code. Discovery is integrated into NestJS module lifecycle, ensuring capabilities are available before the application starts accepting requests.
vs alternatives: Simpler than manual registration because decorators are the only required code; more maintainable than configuration files because capability definitions stay colocated with implementation.
stateful vs stateless execution mode for tool handlers
Supports both stateful (persistent context across invocations) and stateless (isolated execution per request) modes for tool handlers. Stateful mode maintains handler state in memory between tool calls, enabling tools to access previous results or maintain session context. Stateless mode executes each tool invocation in isolation, suitable for serverless/FaaS deployments. Mode is configured per McpModule, affecting all tools in that server instance.
Unique: Provides configurable execution modes (stateful vs stateless) at the McpModule level, allowing developers to choose between session context and serverless compatibility without changing tool code. Mode selection affects all tools in the server instance.
vs alternatives: More flexible than stateless-only frameworks because stateful mode enables session context; more suitable for serverless than stateful-only systems because stateless mode is explicitly supported.
platform abstraction supporting express and fastify
Abstracts the underlying HTTP platform (Express or Fastify) via NestJS platform adapters, allowing MCP-Nest to work with either framework without code changes. Transport layer is platform-agnostic, routing requests through the selected adapter. Configuration specifies the platform via @nestjs/platform-express or @nestjs/platform-fastify, enabling deployment flexibility without tool/resource/prompt modifications.
Unique: Leverages NestJS platform abstraction to support both Express and Fastify without duplicating transport or capability code. Platform selection is a single configuration point, enabling framework flexibility without tool/resource/prompt changes.
vs alternatives: More flexible than framework-specific MCP implementations because either Express or Fastify can be used; more maintainable than dual implementations because code is shared across platforms.
dynamic capability registration at runtime via mcpregistryservice
Allows registration of tools, resources, and prompts after module initialization via McpRegistryService.register() API, enabling capabilities to be added/removed without server restart. Registered capabilities are stored in an in-memory registry and immediately available to MCP clients. This complements decorator-based discovery, supporting use cases like plugin systems, feature flags, or data-driven capability generation. The registry maintains isolation between multiple McpModule instances in the same application.
Unique: Provides a service-based API for runtime capability registration that integrates with NestJS dependency injection, allowing capabilities to be registered from any service/controller with access to McpRegistryService. Maintains separate registries per McpModule instance, enabling multi-server isolation in monolithic applications.
vs alternatives: More flexible than decorator-only approaches because capabilities can be added after module initialization; simpler than building a separate plugin loader because it reuses the same registry and execution pipeline as decorator-based tools.
per-tool authorization with guards, scopes, and role-based access control
Implements fine-grained access control at the tool level using NestJS guards (@ToolGuards()), scope decorators (@ToolScopes()), and role decorators (@ToolRoles()). Authorization is evaluated before tool execution via McpExecutorService, with context passed from the MCP client (JWT tokens, OAuth credentials). Supports both global guards applied to all tools and per-tool overrides. Integrates with the optional McpAuthModule for OAuth 2.0 token validation and JWT verification.
Unique: Integrates NestJS guard pattern with MCP tool execution, allowing developers to reuse existing NestJS authorization logic (guards, decorators) for MCP tools without reimplementation. Supports both global and per-tool authorization policies with declarative decorator syntax matching NestJS conventions.
vs alternatives: More integrated than generic MCP authorization because it leverages NestJS guards and dependency injection; more flexible than role-only systems because it supports custom guard logic and scope-based access control.
resource exposure with dynamic uri patterns and content streaming
Exposes backend resources (files, database records, API responses) as MCP resources using @Resource() decorators with URI pattern matching. Resources support dynamic content generation via handler functions and streaming large payloads via context.reportProgress(). The resource registry maintains a mapping of URI patterns to handlers, allowing clients to discover available resources and request specific ones by URI. Supports both static resources (fixed URIs) and parameterized resources (URI templates with variables).
Unique: Uses URI pattern matching to expose resources with dynamic content generation, allowing a single resource handler to serve multiple URIs via parameterized patterns. Integrates with context.reportProgress() for streaming large payloads, enabling memory-efficient delivery of large datasets.
vs alternatives: More flexible than static resource lists because URI patterns support parameterized content; more efficient than loading entire datasets into memory because streaming is built-in via context.reportProgress().
+5 more capabilities