UNPKG

@mseep/supabase-mcp

Version:

MCP server for Supabase CRUD operations

121 lines 5.16 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.mcpManifest = exports.mcpConfig = exports.supabaseConfig = void 0; exports.validateConfig = validateConfig; const dotenv_1 = __importDefault(require("dotenv")); // Load environment variables dotenv_1.default.config(); // Supabase configuration exports.supabaseConfig = { url: process.env.SUPABASE_URL || '', anonKey: process.env.SUPABASE_ANON_KEY || '', serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY || '', }; // MCP server configuration exports.mcpConfig = { port: parseInt(process.env.MCP_SERVER_PORT || '3000', 10), host: process.env.MCP_SERVER_HOST || 'localhost', apiKey: process.env.MCP_API_KEY || '', }; // Validate required configuration function validateConfig() { const missingEnvVars = []; if (!exports.supabaseConfig.url) missingEnvVars.push('SUPABASE_URL'); if (!exports.supabaseConfig.anonKey) missingEnvVars.push('SUPABASE_ANON_KEY'); if (!exports.supabaseConfig.serviceRoleKey) missingEnvVars.push('SUPABASE_SERVICE_ROLE_KEY'); if (!exports.mcpConfig.apiKey) missingEnvVars.push('MCP_API_KEY'); if (missingEnvVars.length > 0) { throw new Error(`Missing required environment variables: ${missingEnvVars.join(', ')}`); } } // MCP manifest configuration (used in the /.well-known/mcp-manifest route) exports.mcpManifest = { schema_version: "1.0", human_description: "Supabase MCP server for performing CRUD operations on Postgres tables", models: ["claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307"], display_name: "Supabase Database", contact_email: "your-email@example.com", logo_url: null, capabilities: [ { name: "supabase", description: "Perform CRUD operations on Supabase Postgres tables", authentication: { type: "api_key", instructions: "Set the MCP_API_KEY environment variable in the .env file" }, tools: [ { name: "queryDatabase", description: "Query data from a Postgres table with filters", parameters: { type: "object", properties: { table: { type: "string", description: "Name of the table to query" }, select: { type: "string", description: "Comma-separated list of columns to select (default: *)" }, query: { type: "object", description: "Filter conditions" } }, required: ["table"] } }, { name: "insertData", description: "Insert data into a Postgres table", parameters: { type: "object", properties: { table: { type: "string", description: "Name of the table" }, data: { type: "object", description: "Data to insert as key-value pairs or array of objects" } }, required: ["table", "data"] } }, { name: "updateData", description: "Update data in a Postgres table", parameters: { type: "object", properties: { table: { type: "string", description: "Name of the table" }, data: { type: "object", description: "Data to update as key-value pairs" }, query: { type: "object", description: "Filter conditions for the update" } }, required: ["table", "data", "query"] } }, { name: "deleteData", description: "Delete data from a Postgres table", parameters: { type: "object", properties: { table: { type: "string", description: "Name of the table" }, query: { type: "object", description: "Filter conditions for deletion" } }, required: ["table", "query"] } }, { name: "listTables", description: "Get a list of available tables in the database", parameters: { type: "object", properties: {} } } ], is_default: true } ] }; //# sourceMappingURL=config.js.map