Skip to content

Commit 14709fd

Browse files
committed
chore: Add initial docs
0 parents  commit 14709fd

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

CLOUD-SQL-POSTGRESQL.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Cloud SQL for PostgreSQL Extension
2+
3+
This document provides instructions for the Gemini agent to assist users with the Cloud SQL for PostgreSQL extension.
4+
5+
## Cloud SQL for PostgreSQL MCP Server (Data Plane: Connecting and Querying)
6+
7+
This section covers connecting to a Cloud SQL for PostgreSQL instance.
8+
9+
1. **Verify Environment Variables**: Before attempting to connect, confirm with the user that the following environment variables are set in the extension configuration or their shell environment.
10+
11+
* `CLOUD_SQL_POSTGRES_PROJECT`: The GCP project ID.
12+
* `CLOUD_SQL_POSTGRES_REGION`: The region of your Cloud SQL instance.
13+
* `CLOUD_SQL_POSTGRES_INSTANCE`: The ID of your Cloud SQL instance.
14+
* `CLOUD_SQL_POSTGRES_DATABASE`: The name of the database to connect to.
15+
* `CLOUD_SQL_POSTGRES_USER`: The database username.
16+
* `CLOUD_SQL_POSTGRES_PASSWORD`: The password for the database user.
17+
18+
2. **Handle Missing Variables**: If a command fails with an error message containing a placeholder like `${CLOUD_SQL_POSTGRES_PROJECT}`, it signifies a missing environment variable. Inform the user which variable is missing and instruct them to set it.
19+
20+
3. **Handle Permission Errors**: If you encounter permission errors, ensure the user has the **Cloud SQL Client** (`roles/cloudsql.client`) role and the correct database-level permissions.

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Gemini CLI Extension - Cloud SQL for PostgreSQL
2+
3+
This Gemini CLI extension provides a set of tools to interact with [Cloud SQL for PostgreSQL](https://cloud.google.com/sql/docs/postgres) instances. It allows you to manage your databases, execute queries, and explore schemas directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.
4+
5+
## Features
6+
7+
* **Integrated with Gemini CLI:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment, making security an accessible part of your workflow.
8+
* **Connect to Cloud SQL for PostgreSQL:** Securely connect to your Cloud SQL for PostgreSQL instances.
9+
* **Explore Database Schema:** List databases, tables, views, and schemas.
10+
* **Query your Database:** Execute SQL queries against your database.
11+
12+
## Supported Tools
13+
14+
🟢 list-tables: Use this tool to list tables and descriptions.
15+
🟢 execute-sql: Use this tool to execute any SQL statement.
16+
🚧 cloudsql-wait-for-operation: Polls the operations API until an operation is complete.
17+
🚧 cloudsql-user-create: Use this tool to create a new user for a Cloud SQL instance.
18+
🚧 cloudsql-database-list: Use this tool to list databases within a Cloud SQL instance.
19+
🚧 cloudsql-database-create: Use this tool to create a new database within a Cloud SQL instance.
20+
🚧 cloudsql-instance-list: Use this tool to list Cloud SQL instances in a given project and location.
21+
🚧 cloudsql-instance-get: Use this tool to get details about a specific Cloud SQL instance.
22+
🚧 cloudsql-instance-create: Use this tool to create (insert) a new Cloud SQL instance.
23+
🔜 csql-postgresql-system-metrics: Use this tool to retrieve system metrics for a Cloud SQL for PostgreSQL instance.
24+
🔜 csql-postgresql-query-metrics: Use this tool to retrieve query-related metrics for a Cloud SQL for PostgreSQL instance.
25+
26+
## Prerequisites
27+
28+
Before you begin, ensure you have the following:
29+
30+
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed.
31+
* A Google Cloud project with the **Cloud SQL Admin API** enabled.
32+
* IAM Permissions
33+
34+
## Installation
35+
36+
To install the extension, use the `gemini extensions install` command:
37+
38+
```bash
39+
gemini extensions install github.com/gemini-cli-extensions/cloud-sql-postgresql.git
40+
```
41+
42+
## Configuration
43+
44+
* `CLOUD_SQL_POSTGRES_PROJECT`: The GCP project ID.
45+
* `CLOUD_SQL_POSTGRES_REGION`: The region of your Cloud SQL instance.
46+
* `CLOUD_SQL_POSTGRES_INSTANCE`: The ID of your Cloud SQL instance.
47+
* `CLOUD_SQL_POSTGRES_DATABASE`: The name of the database to connect to.
48+
* `CLOUD_SQL_POSTGRES_USER`: (Optional) The database username.
49+
* `CLOUD_SQL_POSTGRES_PASSWORD`: (Optional) The password for the database user.
50+
* `CLOUD_SQL_POSTGRES_IP_TYPE`: (Optional) The IP Type.
51+
52+
53+
## Usage
54+
55+
* Provision Infrastructure
56+
* Explore Schemas and Data
57+
* Generate code
58+
59+
60+
## Security
61+
62+
This extension executes commands against your Cloud SQL for PostgreSQL database. Always review the generated SQL queries before execution, especially for write operations.
63+
64+
## Disclaimer
65+
66+
This is not an officially supported Google product. This extension is under active development, and breaking changes may be introduced.

gemini-extension.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "Cloud SQL for PostgreSQL",
3+
"version": "0.1.0",
4+
"description": "Create, connect, and interact with a Cloud SQL for PostgreSQL database and data.",
5+
"mcpServers": {
6+
"Cloud SQL for PostgreSQL": {
7+
"command": "${extensionPath}${/}toolbox",
8+
"args": [
9+
"--prebuilt",
10+
"cloud-sql-postgres",
11+
"--stdio"
12+
],
13+
"env": {
14+
"CLOUD_SQL_POSTGRESQL_PROJECT": "${CLOUD_SQL_POSTGRESQL_PROJECT}",
15+
"CLOUD_SQL_POSTGRESQL_REGION": "${CLOUD_SQL_POSTGRESQL_REGION}",
16+
"CLOUD_SQL_POSTGRESQL_INSTANCE": "${CLOUD_SQL_POSTGRESQL_INSTANCE}",
17+
"CLOUD_SQL_POSTGRESQL_DATABASE": "${CLOUD_SQL_POSTGRESQL_DATABASE}"
18+
}
19+
}
20+
},
21+
"contextFileName": "CLOUD-SQL-POSTGRESQL.md"
22+
}

0 commit comments

Comments
 (0)