MCP Server (FastAPI + Supabase + n8n)
Estructura
main.py
: App FastAPI y healthcheck/healthz
.app/mcp/server.py
: Endpoint/mcp
JSON-RPC 2.0 (tools/list
,tools/call
).app/integrations/supabase.py
: Operaciones DB/Storage/Vector.app/integrations/n8n.py
: Invocación de webhooks n8n.app/security/auth.py
: API tokens por cabecerax-api-key
.app/config.py
: Carga de variables de entorno.migrations/001_init.sql
: Esquema Supabase (session_state, tool_audit, vector_store, RPCmatch_vectors
).tools.schema.json
: Definiciones de herramientas MCP.
Variables de entorno
Copiar .env.example
a .env
en local o configurar en Railway.
SUPABASE_URL
: URL del proyecto Supabase.SUPABASE_SERVICE_ROLE_KEY
: clave service role (solo backend).SUPABASE_ANON_KEY
: opcional.N8N_WEBHOOK_BASE
: base de webhooks públicos de n8n, ej:https://n8n.tu-dominio.com/webhook
.MCP_API_TOKENS
: CSV de tokens válidos, ej:token1,token2
.ALLOW_ORIGINS
: lista CORS, ej:https://mi-host-agente.com
.
Desarrollo local (Windows PowerShell)
Probar:
GET http://localhost:8000/healthz
POST http://localhost:8000/mcp
con headerx-api-key: dev-token
y body:
Despliegue en Railway
- Añadir servicio Dockerfile.
- Variables de entorno:
SUPABASE_URL
,SUPABASE_SERVICE_ROLE_KEY
,N8N_WEBHOOK_BASE
,MCP_API_TOKENS
,ALLOW_ORIGINS
. - Comando inicio:
uvicorn main:app --host 0.0.0.0 --port $PORT --proxy-headers
. - Healthcheck:
/healthz
. - Escalado horizontal: habilitar auto-scale; la app es stateless.
Migraciones Supabase
Ejecutar migrations/001_init.sql
en el SQL Editor de Supabase.
Seguridad
- Mantener Service Role solo en backend.
- Rotar
MCP_API_TOKENS
periódicamente. - Opcional: firmar requests con HMAC y timestamp para antireplay.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables interaction with Supabase databases and n8n workflows through a JSON-RPC 2.0 MCP server. Provides database operations, vector search capabilities, and webhook-based workflow automation with secure API token authentication.
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server that provides tools for interacting with Supabase databases, storage, and edge functions.Last updated -1443JavaScriptMIT License
- AsecurityAlicenseAqualityThis server enables interaction with Supabase PostgreSQL databases through the MCP protocol, allowing seamless integration with Cursor and Windsurf IDEs for secure and validated database management.Last updated -11784PythonApache 2.0
- -securityAlicense-qualityAn MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.Last updated -1JavaScriptMIT License
- AsecurityAlicenseAquality🪄 MCP server for programmatic creation and management of n8n workflows. Enables AI assistants to build, modify, and manage workflows without direct user intervention through a comprehensive set of tools and resources for interacting with n8n's REST API.Last updated -101462TypeScriptMIT License