MCP-Nest
MCP ServerFreeA NestJS module to effortlessly create Model Context Protocol (MCP) servers for exposing AI tools, resources, and prompts.
Capabilities13 decomposed
decorator-based tool exposure with automatic mcp registration
Medium confidenceExposes 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.
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.
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
Medium confidenceProvides 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.
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.
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
Medium confidenceScans 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.
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.
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
Medium confidenceSupports 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.
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.
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
Medium confidenceAbstracts 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.
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.
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
Medium confidenceAllows 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.
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.
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
Medium confidenceImplements 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.
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.
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
Medium confidenceExposes 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).
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.
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().
prompt template exposure with dynamic variable substitution
Medium confidenceExposes reusable prompt templates as MCP prompts using @Prompt() decorators, allowing AI clients to discover and instantiate prompts with dynamic variable substitution. Prompts are stored in the registry with metadata (name, description, arguments schema) and can be retrieved by clients for use in their own LLM calls. Supports parameterized prompts where variables are substituted at retrieval time, enabling context-aware prompt generation without hardcoding values.
Exposes prompts as first-class MCP capabilities alongside tools and resources, allowing centralized prompt management in the backend with dynamic variable substitution at retrieval time. Integrates with NestJS services, enabling prompts to access application state and databases for context-aware generation.
More maintainable than hardcoded prompts in client code because changes are centralized; more flexible than static prompt libraries because variables can be substituted dynamically based on application state.
progress reporting and streaming for long-running operations
Medium confidenceProvides context.reportProgress() API for tools and resources to send real-time updates to MCP clients during long-running operations. Progress updates are streamed via the transport layer (HTTP+SSE, Streamable HTTP, or STDIO) without blocking the main response. Supports both text updates and structured progress objects with percentage/status information. Enables AI agents to monitor operation status and adjust behavior based on progress feedback.
Integrates progress reporting directly into the tool/resource execution context via context.reportProgress(), allowing handlers to stream updates without managing transport details. Works across all three transport mechanisms (HTTP+SSE, Streamable HTTP, STDIO) with consistent API.
Simpler than polling-based progress tracking because updates are pushed to clients in real-time; more integrated than generic streaming solutions because progress API is built into the MCP execution context.
multi-server isolation with independent registries and configurations
Medium confidenceSupports multiple McpModule instances in a single NestJS application, each with independent registries, configurations, and transport settings. Servers are isolated via unique identifiers and maintain separate capability namespaces, allowing different capability sets to be exposed on different ports or transports. This enables advanced deployment patterns like multi-tenant servers, feature-gated capability exposure, or A/B testing different tool configurations without application restart.
Allows multiple McpModule instances with independent registries in a single NestJS application, enabling capability isolation without separate processes. Each server maintains its own registry, guards, and transport configuration, supporting advanced multi-tenant and feature-gated deployment patterns.
More efficient than running separate processes because servers share the same NestJS application context and resources; more flexible than single-server deployments because capability sets can be isolated per server without code duplication.
exception handling and custom error filtering for mcp responses
Medium confidenceProvides exception filters (NestJS pattern) for handling errors in tool/resource/prompt execution and converting them to MCP-compliant error responses. Filters can transform exceptions into user-friendly error messages, log errors for debugging, and prevent sensitive information leakage. Integrates with NestJS exception hierarchy, allowing developers to throw domain-specific exceptions that are automatically caught and formatted for MCP clients.
Leverages NestJS exception filter pattern to handle MCP tool/resource/prompt errors, allowing developers to reuse existing NestJS error handling logic without MCP-specific boilerplate. Filters are composable and can be applied globally or per-tool.
More integrated than generic error handlers because it uses NestJS patterns developers already know; more flexible than try-catch blocks because filters can be reused across multiple tools and composed hierarchically.
zod schema validation for tool inputs and outputs
Medium confidenceIntegrates Zod schema validation for type-safe tool input validation and output schema definition. Schemas are extracted from @Tool() decorators and used to validate incoming requests before handler execution. Output schemas document expected response types for MCP clients. Validation failures return structured error responses without invoking the tool handler, preventing invalid data from reaching business logic.
Uses Zod schemas as the single source of truth for both input validation and client documentation, eliminating duplication between validation logic and API documentation. Schemas are extracted at registration time, enabling early error detection.
More type-safe than string-based validation because Zod provides compile-time type checking; more flexible than JSON Schema because Zod supports custom validation logic and refinements.
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with MCP-Nest, ranked by overlap. Discovered automatically through the match graph.
@magneticwatermelon/mcp-toolkit
Build and ship **[Model Context Protocol](https://github.com/modelcontextprotocol)** (MCP) servers with zero-config ⚡️.
cyrus-mcp-tools
Runner-neutral MCP tool servers for Cyrus
@onivoro/server-mcp
A NestJS library for building transport-agnostic MCP tool services. Define tools once with decorators, consume them over HTTP, stdio, or directly via the registry. The documentation and examples generally focus one enterprise monorepos but can be easily a
example-remote-server
A hosted version of the Everything server - for demonstration and testing purposes, hosted at https://example-server.modelcontextprotocol.io/mcp
mcp-client
** MCP REST API and CLI client for interacting with MCP servers, supports OpenAI, Claude, Gemini, Ollama etc.
@suncreation/opencode-toolsearch
Multi-provider request patch, Anthropic OAuth bridge, and MCP tool discovery for OpenCode
Best For
- ✓NestJS backend developers building AI agent integrations
- ✓Teams migrating existing REST APIs to MCP protocol
- ✓Developers who want decorator-driven architecture matching NestJS conventions
- ✓Teams deploying MCP servers across multiple client types (web, desktop, CLI)
- ✓Serverless/FaaS deployments requiring stateless HTTP transports
- ✓Organizations with existing Express or Fastify infrastructure
- ✓Teams using NestJS with existing decorator-based architecture
- ✓Rapid development scenarios where minimizing boilerplate is critical
Known Limitations
- ⚠Decorators only work on NestJS service/controller methods — cannot expose arbitrary functions outside the DI container
- ⚠Metadata reflection adds ~5-10ms per module initialization for large codebases with 100+ decorated methods
- ⚠Zod schema inference from TypeScript types requires explicit schema definitions; implicit type inference not supported
- ⚠HTTP+SSE requires persistent connections; not suitable for strict request-response architectures
- ⚠Streamable HTTP adds latency for streaming responses due to chunked encoding overhead (~50-100ms per chunk)
- ⚠STDIO transport limited to single-process execution; no built-in clustering or load balancing
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
Repository Details
Last commit: Mar 29, 2026
About
A NestJS module to effortlessly create Model Context Protocol (MCP) servers for exposing AI tools, resources, and prompts.
Categories
Alternatives to MCP-Nest
Are you the builder of MCP-Nest?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →