The Supabase MCP server provides a bridge between MCP clients and Supabase services, offering database operations, storage management, edge function invocation, and user management capabilities. This server enables you to seamlessly integrate Supabase functionality into any MCP-compatible application.
To install Supabase Server automatically via Smithery:
npx -y @smithery/cli install supabase-server --client claude
git clone https://github.com/DynamicEndpoints/supabase-mcp.git
cd supabase-mcp
npm install
cp .env.example .env
SUPABASE_URL=your_project_url_here
SUPABASE_KEY=your_service_role_key_here
SUPABASE_ACCESS_TOKEN=your_access_token_here # Required for management operations
cp config.json.example config.json
npm run build
The server can be configured through environment variables and a config.json file.
{
"server": {
"name": "supabase-server", // Server name
"version": "0.1.0", // Server version
"port": 3000, // Port number (if running standalone)
"host": "localhost" // Host address (if running standalone)
}
}
{
"supabase": {
"project": {
"url": "your_project_url",
"key": "your_service_role_key",
"accessToken": "your_access_token"
},
"storage": {
"defaultBucket": "public", // Default storage bucket
"maxFileSize": 52428800, // Max file size in bytes (50MB)
"allowedMimeTypes": [ // Allowed file types
"image/*",
"application/pdf",
"text/*"
]
},
"database": {
"maxConnections": 10, // Max DB connections
"timeout": 30000, // Query timeout in ms
"ssl": true // SSL connection
},
"auth": {
"autoConfirmUsers": false, // Auto-confirm new users
"disableSignup": false, // Disable public signups
"jwt": {
"expiresIn": "1h", // Token expiration
"algorithm": "HS256" // JWT algorithm
}
}
}
}
{
"logging": {
"level": "info", // Log level
"format": "json", // Log format
"outputs": ["console", "file"], // Output destinations
"file": {
"path": "logs/server.log", // Log file path
"maxSize": "10m", // Max file size
"maxFiles": 5 // Max number of files
}
},
"security": {
"cors": {
"enabled": true,
"origins": ["*"],
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
"allowedHeaders": ["Content-Type", "Authorization"]
},
"rateLimit": {
"enabled": true,
"windowMs": 900000, // 15 minutes
"max": 100 // Max requests per window
}
}
}
Add the server to your MCP settings (cline_mcp_settings.json):
{
"mcpServers": {
"supabase": {
"command": "node",
"args": ["path/to/supabase-server/build/index.js"],
"env": {
"SUPABASE_URL": "your_project_url",
"SUPABASE_KEY": "your_service_role_key",
"SUPABASE_ACCESS_TOKEN": "your_access_token"
},
"config": "path/to/config.json" // Optional: path to configuration file
}
}
}
Create a new record in a table:
{
table: "users",
data: {
name: "John Doe",
email: "[email protected]"
},
returning: ["id", "created_at"]
}
Read records with filtering and joins:
{
table: "posts",
select: ["id", "title", "user.name"],
filter: { published: true },
joins: [{
type: "left",
table: "users",
on: "posts.user_id=users.id"
}]
}
Update existing records:
{
table: "users",
data: { status: "active" },
filter: { email: "[email protected]" },
returning: ["id", "status", "updated_at"]
}
Delete records from a table:
{
table: "posts",
filter: { status: "draft" },
returning: ["id", "title"]
}
Upload files to Supabase Storage:
{
bucket: "avatars",
path: "users/123/profile.jpg",
file: imageBlob,
options: {
contentType: "image/jpeg",
upsert: true
}
}
Download files from Supabase Storage:
{
bucket: "documents",
path: "reports/annual-2023.pdf"
}
Invoke Supabase Edge Functions:
{
function: "process-image",
params: {
url: "https://example.com/image.jpg",
width: 800
},
options: {
responseType: "json"
}
}
List users with pagination:
{
page: 1,
per_page: 20
}
Create a new user:
{
email: "[email protected]",
password: "securePassword123",
data: {
firstName: "Jane",
lastName: "Smith"
}
}
Update user details:
{
user_id: "123e4567-e89b-12d3-a456-426614174000",
email: "[email protected]",
data: {
status: "premium"
}
}
Delete a user:
{
user_id: "123e4567-e89b-12d3-a456-426614174000"
}
Assign a role to a user:
{
user_id: "123e4567-e89b-12d3-a456-426614174000",
role: "admin"
}
The server provides standardized error messages in this format:
{
code: ErrorCode;
message: string;
details?: any;
}
Common error scenarios include invalid parameters, authentication failures, permission issues, and network errors.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.