# How to Connect Cline to Supabase: Database Migrations and Schema Inspection via MCP

Connecting Cline to Supabase through the Model Context Protocol gives the autonomous coding agent real-time access to database schemas, migration logs, and type generation tools. This guide walks through configuring the remote Supabase MCP server in Cline, inspecting live PostgreSQL tables to eliminate query errors, applying schema migrations safely, and storing project artifacts in persistent cloud workspaces.

Source: https://fast.io/resources/how-to-connect-cline-to-supabase-via-mcp/
Last reviewed: 2026-09-08

## Why Schema Inspection Matters for Autonomous Coding Agents

Coding agents writing SQL queries without access to live database schemas fail in predictable ways: they hallucinate table structures, guess column names incorrectly, and write invalid migrations that break production services. When an agent works strictly from local code references or developer prompts, it lacks awareness of active constraints, foreign keys, database triggers, and installed PostgreSQL extensions. Bridging Cline and Supabase through the Model Context Protocol replaces manual schema copying with direct, real-time database inspection and migration execution.

The Cline Supabase integration uses the Model Context Protocol to give the coding agent secure, schema-aware access to PostgreSQL databases for query drafting, migration validation, and TypeScript type generation. Instead of pasting table definitions into chat prompts or maintaining separate schema dump files, developers give Cline direct access to read database structures through standardized protocol endpoints.

Manual database coordination carries friction and risk. Developers often resort to dumping table schemas into prompt windows, copying SQL definition files, or creating manual personal access tokens in custom wrapper scripts. Those approaches grow stale the moment another teammate applies a migration, and they risk exposing root credentials across development environments. Older tutorials frequently recommended running local bridge daemons with broad database privileges, creating security risks on developer machines.

The official Supabase MCP server exposes a consolidated suite of database and development tools directly to MCP-compatible clients. These tools allow Cline to query active catalog tables, inspect database extensions, verify pending migrations, and inspect error logs without leaving VS Code. By giving Cline live schema inspection capabilities, teams prevent SQL runtime errors before code reaches pull requests or staging branches.

## How to Configure the Supabase Remote MCP Server in Cline

Earlier Model Context Protocol setups required running local Node.js packages or maintaining custom Python scripts to connect coding agents to PostgreSQL. Supabase now hosts an official Remote MCP endpoint at `https://mcp.supabase.com/mcp` using the Streamable HTTP transport. This hosted architecture removes the need to maintain local bridge processes or manage brittle access tokens manually.

To connect Cline to the hosted Supabase MCP server, you update the extension settings file.

**Locate the Configuration File**

In VS Code, open the Cline panel in the sidebar. Click the MCP Servers icon in the top menu and select Configure MCP Servers. This action opens `cline_mcp_settings.json` in the editor.

If you prefer to open the file directly from your operating system terminal:

- On macOS: `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
- On Windows: `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`
- On Linux: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`

**Register the Supabase Server**

Add the Supabase remote server block to the `mcpServers` object in `cline_mcp_settings.json`:

