feat(mcp): add MCP endpoint; fix TODOs (pkg.json name/version, NestJS Logger)
This commit is contained in:
+11
-8
@@ -1,31 +1,34 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { Logger, ValidationPipe } from '@nestjs/common';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { AppModule } from './app.module';
|
||||
import { name as pkgName, version as pkgVersion } from '../package.json';
|
||||
|
||||
async function bootstrap() {
|
||||
const logger = new Logger('Bootstrap');
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
app.useGlobalPipes(new ValidationPipe({ transform: true }));
|
||||
|
||||
const config = app.get(ConfigService);
|
||||
const port = config.get<number>('PORT', 3000);
|
||||
const appName = config.get<string>('APP_NAME', 'liquio-qa-bot');
|
||||
const appVersion = config.get<string>('APP_VERSION', '1.0.0');
|
||||
const nodeEnv = config.get<string>('NODE_ENV', 'development');
|
||||
|
||||
const swaggerConfig = new DocumentBuilder()
|
||||
.setTitle(appName)
|
||||
.setDescription(`${appName} API`)
|
||||
.setVersion(appVersion)
|
||||
.setTitle(pkgName)
|
||||
.setDescription(`${pkgName} API`)
|
||||
.setVersion(pkgVersion)
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app, swaggerConfig);
|
||||
SwaggerModule.setup('api', app, document);
|
||||
|
||||
await app.listen(port);
|
||||
console.log(`Application running on port ${port}`);
|
||||
console.log(`Swagger UI available at http://localhost:${port}/api`);
|
||||
|
||||
logger.log(`Application "${pkgName}" v${pkgVersion} running on port ${port} [${nodeEnv}]`);
|
||||
logger.log(`Swagger UI available at http://localhost:${port}/api`);
|
||||
logger.log(`MCP endpoint available at http://localhost:${port}/mcp`);
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user