Skip to main content
Glama

MCP Server NestJS

by Cstannahill
main.ts1.06 kB
// main.ts import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { ValidationPipe } from '@nestjs/common'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; async function bootstrap() { const app = await NestFactory.create(AppModule); // Enable validation app.useGlobalPipes( new ValidationPipe({ whitelist: true, // Remove non-whitelisted properties forbidNonWhitelisted: true, // Throw errors if non-whitelisted properties are present transform: true, // Automatically transform payloads to DTO instances forbidUnknownValues: true, // Prevent unknown values (security best practice) }), ); // Swagger setup const config = new DocumentBuilder() .setTitle('MCP Server API') .setDescription('API documentation for the NestJS MCP Server') .setVersion('1.0') .addBearerAuth() .build(); const document = SwaggerModule.createDocument(app, config); SwaggerModule.setup('api', app, document); await app.listen(3000); } void bootstrap();

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cstannahill/mcp-server-nestjs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server