🚀 Supabase MCP Server - Deploy no Coolify
Este repositório contém a configuração completa para deploy do Supabase MCP Server no Coolify, permitindo que agentes de IA acessem e gerenciem projetos Supabase através do Model Context Protocol (MCP).
🌐 **Servidor Ativo**
URL do Servidor: http://hwg4ks4ooooc04wsosookoog.157.180.32.249.sslip.io/
📡 **Endpoints Disponíveis**
- Root:
GET /- Informações do servidor - Health:
GET /health- Verificação de saúde - Status:
GET /status- Status detalhado - Test:
GET /testePOST /test- Testes de conectividade - MCP:
POST /mcp- Endpoint principal para agentes de IA
🛠️ **Tools Disponíveis para Agentes de IA**
🗄️ **Database Tools**
`list_tables`
Lista todas as tabelas no banco de dados.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_tables",
"arguments": {
"schemas": ["public"]
}
}
}
`execute_sql`
Executa SQL raw no banco de dados.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "execute_sql",
"arguments": {
"query": "SELECT * FROM leads WHERE phone_number = '5511999999999'"
}
}
}
`apply_migration`
Aplica migrações DDL no banco.
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "apply_migration",
"arguments": {
"name": "create_new_table",
"query": "CREATE TABLE new_table (id SERIAL PRIMARY KEY, name VARCHAR(255))"
}
}
}
📊 **Gestão de Leads (Tabela: `leads`)**
Consultar Leads
-- Buscar lead por telefone
SELECT * FROM leads WHERE phone_number = '5511999999999';
-- Buscar leads por cidade
SELECT * FROM leads WHERE city = 'São Paulo';
-- Buscar leads qualificados
SELECT * FROM leads WHERE qualification_status = 'QUALIFIED';
Inserir/Atualizar Lead
-- Inserir novo lead
INSERT INTO leads (phone_number, name, city, state, client_type, additional_data)
VALUES ('5511999999999', 'João Silva', 'São Paulo', 'SP', 'RESIDENTIAL', '{"source": "whatsapp", "campaign": "energia"}');
-- Atualizar lead existente
UPDATE leads
SET name = 'João Silva Santos',
additional_data = additional_data || '{"last_contact": "2024-01-15"}'
WHERE phone_number = '5511999999999';
Campos da Tabela `leads`:
id(SERIAL PRIMARY KEY)phone_number(VARCHAR, UNIQUE)name(VARCHAR)city(VARCHAR)state(VARCHAR)invoice_amount(NUMERIC)client_type(VARCHAR)qualification_status(VARCHAR, DEFAULT 'NEW')conversation_state(VARCHAR, DEFAULT 'INITIAL')additional_data(JSONB, DEFAULT '{}')created_at(TIMESTAMP)updated_at(TIMESTAMP)
📸 **Gestão de Imagens (Tabelas: `energy_bills`, `image_metadata`)**
Tabela `energy_bills`:
id(SERIAL PRIMARY KEY)lead_id(INTEGER, FK para leads)phone(VARCHAR)image_path(VARCHAR)extracted_data(TEXT)created_at(TIMESTAMP)
Tabela `image_metadata`:
id(UUID PRIMARY KEY)wamid(TEXT, UNIQUE)sender_phone(TEXT)storage_path(TEXT)mime_type(TEXT, DEFAULT 'image/jpeg')file_size_kb(INTEGER)original_caption(TEXT)lead_id(INTEGER, FK para leads)processing_status(TEXT, DEFAULT 'completed')error_message(TEXT)created_at(TIMESTAMPTZ)
🔍 **Debug & Monitoring**
`get_logs`
Obtém logs do projeto Supabase.
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "get_logs",
"arguments": {
"service": "api"
}
}
}
`get_advisors`
Obtém avisos de segurança e performance.
{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "get_advisors",
"arguments": {
"type": "security"
}
}
}
📚 **Documentação**
`search_docs`
Busca na documentação Supabase.
{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "search_docs",
"arguments": {
"graphql_query": "query { searchDocs(query: \"authentication\", limit: 5) { nodes { title href content } } }"
}
}
}
⚡ **Edge Functions**
`list_edge_functions`
Lista todas as edge functions.
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "list_edge_functions",
"arguments": {}
}
}
`deploy_edge_function`
Deploy de nova edge function.
{
"jsonrpc": "2.0",
"id": 8,
"method": "tools/call",
"params": {
"name": "deploy_edge_function",
"arguments": {
"name": "process-lead",
"files": [
{
"name": "index.ts",
"content": "Deno.serve(async (req) => { return new Response('Hello from edge function!') })"
}
]
}
}
}
🗄️ **Storage**
`list_storage_buckets`
Lista buckets de storage.
{
"jsonrpc": "2.0",
"id": 9,
"method": "tools/call",
Tools 9
list_tablesLists all tables in the database.execute_sqlExecutes raw SQL queries on the database.apply_migrationApplies DDL migrations to the database.get_logsRetrieves project logs from Supabase services.get_advisorsRetrieves security and performance advisories.search_docsSearches the official Supabase documentation.list_edge_functionsLists all deployed edge functions.deploy_edge_functionDeploys a new edge function.list_storage_bucketsLists all storage buckets in the project.Environment Variables
SUPABASE_URLrequiredThe URL of your Supabase projectSUPABASE_SERVICE_KEYrequiredThe service role key for your Supabase project