| title | Cloud SQL for PostgreSQL Admin using MCP |
|---|---|
| type | docs |
| weight | 3 |
| description | Create and manage Cloud SQL for PostgreSQL (Admin) using Toolbox. |
This guide covers how to use MCP Toolbox for Databases to expose your developer assistant tools to create and manage Cloud SQL for PostgreSQL instance, database and users:
- Cursor
- Windsurf (Codium)
- Visual Studio Code (Copilot)
- Cline (VS Code extension)
- Claude desktop
- Claude code
- Gemini CLI
- Gemini Code Assist
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Grant the necessary IAM roles to the user that will be running the MCP server. The tools available will depend on the roles granted:
roles/cloudsql.viewer: Provides read-only access to resources.get_instancelist_instanceslist_databaseswait_for_operation
roles/cloudsql.editor: Provides permissions to manage existing resources.- All
viewertools create_databasecreate_backup
- All
roles/cloudsql.admin: Provides full control over all resources.- All
editorandviewertools create_instancecreate_userclone_instancerestore_backup
- All
-
Download the latest version of Toolbox as a binary. Select the correct binary corresponding to your OS and CPU architecture. You are required to use Toolbox version V0.15.0+:
{{< tabpane persist=header >}} {{< tab header="linux/amd64" lang="bash" >}} curl -O https://storage.googleapis.com/mcp-toolbox-for-databases/v0.15.0/linux/amd64/toolbox {{< /tab >}}
{{< tab header="darwin/arm64" lang="bash" >}} curl -O https://storage.googleapis.com/mcp-toolbox-for-databases/v0.15.0/darwin/arm64/toolbox {{< /tab >}}
{{< tab header="darwin/amd64" lang="bash" >}} curl -O https://storage.googleapis.com/mcp-toolbox-for-databases/v0.15.0/darwin/amd64/toolbox {{< /tab >}}
{{< tab header="windows/amd64" lang="bash" >}} curl -O https://storage.googleapis.com/mcp-toolbox-for-databases/v0.15.0/windows/amd64/toolbox.exe {{< /tab >}} {{< /tabpane >}}
-
Make the binary executable:
chmod +x toolbox
-
Verify the installation:
./toolbox --version
{{< tabpane text=true >}} {{% tab header="Claude code" lang="en" %}}
-
Install Claude Code.
-
Create a
.mcp.jsonfile in your project root if it doesn't exist. -
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } } -
Restart Claude code to apply the new configuration. {{% /tab %}}
{{% tab header="Claude desktop" lang="en" %}}
-
Open Claude desktop and navigate to Settings.
-
Under the Developer tab, tap Edit Config to open the configuration file.
-
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } } -
Restart Claude desktop.
-
From the new chat screen, you should see a hammer (MCP) icon appear with the new MCP server available. {{% /tab %}}
{{% tab header="Cline" lang="en" %}}
-
Open the Cline extension in VS Code and tap the MCP Servers icon.
-
Tap Configure MCP Servers to open the configuration file.
-
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } } -
You should see a green active status after the server is successfully connected. {{% /tab %}}
{{% tab header="Cursor" lang="en" %}}
-
Create a
.cursordirectory in your project root if it doesn't exist. -
Create a
.cursor/mcp.jsonfile if it doesn't exist and open it. -
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } } -
Cursor and navigate to Settings > Cursor Settings > MCP. You should see a green active status after the server is successfully connected. {{% /tab %}}
{{% tab header="Visual Studio Code (Copilot)" lang="en" %}}
-
Open VS Code and create a
.vscodedirectory in your project root if it doesn't exist. -
Create a
.vscode/mcp.jsonfile if it doesn't exist and open it. -
Add the following configuration and save:
{ "servers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } }
{{% /tab %}}
{{% tab header="Windsurf" lang="en" %}}
-
Open Windsurf and navigate to the Cascade assistant.
-
Tap on the hammer (MCP) icon, then Configure to open the configuration file.
-
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } }
{{% /tab %}}
{{% tab header="Gemini CLI" lang="en" %}}
-
Install the Gemini CLI.
-
In your working directory, create a folder named
.gemini. Within it, create asettings.jsonfile. -
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } }
{{% /tab %}}
{{% tab header="Gemini Code Assist" lang="en" %}}
-
Install the Gemini Code Assist extension in Visual Studio Code.
-
Enable Agent Mode in Gemini Code Assist chat.
-
In your working directory, create a folder named
.gemini. Within it, create asettings.jsonfile. -
Add the following configuration and save:
{ "mcpServers": { "cloud-sql-postgres-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","cloud-sql-postgres-admin","--stdio"], "env": { } } } }
{{% /tab %}} {{< /tabpane >}}
Your AI tool is now connected to Cloud SQL for PostgreSQL using MCP.
The cloud-sql-postgres-admin server provides tools for managing your Cloud SQL
instances and interacting with your database:
- create_instance: Creates a new Cloud SQL for PostgreSQL instance.
- get_instance: Gets information about a Cloud SQL instance.
- list_instances: Lists Cloud SQL instances in a project.
- create_database: Creates a new database in a Cloud SQL instance.
- list_databases: Lists all databases for a Cloud SQL instance.
- create_user: Creates a new user in a Cloud SQL instance.
- wait_for_operation: Waits for a Cloud SQL operation to complete.
- clone_instance: Creates a clone of an existing Cloud SQL for PostgreSQL instance.
- create_backup: Creates a backup on a Cloud SQL instance.
- restore_backup: Restores a backup of a Cloud SQL instance.
{{< notice note >}} Prebuilt tools are pre-1.0, so expect some tool changes between versions. LLMs will adapt to the tools available, so this shouldn't affect most users. {{< /notice >}}