| import { Request, Response } from 'express'; | |
| import config from '../config/index.js'; | |
| /** | |
| * Get runtime configuration for frontend | |
| */ | |
| export const getRuntimeConfig = (req: Request, res: Response): void => { | |
| try { | |
| const runtimeConfig = { | |
| basePath: config.basePath, | |
| version: config.mcpHubVersion, | |
| name: config.mcpHubName, | |
| }; | |
| res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); | |
| res.setHeader('Pragma', 'no-cache'); | |
| res.setHeader('Expires', '0'); | |
| res.json({ | |
| success: true, | |
| data: runtimeConfig, | |
| }); | |
| } catch (error) { | |
| console.error('Error getting runtime config:', error); | |
| res.status(500).json({ | |
| success: false, | |
| message: 'Failed to get runtime configuration', | |
| }); | |
| } | |
| }; | |