AlloyDB Admin API using MCP
This guide covers how to use MCP Toolbox for Databases to create AlloyDB clusters and instances from IDE enabling their E2E journey.
- Cursor
- Windsurf (Codium)
- Visual Studio Code (Copilot)
- Cline (VS Code extension)
- Claude desktop
- Claude code
- Gemini CLI
- Gemini Code Assist
Before you begin
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.
Install MCP Toolbox
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.10.0+:
curl -O https://storage.googleapis.com/genai-toolbox/v0.10.0/linux/amd64/toolboxcurl -O https://storage.googleapis.com/genai-toolbox/v0.10.0/darwin/arm64/toolboxcurl -O https://storage.googleapis.com/genai-toolbox/v0.10.0/darwin/amd64/toolboxcurl -O https://storage.googleapis.com/genai-toolbox/v0.10.0/windows/amd64/toolbox.exeMake the binary executable:
chmod +x toolboxVerify the installation:
./toolbox --version
Configure your MCP Client
- Install Claude Code.
- Create a
.mcp.jsonfile in your project root if it doesn’t exist. - Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "alloydb-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"], "env": { "API_KEY": "your-api-key" } } } }Restart Claude code to apply the new configuration.
- Open Claude desktop and navigate to Settings.
- Under the Developer tab, tap Edit Config to open the configuration file.
- Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "alloydb-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"], "env": { "API_KEY": "your-api-key" } } } }Restart Claude desktop.
From the new chat screen, you should see a hammer (MCP) icon appear with the new MCP server available.
- Open the Cline extension in VS Code and tap the MCP Servers icon.
- Tap Configure MCP Servers to open the configuration file.
- Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "alloydb-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"], "env": { "API_KEY": "your-api-key" } } } }You should see a green active status after the server is successfully connected.
- 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. - Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "alloydb-admin": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"], "env": { "API_KEY": "your-api-key" } } } }Cursor and navigate to Settings > Cursor Settings > MCP. You should see a green active status after the server is successfully connected.
- 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. - Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
- Add the following configuration, replace the environment variables with your values, and save:
{
"mcpServers": {
"alloydb-admin": {
"command": "./PATH/TO/toolbox",
"args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
- Open Windsurf and navigate to the Cascade assistant.
- Tap on the hammer (MCP) icon, then Configure to open the configuration file.
- Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
- Add the following configuration, replace the environment variables with your values, and save:
{
"mcpServers": {
"alloydb-admin": {
"command": "./PATH/TO/toolbox",
"args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
- Install the Gemini CLI.
- In your working directory, create a folder named
.gemini. Within it, create asettings.jsonfile. - Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
- Add the following configuration, replace the environment variables with your values, and save:
{
"mcpServers": {
"alloydb-admin": {
"command": "./PATH/TO/toolbox",
"args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
- 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. - Generate Access token to be used as API_KEY using
gcloud auth print-access-token.
Note: The lifetime of token is 1 hour.
- Add the following configuration, replace the environment variables with your values, and save:
{
"mcpServers": {
"alloydb-admin": {
"command": "./PATH/TO/toolbox",
"args": ["--prebuilt", "alloydb-postgres-admin", "--stdio"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Use Tools
Your AI tool is now connected to AlloyDB using MCP. Try asking your AI assistant to create a database, cluster or instance.
The following tools are available to the LLM:
- alloydb-create-cluster: creates alloydb cluster
- alloydb-create-instance: creates alloydb instance (PRIMARY, READ_POOL or SECONDARY)
- alloydb-get-operation: polls on operations API until the operation is done.
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.
Connect to your Data
After setting up an AlloyDB cluster and instance, you can connect your IDE to the database.