- Home
- MCP servers
- NestJS
NestJS
- typescript
0
GitHub Stars
typescript
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You run an MCP server built with NestJS to enable streamlined interactions with MCP clients. This server demonstrates a clean, scalable structure that supports streaming HTTP MCP endpoints, strong type validation, and dependency-injected components, making it a practical base for building modular MCP features.
How to use
You interact with the MCP server through its MCP endpoint to perform available tools and metrics. Start the server and connect your MCP client to the provided endpoint. The server exposes a set of tools and services that handle time calculations, arithmetic, note management, and Four Keys (DORA) metrics, enabling you to observe time-related data, numeric results, and production performance indicators.
How to install
Install prerequisites and set up the project locally so you can run the MCP server and its tooling.
Configuration and startup
Configure and start the MCP server using the runtime command shown here. The server is configured for a Streamable HTTP MCP transport and exposes its endpoint at /mcp.
McpModule.forRoot({
name: 'nestjs-mcp-server',
version: '1.0.0',
transport: McpTransportType.STREAMABLE_HTTP,
mcpEndpoint: '/mcp',
})
Additional setup steps
To run and test locally, perform the following steps in sequence. These commands should be executed from your project root.
npm install
npm run build
npm start
When the server starts, you should see an output similar to:
š NestJS MCP Server running on http://localhost:3000
š” MCP Endpoint: http://localhost:3000/mcp
Project structure overview
The project is organized to separate concerns and support future expansion. Key parts include a module that wires services and tools, a services layer for business logic, and a tools layer that defines MCP endpoints with validation.
Examples of MCP module configuration
// src/mcp/mcp.module.ts
import { Module } from '@nestjs/common';
import { TimeService } from './services/time.service';
import { TimeTool } from './tools/time.tool';
@Module({
providers: [
TimeService,
TimeTool,
],
})
export class McpToolsModule {}
Security and testing notes
Plan to include proper environment configurations for real deployments, such as API keys or integration tokens if you add external services. Implement tests to verify MCP endpoints and tool behavior, and consider coverage targets for reliable releases.
Usage examples and endpoints
The server exposes tools for getting the current time, performing arithmetic operations, saving and retrieving notes, and computing Four Keys metrics. These tools are implemented as injectable services and are exposed through the MCP interface with type-checked parameters.
Available tools
get_current_time
Retrieves the current date and time as a formatted string
calculate
Performs arithmetic operations: add, subtract, multiply, divide
save_note
Saves a note with a given identifier and content
get_note
Retrieves a saved note by its identifier
list_notes
Lists all saved notes
get_deployment_frequency
Calculates deployment frequency from sources like GitHub releases and tags and classifies performance level (Elite/High/Medium/Low)
get_lead_time
Calculates lead time for changes from PR creation to merge, returning average, median, and 95th percentile
get_change_failure_rate
Calculates change failure rate from hotfixes, incidents, and workflow failures
get_mttr
Calculates mean time to restore from incident detection to resolution
get_four_keys_summary
Provides a consolidated summary of all Four Keys metrics