PostgREST

Official
# Supabase MCP Server > Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants. ![supabase-mcp-demo](https://github.com/user-attachments/assets/3fce101a-b7d4-482f-9182-0be70ed1ad56) The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) standardizes how Large Language Models (LLMs) talk to external services like Supabase. It connects AI assistants directly with your Supabase project and allows them to perform tasks like managing tables, fetching config, and querying data. ## Prerequisites You will need Node.js installed on your machine. You can check this by running: ```shell node -v ``` If you don't have Node.js installed, you can download it from [nodejs.org](https://nodejs.org/). ## Setup ### 1. Personal access token (PAT) First, go to your [Supabase settings](https://supabase.com/dashboard/account/tokens) and create a personal access token. Give it a name that describes its purpose, like "Cursor MCP Server". This will be used to authenticate the MCP server with your Supabase account. Make sure to copy the token, as you won't be able to see it again. ### 2. Configure MCP client Next, configure your MCP client (like Cursor) with the following command: ```shell npx -y @supabase/mcp-server-supabase@latest --access-token=<personal-access-token> ``` Replacing `<personal-access-token>` with the token you created in step 1. If you are on Windows, you will need to [prefix this command](#windows). #### JSON format Most MCP clients store the configuration as JSON in the following format: ```json { "mcpServers": { "supabase": { "command": "npx", "args": [ "-y", "@supabase/mcp-server-supabase@latest", "--access-token", "<personal-access-token>" ] } } } ``` #### Windows On Windows, you will need to prefix the command with `cmd /c`: ```json { "mcpServers": { "supabase": { "command": "cmd", "args": [ "/c", "npx", "-y", "@supabase/mcp-server-supabase@latest", "--access-token", "<personal-access-token>" ] } } } ``` or with `wsl` if you are running Node.js inside WSL: ```json { "mcpServers": { "supabase": { "command": "wsl", "args": [ "npx", "-y", "@supabase/mcp-server-supabase@latest", "--access-token", "<personal-access-token>" ] } } } ``` Make sure Node.js is available in your system `PATH` environment variable. If you are running Node.js natively on Windows, you can set this by running the following commands in your terminal. 1. Get the path to `npm`: ```shell npm config get prefix ``` 2. Add the directory to your PATH: ```shell setx PATH "%PATH%;<path-to-dir>" ``` 3. Restart your MCP client. ## Tools _**Note:** This server is currently pre-1.0, so expect some breaking changes between versions. Since LLMs will automatically adapt to the tools available, this shouldn't affect most users._ The following Supabase tools are available to the LLM: #### Project Management - `list_projects`: Lists all Supabase projects for the user. - `get_project`: Gets a project by ID. - `create_project`: Creates a new Supabase project. - `list_organizations`: Lists all organizations for the user. - `get_organization`: Gets an organization by ID. #### Database Operations - `list_tables`: Lists all tables within the specified schemas. - `list_extensions`: Lists all extensions in the database. - `list_migrations`: Lists all migrations in the database. - `apply_migration`: Applies a SQL migration to the database. SQL passed to this tool will be tracked within the database, so LLMs should use this for DDL operations (schema changes). - `execute_sql`: Executes raw SQL in the database. LLMs should use this for regular queries that don't change the schema. #### Project Configuration - `get_project_url`: Gets the API URL for a project. - `get_anon_key`: Gets the anonymous API key for a project. #### Development Tools - `generate_typescript_types`: Generates TypeScript types based on the database schema. LLMs can save this to a file and use it in their code. ## Other MCP servers ### `@supabase/mcp-server-postgrest` The PostgREST MCP server allows you to connect your own users to your app via REST API. See more details on its [project README](./packages/mcp-server-postgrest). ## Resources - [**Model Context Protocol**](https://modelcontextprotocol.io/introduction): Learn more about MCP and its capabilities. ## License This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.