AlloyDB 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 alloydb-postgres server as a plugin/extension to interact with AlloyDB 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 AlloyDB 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 AlloyDB API enabled.
- Ensure Application Default Credentials are available in your environment.
- IAM Permissions:
- AlloyDB Client (
roles/alloydb.client)
- AlloyDB Admin (
roles/alloydb.admin)
Getting Started
Configuration
Please keep these env vars handy during the installation process:
ALLOYDB_POSTGRES_PROJECT: The GCP project ID.
ALLOYDB_POSTGRES_REGION: The region of your AlloyDB instance.
ALLOYDB_POSTGRES_CLUSTER: The ID of your AlloyDB cluster.
ALLOYDB_POSTGRES_INSTANCE: The ID of your AlloyDB instance.
ALLOYDB_POSTGRES_DATABASE: The name of the database to connect to.
ALLOYDB_POSTGRES_USER: (Optional) The database username.
ALLOYDB_POSTGRES_PASSWORD: (Optional) The password for the database user.
ALLOYDB_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 AlloyDB 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
You can use either of these two agents for Antigravity: