Enables containerized deployment of the service, with support for both standalone Docker and Docker Compose configurations.
Integrates with GitHub for version control and automated deployment through Railway, detecting repository changes for continuous deployment.
Generates vector embeddings using OpenAI's embedding models to create searchable vectors from project data that are stored in Supabase.
Provides deployment configuration for hosting the service on Railway's platform, with built-in monitoring through health check endpoints.
Synchronizes vector embeddings between Supabase tables, monitoring changes in the 'proyectos' table and updating the 'proyecto_vector' table with vector embeddings for efficient multi-tenant search capabilities.
MCP Vector Sync
MCP service for automatic synchronization of multi-tenant search vectors with Supabase using a 100% event-based system.
Description
This service receives real-time notifications from Supabase when there are changes to the proyectos
table, generates vector embeddings using OpenAI, and updates the proyecto_vector
table while maintaining efficient vector lookup for each tenant. It implements the Model Context Protocol (MCP) to expose synchronization tools and resources.
Characteristics
100% event-based system (direct webhooks from Supabase)
Generating embeddings with OpenAI
Immediate processing of project changes
Automatic retry system with exponential backoff
Audit log for debugging and monitoring
Multi-tenant synchronization with complete data isolation
Exhibition of MCP tools for control and monitoring
Health check server for monitoring
Containerized with Docker for easy deployment
Compatible with Railway for production deployment
Event architecture
The system uses a completely event-driven architecture:
Trigger in Supabase : When a project is created or modified, a trigger sends a webhook directly to the service
Controlled delay processing : For new inserts, a 20-second delay is applied to avoid race conditions.
Automatic retries : In case of failures, the system retries up to 3 times with exponential backoff (2, 4, 8 seconds)
Audit Log : All attempts are logged to the
webhook_logs
table for debugging and monitoring.
Requirements
Node.js >= 18
Supabase with
proyectos
table andproyecto_vector
OpenAI API Key
Docker (for deployment)
Configuration
The service uses environment variables for its configuration:
Local Development
Install dependencies:
Configure environment variables (create
.env
file in the project root)Run in development mode:
Docker
To run the service with Docker:
Or with Docker Compose:
Deployment on Railway
Preparation
Create a repository on GitHub and upload the code:
Create a Railway account if you don't have one yet.
Deployment
In Railway, create a new project from GitHub
Select the
mcp-vector-sync
repositoryRailway will automatically detect the Dockerfile
Configure environment variables in the "Variables" section
Deploy the service
Railway will use the railway.json
file to configure the deployment and the Dockerfile to build the image.
Monitoring
Once deployed, you can monitor the service using the /health
endpoint:
Webhook Endpoint
The system receives webhooks on the following endpoint:
The expected payload for the webhook must include:
MCP Tools
The service exposes the following MCP tools:
sync-tenant
: Forces synchronization for a specific tenantget-sync-status
: Gets the synchronization status of a tenantcontrol-monitor
: Starts or stops the synchronization monitor
Troubleshooting
If there are errors with the embedding generation, check your OpenAI API key.
For connection issues with Supabase, make sure the URL and service key are correct.
Review the logs in
webhook_logs
to diagnose webhook issues.Detailed logs can be enabled with
LOG_LEVEL=debug
Maintenance
To update the service:
Make changes to the code
Update the version in
package.json
Commit and push to GitHub
Railway will detect changes and automatically redeploy
Safety Considerations
Never include credentials or API keys in your source code.
Use environment variables for all sensitive settings
Make sure the Supabase service role key has only the necessary permissions
In production environments, consider implementing authentication for webhooks.
Configure rate limiting to protect against DoS attacks
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A multi-tenant service that automatically monitors Supabase database changes, generates OpenAI embeddings, and maintains synchronized vector search capabilities for each tenant's projects.
Related MCP Servers
- -securityFlicense-qualityA bridge between AI assistants like GitHub Copilot and Supabase databases, allowing AI to understand schema, assist with query writing, and provide context-aware suggestions related to your data model.Last updated -
- -securityAlicense-qualityA Model Context Protocol server that enables AI tools to interact with Supabase databases, providing tools for reading, creating, updating, and deleting records in Supabase tables.Last updated -MIT License
- AsecurityFlicenseAqualityA protocol server that enables interaction with self-hosted Supabase instances directly from development environments, allowing database introspection, management of migrations, auth users, and storage through MCP clients like IDE extensions.Last updated -2175
- -securityFlicense-qualityA Model Context Protocol server that integrates with Supabase, allowing AI assistants to access and manipulate store data through tools for product searching, filtering, and analysis.Last updated -