```json
{
  "mcpServers": {
    "supabase": {
      "type": "streamableHttp",
      "url": "https://mcp.supabase.com/mcp?features=database,development,docs,debugging",
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

**Configure Server Parameters**

You can refine the server URL using query parameters to adjust scope and permissions:

- Project scoping: Append `?project_ref=your-project-id` to limit Cline to a single project. When omitted, Cline can access all projects within your authorized Supabase organization. For production safety, always scope the connection to a specific development or staging project reference.
- Feature groups: Specify comma-separated feature groups using `?features=database,development,docs,debugging`. The database group includes table listing and migration tools, development provides TypeScript type generation, docs allows Cline to search Supabase documentation, and debugging provides log querying and advisor checks.
- Read-only protection: Append `&read_only=true` to force all database queries through a read-only PostgreSQL transaction. This parameter prevents write statements and disables migration execution tools.

**Authenticate with Browser OAuth**

The hosted Supabase MCP server uses dynamic client registration. When you save `cline_mcp_settings.json` and start a prompt that invokes a Supabase tool, Cline opens a browser window prompting you to log in to Supabase. Select your target organization and grant access. The connection authenticates automatically without requiring you to create personal access tokens or store credentials in plaintext.

**Local Development Alternative**

If you run local PostgreSQL instances using the Supabase CLI via `supabase start`, connect Cline directly to your local daemon:

```json
{
  "mcpServers": {
    "supabase-local": {
      "type": "streamableHttp",
      "url": "http://localhost:54321/mcp",
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

## How to Inspect PostgreSQL Schemas and Generate TypeScript Types

When an autonomous agent writes database queries without live schema inspection, it guesses relationships. For example, it might attempt an inner join on `user_id` when the actual foreign key is named `account_id`, or treat a JSONB column as a plain text string. Connecting Cline to Supabase eliminates this guesswork by giving the model direct access to catalog metadata.

**Inspecting Table Definitions with list_tables**

When you ask Cline to implement a feature or write a query, it calls the `list_tables` tool provided by the Supabase MCP server. The tool returns comprehensive column definitions, data types, nullability rules, default values, primary keys, and foreign key relationships.

Consider a prompt where you instruct Cline: "Create an endpoint to query active user subscriptions and their corresponding payment methods."

Instead of inventing column names, Cline executes `list_tables` on the public schema. It identifies that subscriptions reside in `billing_subscriptions`, foreign keys point to `customer_accounts.id`, and status values are governed by a custom enum type. Cline writes SQL queries that match the exact database schema on the first attempt, preventing syntax errors and mismatched data types.

**Generating TypeScript Types with generate_typescript_types**

The development feature group exposes the `generate_typescript_types` tool. This tool inspects the database schema and produces TypeScript definitions matching your PostgreSQL tables, views, and custom types.

Cline can run this tool and write the resulting definitions directly into your project repository, such as `src/types/database.types.ts`:

```typescript
export type Json =
  | string
  | number
  | boolean
  | null
  | { [key: string]: Json | undefined }
  | Json[]

export interface Database {
  public: {
    Tables: {
      billing_subscriptions: {
        Row: {
          id: string
          account_id: string
          status: 'active' | 'past_due' | 'canceled'
          created_at: string
        }
        Insert: {
          id?: string
          account_id: string
          status: 'active' | 'past_due' | 'canceled'
          created_at?: string
        }
        Update: {
          id?: string
          account_id?: string
          status?: 'active' | 'past_due' | 'canceled'
          created_at?: string
        }
      }
    }
  }
}
```

When database columns change, Cline re-executes `generate_typescript_types` to refresh your definitions file, alerting you immediately to any frontend components or server routes with type mismatches.

## How to Validate and Execute Database Migrations Safely

Database migrations require strict validation. An unindexed foreign key on a high-volume table can lock production records, and an accidental column drop can cause irreversible data loss. Cline provides a structured workflow for drafting, inspecting, and applying migrations when connected to Supabase.

**Reviewing Applied Migrations with list_migrations**

Before drafting new migration scripts, Cline executes `list_migrations`. This tool reads the internal migration tracking table in Supabase and returns all previously executed migration versions. Understanding the active migration history ensures that Cline generates sequential timestamps and avoids conflicting table alterations.

**Drafting and Testing Migration Scripts**

When tasked with adding a new table or altering a schema, Cline follows a disciplined four-step validation sequence:

1. Checks existing table structures using `list_tables` to identify dependent views, foreign keys, and indexes.
2. Drafts a new migration file following standard Supabase naming conventions, such as a timestamped migration path under `supabase/migrations/`.
3. Verifies SQL syntax and constraint logic, ensuring appropriate `ON DELETE` behaviors and composite indexes are defined.
4. Validates that Row Level Security policies are included on all newly created tables to protect data access.

**Applying Migrations with apply_migration**

In local development or staging environments, Cline can invoke the `apply_migration` tool to run the DDL statements directly against PostgreSQL.

To maintain safety during migration execution, observe three operational rules:

- Retain manual approvals: Keep `autoApprove: []` empty in `cline_mcp_settings.json` for all write tools. When Cline calls `apply_migration` or `execute_sql`, the extension interface pauses and prompts you to review the SQL statement. Inspect the proposed DDL before approving execution.
- Use read-only mode during exploration: When using Cline for general code refactoring or bug investigation, configure `read_only=true` in the server URL. This prevents accidental schema modifications while preserving schema inspection tools.
- Leverage database branching: In team environments, use Supabase branching tools (`create_branch`, `merge_branch`) to test migrations in an isolated preview database before merging changes into production.

## Archiving Database Dumps and Migration Artifacts in Shared Workspaces

PostgreSQL excels at storing structured relational records, executing transactional queries, and maintaining relational integrity. However, software engineering teams generate extensive unstructured and semi-structured assets around their databases: architectural decision records, entity-relationship diagrams, schema data dictionaries, migration rollback procedures, and point-in-time schema dumps.

When Cline operates inside VS Code, generated schema summaries, documentation notes, and migration files remain isolated on a single developer machine. If another engineer needs to review the schema changes, or if an autonomous agent running in a continuous integration pipeline needs to verify database documentation, local files cannot provide reliable coordination. Consumer cloud storage tools lack agent-native MCP interfaces, do not index SQL code for semantic search, and create file conflicts during concurrent agent updates.

[Fast.io](/storage-for-agents/) provides persistent cloud workspaces designed for autonomous agents and human developers. By connecting Cline to Fast.io through the Model Context Protocol, teams establish a centralized workspace for all database documentation and migration artifacts.

**Connecting Cline to Fast.io Storage**

To connect Cline to a shared Fast.io workspace, register the Fast.io MCP endpoint in `cline_mcp_settings.json`:

```json
{
  "mcpServers": {
    "fastio-storage": {
      "type": "streamableHttp",
      "url": "https://mcp.fast.io/mcp/key",
      "headers": {
        "Authorization": "Bearer your_fastio_api_token"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

**What Fast.io Adds to the Cline and Supabase Architecture**

- Per-File Version History: Every time Cline generates a new schema export, data dictionary, or rollback plan, Fast.io retains full version history. If an agent overwrites an architectural decision record or modifies a SQL script incorrectly, team members can review diffs and restore previous versions.
- Workspace Intelligence Mode: Once Intelligence Mode is enabled on a workspace, Fast.io automatically indexes uploaded SQL scripts, architectural notes, and data dictionaries for Retrieval-Augmented Generation. Cline can query past migration plans and architectural context using semantic search, retrieving relevant details without consuming large context windows.
- Structured Metadata Views: For database teams managing exported audit logs, CSV reports, or schema documentation, [Fast.io Metadata Views](/product/document-data-extraction/) extract typed structured fields into a filterable database view directly from workspace files.
- Ownership Transfer: An autonomous agent can build out an entire database documentation workspace, upload schema dumps, organize migrations into structured folders, and transfer organization ownership to an engineering manager while retaining administrative access for future updates.
- Transparent Subscriptions: Every organization starts with a 14-day free trial, which requires a credit card. Plans scale across Starter, Business, and Growth tiers. For complete plan details, review the [pricing](/pricing/) options.

This architecture creates a clean division of responsibility. Supabase manages your live PostgreSQL tables, Edge Functions, and operational records. Fast.io stores the files, documentation, and schema artifacts your agents produce, providing a persistent cloud workspace where human teams and AI agents collaborate.

## Frequently asked questions

### How do I add Supabase MCP to Cline?

Open the Cline panel in VS Code, click the MCP Servers icon in the top toolbar, and select Configure MCP Servers to open cline_mcp_settings.json. Add the Supabase configuration under the mcpServers object with type set to streamableHttp and url set to https://mcp.supabase.com/mcp. Save the file, and Cline will prompt you to complete a one-time OAuth authorization in your web browser.

### Can Cline run database migrations in Supabase?

Yes. When the database feature group is enabled, Cline can access the list_migrations and apply_migration tools. Cline inspects previously applied migrations, drafts standard timestamped SQL files, and executes DDL statements against the database once you grant approval in the Cline interface.

### Is it safe to let Cline query Supabase databases?

Yes, provided you apply standard security guardrails. Always scope the MCP connection to a specific development or staging project using the project_ref parameter. Enable read-only mode with read_only=true during query drafting and analysis. Keep manual tool call approval enabled in Cline so write operations cannot run without explicit review. Never connect unconstrained write tools directly to a production database.

### What is the difference between the remote and local Supabase MCP endpoints?

The remote endpoint at https://mcp.supabase.com/mcp connects to hosted Supabase cloud projects via Streamable HTTP and authenticates using browser OAuth. The local endpoint at `http://localhost:54321/mcp` connects to the local development environment managed by the Supabase CLI on your development machine, making it ideal for offline work and private sandbox testing.

### How do I restrict Cline to read-only access in Supabase?

Add read_only=true to your Supabase MCP URL query parameters in cline_mcp_settings.json. In read-only mode, Supabase runs queries under a restricted PostgreSQL role that prevents INSERT, UPDATE, DELETE, and DDL modifications, and disables write tools like apply_migration.

## About Fast.io

Fast.io provides shared workspaces where people and AI agents work on the same files, with built-in semantic search and citation-backed chat over what they hold. Agents reach it through a remote MCP server at https://mcp.fast.io/mcp, a REST API at https://api.fast.io/current/, and a command line client published on npm as @vividengine/fastio-cli.
