How to Connect Cursor to Supabase MCP Server Seamlessly

How to Connect Cursor to Supabase MCP Server Seamlessly

Learn how to connect Cursor to a Supabase MCP Server through Lunar.dev’s MCPX Gateway for secure, governed database access. This step-by-step guide covers setup, authentication, and visibility controls, helping developers query Supabase safely within AI-assisted workflows.

Eyal Solomon, Co-Founder & CEO

Eyal Solomon, Co-Founder & CEO

MCP

MCPX

Introduction

Connecting Cursor to the Supabase MCP Server through Lunar.dev’s MCPX Gateway provides developers with a secure, governed, and unified way to access database resources via the Model Context Protocol. The Lunar MCPX Gateway acts as the middleware that ensures all interactions between Cursor, Supabase, and other MCP servers follow enterprise-grade authentication, observability, and access control standards.

This article walks you through how to connect Cursor to  the Supabase MCP Server using Lunar.dev’s MCPX Gateway, ensuring a frictionless developer experience while maintaining full control and compliance across AI-assisted workflows.

Understanding the Supabase MCP Server

What is an MCP Server?

An MCP (Model Context Protocol) Server exposes tools, APIs, or datasets to AI agents or copilots in a structured, governed way.
The Supabase MCP Server acts as a bridge between Cursor and your Supabase database, allowing queries, schema inspection, and structured data retrieval through standardized MCP tool calls.

Why Use the Supabase MCP Server with Lunar.dev?

Integrating Supabase via Lunar’s MCPX Gateway lets teams:

  • Securely Connect to Supabase using environment-scoped authentication keys and tokens.

  • Control Access by Profile, ensuring each developer or agent only queries approved databases.

  • Enable Full Visibility and Logging, allowing administrators to monitor every query and connection event.

By routing through the Lunar MCPX Gateway, enterprises can maintain a single governance layer across all MCP tools and data sources, including Supabase, Slack, or internal APIs.

Overview of Cursor

Cursor is a developer workspace optimized for AI-assisted programming and tool orchestration. Through its native MCP connectivity, Cursor can interact with data services like Supabase directly from the editor — provided the connections are brokered via a trusted MCP gateway like Lunar’s MCPX.

When connected to Lunar.dev, Cursor communicates with the Supabase MCP Server securely, following your organization’s access controls and environment configuration.

Connecting Cursor to Supabase MCP Server via Lunar MCPX Gateway

Prerequisites

Before starting:

  1. Have a running instance of the Lunar MCPX Gateway (either local or enterprise).

  2. Have access to your Supabase project credentials (API URL, anon key, or service role key).

  3. Confirm that your Cursor workspace supports MCP connections.

  4. Set the appropriate environment variables for authentication.

👉 For environment setup, see: Environment Variables Configuration for Auth Key

Step-by-Step Connection Guide

Step 1: Connect Cursor to Lunar MCPX Gateway

Follow: Connect Cursor to Lunar MCPX Gateway

  1. In Cursor, open Settings → MCP Connections.

  2. Click Add Gateway Connection.

  3. Enter your Lunar MCPX Gateway endpoint (for example, http://localhost:3001 or your enterprise gateway URL).

  4. Add the authentication key defined in your .env file (MCP_GATEWAY_AUTH_KEY).

  5. Save and test to confirm Cursor is connected to the MCPX Gateway.

Step 2: Add the Supabase MCP Server to Lunar MCPX

Follow: Add Remote MCP Server

  1. Access your Lunar MCPX dashboard or CLI.
  2. Add Supabase as a remote MCP server:
    lunar mcpx add-server supabase --url https://supabase-mcp-server.yourdomain.com
  3. Provide the Supabase project URL and service key through environment variables, for example:
    export SUPABASE_URL=https://xyzcompany.supabase.co
    export SUPABASE_SERVICE_KEY=your-service-role-key

  4. Confirm the server appears in your connected list in MCPX.
  5. (Optional) Assign it to a Profile (e.g., “Data Team”) to scope access.

Step 3: Link Supabase MCP Server through Lunar Gateway in Cursor

  1. In Cursor, select Add MCP Server via Gateway.

  2. Choose the Supabase MCP Server you registered in Lunar MCPX.

  3. Test the connection to validate access.

  4. Once connected, you can use Supabase queries, list tables, or call stored procedures directly from Cursor through the governed connection.

Troubleshooting Common Issues

If you encounter errors:

  • Verify the Supabase credentials and endpoint.

  • Ensure your .env configuration for Lunar MCPX includes both your auth key and Supabase environment variables.

Check the Lunar MCPX logs for detailed error traces:

lunar logs --follow

Note: Make sure the MCP server is reachable and not behind restricted firewalls.

Use Cases

1. Secure Database Access

Run queries and inspect tables from within Cursor, while keeping all database credentials and policies centralized in Lunar MCPX.

2. Role-Based Query Governance

Limit who can run write operations or schema migrations by defining Profiles in Lunar MCPX that restrict Supabase tool access.

3. Data-Aware Agents

Enable AI copilots to read from Supabase datasets (such as analytics, telemetry, or production snapshots) without exposing raw credentials to the client environment.

Conclusion

Integrating Cursor with the Supabase MCP Server through Lunar.dev’s MCPX Gateway allows teams to unify database access, AI workflows, and governance under one trusted layer.
The result: seamless connectivity, structured permissions, and auditable operations across all your MCP-enabled tools and services.

Ready to Start your journey?

Manage a single service and unlock API management at scale