Supabase Lite MCP Server

Supabase Lite MCP Server

A lightweight MCP server that provides 8 essential Supabase database management commands with minimal token usage, enabling efficient database operations through Claude.

Category
Visit Server

README

Supabase Lite MCP Server

Overview

The Supabase Lite MCP Server is a lightweight Model Context Protocol (MCP) server that provides essential Supabase database management commands. This focused implementation reduces token usage from ~14,800 to ~3,700 tokens by exposing only 8 core commands instead of the full 26.

Features

  • šŸš€ Minimal Token Usage: Only ~3,700 tokens vs ~14,800 for the full Supabase MCP
  • šŸŽÆ Essential Commands Only: 8 carefully selected database management commands
  • šŸ“¦ Easy Installation: Automated setup script with environment validation
  • šŸ”§ TypeScript: Full type safety and modern ES modules
  • šŸ” Secure: Uses service role keys with proper environment variable handling
  • šŸ› ļø Production Ready: Error handling, logging, and MCP protocol compliance

Quick Start

Automated Installation

# Clone the repository
git clone https://github.com/your-username/supabase-lite-mcp.git
cd supabase-lite-mcp

# Run the setup script
./setup.sh

The setup script will:

  • Check Node.js version (requires v22+)
  • Install dependencies
  • Guide you through configuration
  • Build the TypeScript code
  • Optionally test the server

Manual Installation

  1. Install dependencies:

    npm install
    
  2. Configure environment:

    cp .env.example .env
    # Edit .env with your Supabase credentials
    
  3. Build the project:

    npm run build
    
  4. Test the server:

    npm run dev
    

Configuration

Environment Variables

Create a .env file with your Supabase credentials:

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_PROJECT_REF=your-project-ref  # Optional

Get these from your Supabase dashboard:

  • URL: Settings → API → Project URL
  • Service Key: Settings → API → Service role key (NOT anon key!)
  • Project Ref: Settings → General → Reference ID

Claude Integration

Add to your MCP configuration file (.mcp.json):

{
  "mcpServers": {
    "supabase-lite": {
      "command": "node",
      "args": ["path/to/supabase-lite-mcp/dist/index.js"],
      "env": {
        "SUPABASE_URL": "${SUPABASE_URL}",
        "SUPABASE_SERVICE_KEY": "${SUPABASE_SERVICE_KEY}"
      }
    }
  }
}

Or use npm link for global access:

cd supabase-lite-mcp
npm link

Then use "command": "supabase-lite-mcp" in your MCP config.

Available Commands

1. list_tables

Lists all tables in specified schemas.

  • Use case: Discovering database structure
  • Token cost: 457 tokens

2. list_extensions

Shows installed PostgreSQL extensions.

  • Use case: Checking available database features
  • Token cost: 413 tokens

3. list_migrations

Displays migration history.

  • Use case: Tracking schema changes
  • Token cost: 413 tokens

4. apply_migration

Applies DDL changes to the database.

  • Use case: Creating tables, indexes, etc.
  • Token cost: 485 tokens

5. execute_sql

Runs SQL queries for data operations.

  • Use case: Querying and modifying data
  • Token cost: 474 tokens

6. get_logs

Retrieves service logs from the last minute.

  • Use case: Debugging issues
  • Token cost: 516 tokens

7. get_advisors

Provides security and performance recommendations.

  • Use case: Database optimization
  • Token cost: 516 tokens

8. generate_typescript_types

Creates TypeScript interfaces from schema.

  • Use case: Type-safe development
  • Token cost: 417 tokens

Architecture

How It Works

The server implements the Model Context Protocol (MCP) to communicate with Claude:

Claude ā†”ļø MCP Protocol (stdio) ā†”ļø Server ā†”ļø Supabase API

Key Components

  • MCP Server: Handles protocol communication via stdio
  • Tool Registry: Defines available commands and their schemas
  • Command Handlers: Execute Supabase operations
  • Type Safety: Full TypeScript with strict typing
  • Error Handling: Graceful error reporting in MCP format

Extending the Server

Adding New Commands

  1. Add command to ALLOWED_COMMANDS in src/index.ts
  2. Define tool schema in getToolDefinitions()
  3. Add case in executeCommand() switch
  4. Implement handler method

Example:

// 1. Add to ALLOWED_COMMANDS
const ALLOWED_COMMANDS = [
  // ... existing commands
  'custom_command'
] as const;

// 2. Add tool definition
tools.push({
  name: 'custom_command',
  description: 'My custom command',
  inputSchema: {
    type: 'object',
    properties: {
      param: { type: 'string' }
    }
  }
});

// 3. Add case in executeCommand
case 'custom_command':
  return await this.customCommand(args);

// 4. Implement handler
private async customCommand(args: any): Promise<any> {
  // Your implementation
  return {
    content: [{
      type: 'text',
      text: 'Result'
    }]
  };
}

Development

Scripts

  • npm run build - Build TypeScript to JavaScript
  • npm run dev - Run in development mode with hot reload
  • npm start - Run production build
  • npm run clean - Clean build artifacts

Project Structure

supabase-lite-mcp/
ā”œā”€ā”€ src/
│   └── index.ts        # Main server implementation
ā”œā”€ā”€ dist/              # Compiled JavaScript (generated)
ā”œā”€ā”€ .env               # Environment variables (create from .env.example)
ā”œā”€ā”€ .env.example       # Environment template
ā”œā”€ā”€ package.json       # Node.js configuration
ā”œā”€ā”€ tsconfig.json      # TypeScript configuration
ā”œā”€ā”€ setup.sh          # Installation script
└── README.md         # Documentation

Comparison with Full Supabase MCP

Feature Full Supabase MCP Supabase Lite MCP
Commands 26 8 (essential only)
Token Usage ~14,800 ~3,700
Startup Time ~2s <1s
Memory Usage ~50MB ~30MB
Focus Complete platform Database only

Security

  • šŸ”’ Never commit .env files
  • šŸ”‘ Use service role keys carefully (full database access)
  • šŸ”„ Rotate keys regularly
  • 🌐 Consider network isolation for production

Troubleshooting

Common Issues

Server won't start:

  • Check Node.js version: node --version (requires v22+)
  • Verify .env file exists with valid credentials
  • Run npm run build to compile TypeScript

Authentication errors:

  • Ensure you're using the service role key, not anon key
  • Check if the key has been regenerated in Supabase dashboard

Build errors:

  • Run npm install to install dependencies
  • Check TypeScript version: npx tsc --version

License

MIT

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Acknowledgments

Built with:

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured