Skip to main content
Glama

MCPDemo - Visual SQL Chat Platform

by Ayi456
staticRoutes.ts1.04 kB
import express from 'express'; import path from 'path'; import { fileURLToPath } from 'url'; export function setupStaticRoutes(app: express.Application) { const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // 静态文件服务 const staticRoot = process.env.STATIC_DIR || path.join(process.cwd(), 'web-dist'); const legacyStatic = path.join(__dirname, '..', '..', 'web', 'dist'); // Primary static root app.use(express.static(staticRoot)); // Legacy fallback if (staticRoot !== legacyStatic) { app.use(express.static(legacyStatic)); } // 前端路由 fallback - 所有非 API/MCP/Panel 的路由都返回 index.html app.get(/^(?!\/api|\/mcp|\/panel).*/, (req, res, next) => { const indexPath = path.join(staticRoot, 'index.html'); res.sendFile(indexPath, (err) => { if (err) { // fallback to legacy path res.sendFile(path.join(legacyStatic, 'index.html'), (err2) => { if (err2) next(err2); }); } }); }); }

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/Ayi456/visual-mcp'

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