UNPKG

@mseep/supabase-mcp

Version:

MCP server for Supabase CRUD operations

47 lines 1.8 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleHealthCheck = exports.validateApiKey = exports.handleManifest = void 0; __exportStar(require("./database.js"), exports); __exportStar(require("./mcp-rpc.js"), exports); const config_js_1 = require("../config.js"); /** * Handle MCP manifest request * This is a required route for MCP protocol compliance */ const handleManifest = (req, res) => { res.status(200).json(config_js_1.mcpManifest); }; exports.handleManifest = handleManifest; /** * Handle API key validation */ const validateApiKey = (req, res, next) => { const apiKey = req.headers['x-api-key']; if (!apiKey || apiKey !== config_js_1.mcpConfig.apiKey) { return res.status(401).json({ error: 'Unauthorized: Invalid API key' }); } next(); }; exports.validateApiKey = validateApiKey; /** * Handle health check request */ const handleHealthCheck = (req, res) => { res.status(200).json({ status: 'ok', message: 'Supabase MCP server is running' }); }; exports.handleHealthCheck = handleHealthCheck; //# sourceMappingURL=index.js.map