Quick Guide: Connecting Supabase to Cursor via MCP (talk to your database)
Post Content
Quick Guide: Connecting Supabase to Cursor via MCP
If you’re trying to hook up your Supabase database with Cursor (using MCP), here’s a quick, straightforward guide. This setup lets you interact directly with your database through natural language—so you can just tell Cursor Composer what you want (like querying data, adding tables, etc.) without fiddling with manual SQL every time.
I struggled for hours last night because I skipped this step at first. Without this, Cursor just couldn’t get accurate context from Supabase, even when I fed it the docs directly.
Here’s what worked for me:
Step 1: Get your Supabase connection string
- Log in at Supabase and pick your project.
- Head over to your project’s connection settings.
- You’ll see a connection string there. Replace any placeholder passwords with your actual database password.
- Copy this entire connection string (you’ll need it for Cursor).
Step 2: Add your MCP server in Cursor
- Open Cursor and navigate to Settings → Features.
- Scroll down past the “Codebase indexing” section until you see the MCP servers area.
- Click on “Add New MCP Server”.
- Set type as Command.
- Name it clearly (mine is just “Supabase - My App”).
- Paste the connection string you copied from Supabase here.
- Hit save.
Step 3: Try it out
- Now you can use Cursor Composer or similar tools to run queries directly against your Supabase database without leaving Cursor.
- Run a quick test (like asking it for a list of tables) to make sure it’s connected properly.
Quick tip from experience—make sure you back up your database first. I didn’t, and cleaning up mistakes afterwards took ages.
Hope this saves someone else the headache!
Key Takeaways
- No key quotes extracted