Supabase MCP Server enables your Supabase projects to connect with AI assistants like Cursor, Claude, and Windsurf through the Model Context Protocol (MCP). This standardized interface allows AI assistants to directly interact with your Supabase projects, performing tasks such as managing tables, executing queries, and handling database operations.
You will need Node.js installed on your machine. Verify your installation by running:
node -v
If Node.js isn't installed, download it from nodejs.org.
Configure your MCP client (such as Cursor) with the following JSON configuration:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase@latest",
"--access-token",
"<personal-access-token>"
]
}
}
}
Replace <personal-access-token>
with your token from step 1. Alternatively, you can omit the --access-token
parameter and set the SUPABASE_ACCESS_TOKEN
environment variable instead.
For Windows users, prefix the command with cmd /c
:
{
"mcpServers": {
"supabase": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@supabase/mcp-server-supabase@latest",
"--access-token",
"<personal-access-token>"
]
}
}
}
If running Node.js inside WSL, use:
{
"mcpServers": {
"supabase": {
"command": "wsl",
"args": [
"npx",
"-y",
"@supabase/mcp-server-supabase@latest",
"--access-token",
"<personal-access-token>"
]
}
}
}
Ensure Node.js is in your PATH environment variable. If running natively on Windows:
Find your npm path:
npm config get prefix
Add to PATH:
setx PATH "%PATH%;<path-to-dir>"
Restart your MCP client
To restrict server access to a specific project:
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token> --project-ref=<project-ref>
Find your Project ID in your Supabase project settings.
When using project scoped mode, account-level tools like list_projects
will be unavailable.
To limit the server to read-only operations:
npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token> --read-only
This prevents write operations on databases by executing SQL as a read-only Postgres user.
These tools are unavailable in project scoped mode:
list_projects
: Lists all Supabase projectsget_project
: Gets details for a specific projectcreate_project
: Creates a new projectpause_project
: Pauses a projectrestore_project
: Restores a paused projectlist_organizations
: Lists all your organizationsget_organization
: Gets details for an organizationlist_tables
: Lists all tables within specified schemaslist_extensions
: Lists all database extensionslist_migrations
: Lists all database migrationsapply_migration
: Applies a SQL migration (tracked within the database)execute_sql
: Executes raw SQL queriesget_logs
: Gets logs by service type (api, postgres, edge functions, etc.)list_edge_functions
: Lists all Edge Functionsdeploy_edge_function
: Deploys a new Edge Functionget_project_url
: Gets the API URL for a projectget_anon_key
: Gets the anonymous API keycreate_branch
: Creates a development branchlist_branches
: Lists all branchesdelete_branch
: Deletes a branchmerge_branch
: Merges migrations and functions to productionreset_branch
: Resets migrations to a prior versionrebase_branch
: Rebases development branch on productiongenerate_typescript_types
: Generates TypeScript types from database schemaget_cost
: Gets the cost for a new project or branchconfirm_cost
: Confirms understanding of costs (required for creation)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.