Cloud SQL for PostgreSQL
[!NOTE]
Currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
This repository packages MCP Toolbox's prebuilt cloud-sql-postgres server as a plugin/extension to interact with Cloud SQL for PostgreSQL instances. It can be used with various AI agents, including Antigravity, Claude Code and Codex, to manage your databases, execute queries, explore schemas, and troubleshoot issues using natural language prompts.
[!IMPORTANT]
We Want Your Feedback!
Please share your thoughts with us by filling out our feedback form.
Your input is invaluable and helps us improve the project for everyone.
Table of Contents
Why Use Cloud SQL for PostgreSQL?
- Seamless Workflow: Integrates seamlessly into your AI agent's environment. No need to constantly switch contexts for common database tasks.
- Natural Language Queries: Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
- Full Lifecycle Control: Manage the entire lifecycle of your database, from creating instances to exploring schemas and running queries.
- Code Generation: Accelerate development by asking your agent to generate data classes and other code snippets based on your table schemas.
Prerequisites
Before you begin, ensure you have the following:
- One of these AI agents installed
- Node.js — the MCP server runs via
npx.
- A Google Cloud project with the Cloud SQL Admin API enabled.
- Ensure Application Default Credentials are available in your environment.
- IAM Permissions:
- Cloud SQL Client (
roles/cloudsql.client)
- Cloud SQL Admin (
roles/cloudsql.admin)
[!NOTE]
If you do not configure a specific CLOUD_SQL_POSTGRES_USER or CLOUD_SQL_POSTGRES_PASSWORD, the server defaults to using the active local IAM user credentials. You must also add the IAM user to your Cloud SQL instance, see Creating a database user.
Getting Started
Configuration
Please keep these env vars handy during the installation process:
CLOUD_SQL_POSTGRES_PROJECT: The GCP project ID.
CLOUD_SQL_POSTGRES_REGION: The region of your Cloud SQL instance.
CLOUD_SQL_POSTGRES_INSTANCE: The ID of your Cloud SQL instance.
CLOUD_SQL_POSTGRES_DATABASE: The name of the database to connect to.
CLOUD_SQL_POSTGRES_USER: (Optional) The database username. Defaults to the active IAM user.
CLOUD_SQL_POSTGRES_PASSWORD: (Optional) The password for the database user.
CLOUD_SQL_POSTGRES_IP_TYPE: (Optional) Type of the IP address: PUBLIC, PRIVATE, or PSC. Defaults to PUBLIC.
[!NOTE]
- Ensure Application Default Credentials are available in your environment.
- If your Cloud SQL for PostgreSQL instance uses private IPs, you must run your agent in the same Virtual Private Cloud (VPC) network.
Installation & Usage
To start interacting with your database, install the extension for your preferred AI agent, then launch the agent and use natural language to ask questions or perform tasks.
For the latest version, check the releases page.
Antigravity