Use the Cloud SQL remote MCP server Stay organized with collections Save and categorize content based on your preferences.
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms, and theAdditional Terms for Generative AI Preview Products. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
Model Context Protocol(MCP) standardizes the way AI applications connect to outside data sourcesusing MCP servers and tools.
This document describes how to use the Cloud SQLremote Model Context Protocol (MCP) server to connect toCloud SQL for PostgreSQL from AI applications such asGemini CLI,agent mode in Gemini Code Assist, ClaudeCode, or in AI applications that you're developing.
Cloud SQL remote MCP server and other Google Cloud remote MCPservers have the following features and benefits:
- Simplified, centralized discovery.
- Managed global or regional HTTP endpoints.
- Fine-grained authorization.
- Optional prompt and response security withModel Armor protection.
- Centralized audit logging.
Remote MCP Servers are managed by Google and offer additional security andgovernance controls compared to local MCP Servers provided byCloud SQL for PostgreSQL MCP Toolbox for Databases. For more information about other remoteMCP servers and about the security and governance controls availablefor MCP, seeGoogle Cloud MCP servers overview.
The following sections only apply to the Cloud SQL for PostgreSQLremote MCP server.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
If you're using an existing project for this guide,verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
Install thegcloud CLI.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Toinitialize the gcloud CLI, run the following command:
gcloudinit
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
If you're using an existing project for this guide,verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
Install thegcloud CLI.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Toinitialize the gcloud CLI, run the following command:
gcloudinit
Required roles
To get the permissions that you need to enable and use the Cloud SQL remote MCP server, ask your administrator to grant you the following IAM roles on the project where you want to enable and use the remote Cloud SQL MCP server:
- Enable remote MCP server for a project:Service Usage Admin (
roles/serviceusage.serviceUsageAdmin) - Make MCP tool calls in a project:MCP Tool User (
roles/mcp.toolUser) - Create, clone, or update a Cloud SQL instance:Cloud SQL Admin (
roles/cloudsql.admin) - Create or update a Cloud SQL user:Cloud SQL Admin (
roles/cloudsql.admin) - Execute SQL queries in Cloud SQL:
- Cloud SQL Admin (
roles/cloudsql.admin) - Cloud SQL Studio User (
roles/cloudsql.StudioUser)
- Cloud SQL Admin (
- Get a Cloud SQL instance or list all Cloud SQL instances in a project:Cloud SQL Viewer (
roles/cloudsql.viewer) - Import data into a Cloud SQL instance:
- Cloud SQL Admin (
roles/cloudsql.admin) - Storage Admin (
roles/storage.admin)
- Cloud SQL Admin (
- List Cloud SQL users:Cloud SQL Viewer (
roles/cloudsql.viewer)
For more information about granting roles, seeManage access to projects, folders, and organizations.
These predefined roles contain the permissions required to enable and use the Cloud SQL remote MCP server. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to enable and use the Cloud SQL remote MCP server:
serviceusage.mcppolicy.getserviceusage.mcppolicy.update- Make MCP tool calls:
mcp.tools.call - Clone a Cloud SQL instance:
cloudsql.instances.clone - Create a Cloud SQL instance:
cloudsql.instances.create - Create a Cloud SQL user:
cloudsql.users.create - Execute SQL queries on a Cloud SQL instance:
cloudsql.instances.executeSqlcloudsql.instances.login
- Get a Cloud SQL instance:
cloudsql.instances.get - Get a Cloud SQL instance operation:
cloudsql.instances.get - Import data to a Cloud SQL instance:
cloudsql.instances.import - List Cloud SQL instances in a project:
cloudsql.instances.list - List Cloud SQL users:
cloudsql.users.list - Update a Cloud SQL instance:
cloudsql.instances.update - Update a Cloud SQL user:
cloudsql.users.update
You might also be able to get these permissions withcustom roles or otherpredefined roles.
Enable or disable the Cloud SQL MCP server
Note: After March 17, 2026, theCloud SQL remote MCP server is enabled automaticallywhen youenable the Cloud SQL Admin API (sqladmin.googleapis.com) in a project.You can enable the Cloud SQL MCP serverin a project with thegcloud beta services mcp enable command.
Enable the Cloud SQL MCP server in a project
To enable the Cloud SQL MCP server in yourGoogle Cloud project, run the following command:
gcloudbetaservicesmcpenablesqladmin.googleapis.com\--project=PROJECT_IDReplace the following:
PROJECT_ID: the Google Cloud project ID.
After you run the command, the Cloud SQL remote MCP server is enabled.
If the Cloud SQL service isn't enabled for yourGoogle Cloud project, then you're prompted to enablethe service before enabling the Cloud SQL remote MCPserver.
If you're using different projects for your client credentials, such as serviceaccount keys, OAuth client ID or API keys, and for hosting your resources, thenyou must enable the Cloud SQL service and theCloud SQL remote MCP server on both projects.
Disable the Cloud SQL MCP server in a project
To disable the Cloud SQL MCP server in yourGoogle Cloud project, run the following command:
gcloudbetaservicesmcpdisablesqladmin.googleapis.com\--project=PROJECT_IDThe Cloud SQL MCP server is disabled for use inyour Google Cloud project.
Configure an MCP client to use the Cloud SQL MCP server
Host programs, such as Claude or the Gemini CLI, can instantiate MCPclients that connect to a single MCP server. A host program can have multipleclients that connect to different MCP servers. To connect to a remote MCP server,the MCP client must know at a minimum the URL of the remote MCP server.
Use the following instructions to configure MCP clients to connect to your remoteCloud SQL MCP server.
Gemini CLI
To add a Cloud SQL remote MCP server to your Gemini CLI, configure it as an extension.
Create an extension file in the following location:
~/.gemini/extensions/EXT_NAME/gemini-extension.jsonwhere~/is your home directory andEXT_NAME is the name you want to give the extension.Save the following content in your extension file:
{"name":"EXT_NAME","version":"1.0.0","mcpServers":{"Cloud SQL MCP Server":{"httpUrl":"https://sqladmin.googleapis.com/mcp","authProviderType":"google_credentials","oauth":{"scopes":["https://www.googleapis.com/auth/cloud-platform"]},"timeout":30000,"headers":{"x-goog-user-project":"PROJECT_ID"}}}}
Save the extensions file.
Start Gemini CLI:
gemini
Run
/mcpto view your configured MCP server and its tools.The response is similar to the following:
Configured MCP servers: 🟢 Cloud SQL MCP Server (from sqladmin )- list_instances- get_instance- clone_instance- create_instance- update_instance- execute_sql- import_data- create_user- update_user- list_users- get_operation
The remote MCP server is ready to use in Gemini CLI.
Claude.ai
You must have the Claude Enterprise, Pro, Max, or Team plan to configure Google and Google Cloud MCP servers in Claude.ai. For pricing information, seeClaude Pricing.
To add a Google or Google Cloud remote MCP server to Claude.ai, configure a custom connector with a OAuth client ID and OAuth client secret:
Create an Oauth 2.0 client ID and secret
In the Google Cloud console, go toGoogle Auth Platform > Clients > Create client.
You are prompted to create a project if you don't have one selected.
In theApplication type list, selectWeb application.
In theName field, enter a name for your application.
In theAuthorized redirect URIs section, click+ Add URI, and then add
https://claude.ai/api/mcp/auth_callbackin theURIs field.ClickCreate. The client is created. To access the client ID, in the Google Cloud console, go toGoogle Auth Platform > Clients.
In theOAuth 2.0 client IDs list, select the client name.
In theClient secrets section, copy theClient secret and save it in a secure place. You can only copy it once. If you lose it, delete the secret and create a new one.
Caution: treat client secrets like passwords and store them in a secure place.
Create a custom connector in Claude.ai
Follow the instructions for the Claude plan that you're using:
Enterprise and Team
In Claude.ai, navigate toAdmin settings > Connectors.
ClickAdd custom connector.
In theAdd custom connector dialog, enter the following:
- Server name: a human readable name for the server.
- Remote MCP server URL:
https://sqladmin.googleapis.com/mcp
Expand theAdvanced settings menu and then enter the following:
- OAuth client ID: the OAuth 2.0 client ID you created.
- OAuth client secret: the secret for your OAuth 2.0 client. To retrieve the secret, go toGoogle Auth Platform > Clients and then select the OAuth client ID you created. In theClient secrets section, click to copy theClient secret.
ClickAdd.
The custom connector is created.
Open theTools menu and enable the connector.
Claude.ai can use the MCP server.
Pro and Max
In Claude.ai, navigate toSettings > Connectors.
ClickAdd custom connector.
In theAdd custom connector dialog, enter the following:
- Server name: a human readable name for the server.
- Remote MCP server URL:
https://sqladmin.googleapis.com/mcp
Expand theAdvanced settings menu and then enter the following:
- OAuth client ID: the OAuth 2.0 client ID you created.
- OAuth client secret: the secret for your OAuth 2.0 client. To retrieve the secret, go toGoogle Auth Platform > Clients and then select the OAuth client ID you created. In theClient secrets section, click to copy theClient secret.
ClickAdd.
The custom connector is created.
Open theTools menu and enable the connector.
Claude.ai can use the MCP server.
General guidance for MCP clients
If your MCP client isn't listed inConfigure an MCP client to use the Cloud SQL MCP server,then you use the following information to connect to a remote MCPserver in your host program or AI application. You are promptedto enter details about the server, such as its name and URL.
For the Cloud SQL remote MCP server, enter the following asrequired:
- Server name: Cloud SQL MCP server
- Server URL orEndpoint: https://sqladmin.googleapis.com/mcp
- Transport: HTTP
- Authentication details: Depending on how you want to authenticate, you canenter your Google Cloud credentials, your OAuth Client IDand secret, or an agent identity and credentials.
For more general guidance, see the following resources:
Authentication and authorization
Cloud SQL MCP servers use theOAuth 2.0protocol withIdentity and Access Management (IAM)for authentication and authorization. AllGoogle Cloud identitiesare supported for authentication to MCP servers.
The Cloud SQL remote MCP server doesn't accept API keys.
We recommend creating a separate identity for agents using MCP tools so thataccess to resources can be controlled and monitored. For more information onauthentication, seeAuthenticate to MCP servers.
Cloud SQL MCP OAuth scopes
OAuth 2.0 uses scopes and credentials to determine if an authenticatedprincipal is authorized to take a specific action on a resource. For moreinformation about OAuth 2.0 scopes at Google, readUsing OAuth 2.0 to access Google APIs.
Cloud SQL has the following MCP tool OAuth scopes:
| Scope URI for gcloud CLI | Description |
|---|---|
https://www.googleapis.com/auth/cloud-platform | Create, update, and list Cloud SQL resources including instances and database users. Import data and execute SQL queries on Cloud SQL instances. |
Additional scopes might be required on the resources accessed during a toolcall. To view a list of scopes required forCloud SQL, seeCloud SQL Admin API.
Available tools
clone_instance: creates a Cloud SQL instance as a clone of source instance.create_instance: initiates the creation of a Cloud SQL instance.create_user: creates a database user for a Cloud SQL instance.execute_sql: executes any valid SQL statements (DDL, DCL, DQL, DML) on a Cloud SQLinstance.get_instance: gets the details of a Cloud SQL instance.get_operation: gets the status of a long-running operation in Cloud SQL.list_instances: lists all Cloud SQL instances in a project.list_users: lists all database users for a Cloud SQL instance.import_data: imports data into a Cloud SQL instance from Cloud Storage.update_instance: updates supported settings of a Cloud SQL instance.update_user: updates a database user for a Cloud SQL instance.
To view additional details of available MCP tools and their descriptions for theCloud SQL remote MCP server, see theCloud SQL MCP reference.
List tools
Use theMCP inspector to list tools, or send atools/list HTTP request directly to the Cloud SQLremote MCP server. Thetools/list method doesn't require authentication.
POST /mcp HTTP/1.1Host: sqladmin.googleapis.comContent-Type: application/json{ "jsonrpc": "2.0", "method": "tools/list",}Execute SQL statements
To execute SQL statements, your Cloud SQL instance must meet thefollowing requirements:
The
data_api_accesssetting on the instance must be set to thevalueALLOW_DATA_API. When you create an instanceusing thecreate_instancetool, thedata_api_accessisconfigured automatically.The Cloud SQL instance must also haveIAM database authentication enabled.The
execute_sqltool can only use anIAM database authentication user account to run SQL statements. The SQL statements will use theprivileges associated with the IAM database authentication user account.
If the instance isn't configured toALLOW_DATA_API, then use theupdate_instance toolto update the configuration for the instance.
Sample use cases
The following are sample use cases for the Cloud SQLMCP server:
Web application development
A sample use case might be the rapid development of web applications andthe provisioning of Cloud SQL instances as their source database.In this use case, using the Cloud SQL MCP server lets you build a newdatabase and populate it with initial data for a new project usingnatural language.
Sample prompt:
"Create a new PostgreSQL development instance and set up a table called products."Workflow:
The workflow for setting up a web application might look like the following:
Provisioning: The agent calls the
create_instancetool to create a new Cloud SQL instance with development environment-sized specifications.Verification: The agent uses the
get_operationtool to poll the status of the instance creation operation.Connection: When the operation is complete, the agent uses the
get_instancetool to retrieve the instance connection metadata.Schema setup: When ready, the agent uses the
execute_sqlto run theCREATE TABLE productsSQL statement.Data seeding: The agent uses
execute_sqlagain to insert initial seed data (DML) into the newly created table.Data seeding: When ready, the agent uses the
import_datato import a data file from Cloud Storage of products.
Query a database using natural language
You can query a Cloud SQL database, update records, and make schemaupdates using natural language.
Sample prompt:
"Add a `stock_count` column to the inventory table."Workflow: The workflow for querying a database with natural language might look like the following.
Schema migration: The agent calls
execute_sqlto run anALTER TABLEstatement, adding the newstock_countcolumn to the database schema.Validation: The agent uses
get_instanceto confirm that the instance update has successfully completed.
Sample prompt:
"Show me a list of shoes that are priced above $100 from the inventory table."Workflow:
- Query execution: The agent calls
execute_sqlto run the SQL statement that retrieves the data.
Limitations
The Cloud SQL remote MCP server has the following limitations:
- The
create_usertool doesn't support creatinga built-in authentication user with a password. - If the
execute_sqltool returns a response that'slarger than 10 MB, then the response will be truncated. - When using the
execute_sqltool, queries that run for longer than 30 secondscan time out.
Optional security and safety configurations
Google Cloud offers an integration with Model Armor for remoteMCP Servers to help you use MCP tools securely.For more information about MCP security and governance, seeAI security and safety.
Model Armor
Model Armor is aGoogle Cloud service designed to enhance the security andsafety of your AI applications. It works by proactively screening LLM promptsand responses, protecting against various risks and supporting responsible AIpractices. Whether you are deploying AI in your cloud environment, or onexternal cloud providers, Model Armor can helpyou prevent malicious input, verify content safety, protect sensitive data,maintain compliance, and enforce your AI safety and security policiesconsistently across your diverse AI landscape.
Model Armor is only available inspecific regional locations. If Model Armor isenabled for a project, and a call to that project comes from an unsupportedregion, then Model Armor makes a cross-regional call.For more information, seeModel Armor locations.
Caution: Model Armor logs the entire payload if arequest fails. This might expose sensitive information in the logs.Enable Model Armor
To enable Model Armor, complete the followingsteps:
To enable Model Armor on your Google Cloud project, run the followinggcloud CLI command:
gcloudservicesenablemodelarmor.googleapis.com\--project=PROJECT_IDReplacePROJECT_ID with yourGoogle Cloud project ID.
Configure protection for Google and Google Cloud remote MCP servers
To protect your MCP tool calls and responses, you create aModel Armor floor setting and then enableMCP content security for your project. A floor setting defines the minimumsecurity filters that apply across the project. This configuration applies aconsistent set of filters to all MCP tool calls and responses withinthe project.
Tip: Don't enable the prompt injection and jailbreak filter unless your MCP traffic carries natural language data.Set up a Model Armor floor setting with MCP sanitizationenabled. For more information, seeConfigure Model Armor floorsettings.
Note: If the agent and the MCP server are in different projects, you can create floor settings in both projects (the client project and the resource project). In this case, Model Armor is invoked twice, once for each project.See the following example command:
gcloudmodel-armorfloorsettingsupdate\--full-uri='projects/PROJECT_ID/locations/global/floorSetting'\--enable-floor-setting-enforcement=TRUE\--add-integrated-services=GOOGLE_MCP_SERVER\--google-mcp-server-enforcement-type=INSPECT_AND_BLOCK\--enable-google-mcp-server-cloud-logging\--malicious-uri-filter-settings-enforcement=ENABLED\--add-rai-settings-filters='[{"confidenceLevel": "HIGH", "filterType": "DANGEROUS"}]'
Replace
PROJECT_IDwith your Google Cloud projectID.Note the following settings:
INSPECT_AND_BLOCK: The enforcement type that inspects content for the Google MCP server and blocks prompts andresponses that match the filters.ENABLED: The setting that enables a filter orenforcement.HIGH: The confidence level for the Responsible AI - Dangerous filter settings. You can modify this setting, thoughlower values might result in more false positives. For more information,seeConfigure floor settings.
For your project, enable Model Armor protection for remote MCP servers.
gcloudbetaservicesmcpcontent-securityaddmodelarmor.googleapis.com--project=PROJECT_IDReplace
PROJECT_IDwith your Google Cloudproject ID. After you run this command, Model Armor sanitizesall MCP tool calls and responses from the project, regardless of where thecalls and responses originate.To confirm that Google MCP traffic is sent to Model Armor,run the following command:
gcloudbetaservicesmcpcontent-securityget--project=PROJECT_IDReplace
PROJECT_IDwith the Google Cloud project ID.
Disable Model Armor in a project
To disable Model Armor on a Google Cloud project, run thefollowing command:
gcloudbetaservicesmcpcontent-securityremovemodelarmor.googleapis.com\--project=PROJECT_IDReplacePROJECT_ID with the Google Cloud projectID.
Google MCP traffic won't be scanned by Model Armor for thespecified project.
Disable scanning MCP traffic with Model Armor
If you want to use Model Armor in a project, and you want to stopscanning Google MCP traffic with Model Armor, run the followingcommand:
gcloudmodel-armorfloorsettingsupdate\--full-uri='projects/PROJECT_ID/locations/global/floorSetting'\--remove-integrated-services=GOOGLE_MCP_SERVERReplacePROJECT_ID with the Google Cloud projectID.
Model Armor won't scan MCP traffic in the project.
Control MCP use with IAM deny policies
Identity and Access Management (IAM) deny policies help yousecure Google Cloud remote MCP servers. Configure these policies to blockunwanted MCP tool access.
For example, you can deny or allow access based on:
- The principal.
- Tool properties like read-only.
- The application's OAuth client ID.
For more information, seeControl MCP use with Identity and Access Management.
What's next
- Read theCloud SQL MCP tools documentation.
- Learn more aboutMCP.
- Learn about otherremote MCP servers.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.