Skip to main content
Glama

Supabase MCP Server

by Cappahccino
server.ts1.38 kB
import express, { Request, Response, NextFunction } from 'express'; import cors from 'cors'; import bodyParser from 'body-parser'; import { handleManifest, validateApiKey, handleHealthCheck, handleDatabaseOperation, handleListTables, handleJsonRpc } from './handlers/index.js'; export function createServer() { const app = express(); // Middleware app.use(cors()); app.use(bodyParser.json()); // Skip API key validation for manifest endpoint app.use((req: Request, res: Response, next: NextFunction) => { if (req.path === '/.well-known/mcp-manifest' || req.path === '/mcp') { return next(); } validateApiKey(req, res, next); }); // MCP required endpoints app.get('/.well-known/mcp-manifest', handleManifest); // MCP JSON-RPC endpoint app.post('/mcp', handleJsonRpc); // Health check app.get('/health', handleHealthCheck); // Database operations app.post('/database/:operation', handleDatabaseOperation); app.get('/database/tables', handleListTables); // 404 handler app.use((req: Request, res: Response) => { res.status(404).json({ error: 'Not found' }); }); // Error handler app.use((err: Error, req: Request, res: Response, next: NextFunction) => { console.error('Server error:', err); res.status(500).json({ error: `Server error: ${err.message}` }); }); return app; }

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/Cappahccino/SB-MCP'

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