Skip to main content
Glama

Timezone MCP Server

by sam-artuso
main.test-helper.tsβ€’2.35 kB
import { NestFactory } from '@nestjs/core' import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger' import { AppModule } from './app/app.module' /** * Bootstrap function exported for testing purposes * This is the same logic as in main.ts but exported for unit tests */ export async function bootstrap() { const isStdioMode = process.env.MCP_TRANSPORT === 'stdio' // Default to development if NODE_ENV is not set const nodeEnv = process.env.NODE_ENV || 'development' const isDevelopment = nodeEnv === 'development' if (isStdioMode) { // STDIO mode: no HTTP server, no logging to stdout await NestFactory.createApplicationContext(AppModule, { logger: false, // Disable all logging to keep stdout clean for JSON-RPC }) } else { // HTTP mode: web server with optional Swagger docs (development only) const app = await NestFactory.create(AppModule) const port = parseInt(process.env.PORT || '3000', 10) // Swagger/OpenAPI configuration (development only) // In production, only MCP endpoints are available (authenticated via @rekog/mcp-nest) // In development, REST API is also available (unauthenticated for easy testing) if (isDevelopment) { const config = new DocumentBuilder() .setTitle('Timezone MCP Server API - Development') .setDescription( 'MCP (Model Context Protocol) server for timezone operations. ' + '\n\n**Development Mode**: This REST API is only available when NODE_ENV=development. ' + 'It provides unauthenticated endpoints for testing and development. ' + '\n\n**Production Mode**: Only the MCP endpoint at /mcp is available, protected by OAuth authentication. ' + '\n\nProvides endpoints to get available regions, cities, and current time in any timezone with ISO 8601 formatted timestamps.', ) .setVersion('1.0') // Empty string = relative to current domain (works locally and in production) .addServer('', 'Current server') .addTag('health', 'Health check endpoints') .addTag('timezones', 'Timezone information endpoints (development only)') .build() const documentFactory = () => SwaggerModule.createDocument(app, config) SwaggerModule.setup('api', app, documentFactory) } await app.listen(port) } }

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/sam-artuso/demo-mcp'

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