Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "postgres",
"owner": {
"name": "Google LLC",
"email": "data-cloud-ai-integrations@google.com"
},
"metadata": {
"description": "Connect and interact with a PostgreSQL database and data."
},
"plugins": [
{
"name": "postgres",
"source": "./"
}
]
}
69 changes: 69 additions & 0 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "postgres",
"version": "0.2.2",
"description": "Connect and interact with a PostgreSQL database and data",
"author": {
"name": "Google LLC",
"email": "data-cloud-ai-integrations@google.com"
},
"repository": "https://github.com/gemini-cli-extensions/postgres",
"license": "Apache-2.0",
"userConfig": {
"postgres_database": {
"title": "Database",
"description": "Name of the database",
"type": "string",
"sensitive": false
},
"postgres_user": {
"title": "User",
"description": "Username of the database user",
"type": "string",
"sensitive": false
},
"postgres_password": {
"title": "Password",
"description": "Password of the database user",
"type": "string",
"sensitive": true
},
"postgres_host": {
"title": "Host",
"description": "Host or IP address of the PostgreSQL server",
"type": "string",
"sensitive": false
},
"postgres_port": {
"title": "Port",
"description": "Port number of the PostgreSQL server",
"type": "string",
"sensitive": false
},
"postgres_query_params": {
"title": "Query Params",
"description": "(Optional) Connection String Parameters",
"type": "string",
"sensitive": false
}
},
"mcpServers": {
"postgresql": {
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server@1.8.0",
"--prebuilt",
"postgres",
"--stdio"
],
"env": {
"POSTGRES_DATABASE": "${user_config.postgres_database}",
"POSTGRES_USER": "${user_config.postgres_user}",
"POSTGRES_PASSWORD": "${user_config.postgres_password}",
"POSTGRES_HOST": "${user_config.postgres_host}",
"POSTGRES_PORT": "${user_config.postgres_port}",
"POSTGRES_QUERY_PARAMS": "${user_config.postgres_query_params}"
}
}
}
}
22 changes: 22 additions & 0 deletions .codex-plugin/.mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"mcpServers": {
"postgresql": {
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server@1.8.0",
"--prebuilt",
"postgres",
"--stdio"
],
"env_vars": [
"POSTGRES_DATABASE",
"POSTGRES_USER",
"POSTGRES_PASSWORD",
"POSTGRES_HOST",
"POSTGRES_PORT",
"POSTGRES_QUERY_PARAMS"
]
}
}
}
12 changes: 12 additions & 0 deletions .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "postgres",
"version": "0.2.2",
"description": "Connect and interact with a PostgreSQL database and data",
"author": {
"name": "Google LLC",
"email": "data-cloud-ai-integrations@google.com"
},
"repository": "https://github.com/gemini-cli-extensions/postgres",
"license": "Apache-2.0",
"mcpServers": "./.codex-plugin/.mcp.json"
}
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,73 @@ Learn more about [Gemini CLI Extensions](https://github.com/google-gemini/gemini

Before you begin, ensure you have the following:

* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed with version **+v0.6.0**.
* Setup Gemini CLI [Authentication](https://github.com/google-gemini/gemini-cli/tree/main?tab=readme-ov-file#-authentication-options).
* One of the supported agent harnesses, installed and authenticated:
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) (v0.6.0+)
* [Claude Code](https://code.claude.com)
* [Codex](https://developers.openai.com/codex)
* [Antigravity CLI](https://antigravity.google)
Comment thread
wangauone marked this conversation as resolved.
* [Node.js](https://nodejs.org/) (the MCP server runs via `npx`).
* A running PostgreSQL instance.
* Users are granted database-level permissions to execute queries.

## Getting Started

### Installation

To install the extension, use the command:
All harnesses use the same plugin; the MCP server runs via `npx` (no binary to download). Install with your harness of choice:

**Gemini CLI**

```bash
gemini extensions install https://github.com/gemini-cli-extensions/postgres
```

**Claude Code**

```bash
claude plugin marketplace add gemini-cli-extensions/postgres
claude plugin install postgres@postgres
```

**Codex**

```bash
codex plugin marketplace add gemini-cli-extensions/postgres
codex plugin add postgres@postgres
```

**Antigravity**

```bash
agy plugin install https://github.com/gemini-cli-extensions/postgres
```

See [Configuration](#configuration) for how each harness supplies the connection settings.

### Configuration

You will be prompted to configure the following settings during installation. These settings are saved in an `.env` file within the extension's directory.
The plugin connects to PostgreSQL using these settings:

* `POSTGRES_HOST`: (Optional) The Postgres host. Defaults to `localhost`.
* `POSTGRES_PORT`: (Optional) The Postgres port. Defaults to `5432`.
* `POSTGRES_DATABASE`: The name of the database to connect to.
* `POSTGRES_USER`: The database username.
* `POSTGRES_PASSWORD`: The password for the database user.
* `POSTGRES_HOST`: (Optional) The Postgres host. Defaults to `localhost`.
* `POSTGRES_PORT`: (Optional) The Postgres port. Defaults to `5432`.
* `POSTGRES_QUERY_PARAMS`: (Optional) Connection string parameters.
Comment thread
wangauone marked this conversation as resolved.

To view or update your configuration:

**List Settings:**
* Terminal: `gemini extensions list`
* Gemini CLI: `/extensions list`

**Update Settings:**
* Terminal: `gemini extensions config postgres [setting name] [--scope <scope>]`
* `setting name`: (Optional) The single setting to configure.
* `scope`: (Optional) The scope of the setting in (`user` or `workspace`). Defaults to `user`.
* Currently, you must restart the Gemini CLI for changes to take effect. We recommend using `gemini --resume` to resume your session.
How you supply them depends on the harness:

Alternatively, you can manually set these environment variables before starting the Gemini CLI:
* **Gemini CLI**: prompted on install and saved to the extension's `.env`. View or update later with `gemini extensions list` / `gemini extensions config postgres [setting] [--scope user|workspace]` (restart the CLI to apply).
* **Claude Code**: pass `--config KEY=VALUE` on install (repeatable), or run `/plugin` inside Claude Code.
* **Codex** and **Antigravity**: export the variables in your shell before starting:

```bash
export POSTGRES_HOST="<your-postgres-host>" # Optional: defaults to localhost
export POSTGRES_PORT="<your-postgres-port>" # Optional: defaults to 5432
export POSTGRES_DATABASE="<your-database-name>"
export POSTGRES_USER="<your-database-user>"
export POSTGRES_PASSWORD="<your-database-password>"
export POSTGRES_HOST="<your-postgres-host>" # Optional, defaults to localhost
export POSTGRES_PORT="<your-postgres-port>" # Optional, defaults to 5432
export POSTGRES_QUERY_PARAMS="<your-connection-string-params>" # Optional
```

> [!NOTE]
Expand Down
20 changes: 10 additions & 10 deletions gemini-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
},
"contextFileName": "POSTGRESQL.md",
"settings": [
{
"name": "Host",
"description": "Host or IP address of the PostgreSQL server",
"envVar": "POSTGRES_HOST"
},
{
"name": "Port",
"description": "Port number of the PostgreSQL server",
"envVar": "POSTGRES_PORT"
},
{
"name": "Database",
"description": "Name of the database",
Expand All @@ -41,6 +31,16 @@
"description": "Password of the database user",
"envVar": "POSTGRES_PASSWORD"
},
{
"name": "Host",
"description": "Host or IP address of the PostgreSQL server",
"envVar": "POSTGRES_HOST"
},
{
"name": "Port",
"description": "Port number of the PostgreSQL server",
"envVar": "POSTGRES_PORT"
},
{
"name": "Query Params",
"description": "(Optional) Connection String Parameters",
Expand Down
16 changes: 16 additions & 0 deletions mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"mcpServers": {
"postgresql": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server@1.8.0",
"--prebuilt",
"postgres",
"--stdio"
]
}
}
}
14 changes: 14 additions & 0 deletions mcp_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"mcpServers": {
"postgresql": {
"command": "npx",
"args": [
"-y",
"@toolbox-sdk/server@1.8.0",
"--prebuilt",
"postgres",
"--stdio"
]
}
}
}
52 changes: 52 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "postgres",
"version": "0.2.2",
"description": "Connect and interact with a PostgreSQL database and data",
"author": {
"name": "Google LLC",
"email": "data-cloud-ai-integrations@google.com"
},
"repository": "https://github.com/gemini-cli-extensions/postgres",
"license": "Apache-2.0",
"extensions": {
"com.google.cloud.data.agent-plugins": {
"config": [
{
"key": "POSTGRES_DATABASE",
"title": "Database",
"description": "Name of the database"
},
{
"key": "POSTGRES_USER",
"title": "User",
"description": "Username of the database user"
},
{
"key": "POSTGRES_PASSWORD",
"title": "Password",
"description": "Password of the database user",
"sensitive": true
},
{
"key": "POSTGRES_HOST",
"title": "Host",
"description": "Host or IP address of the PostgreSQL server"
},
{
"key": "POSTGRES_PORT",
"title": "Port",
"description": "Port number of the PostgreSQL server"
},
{
"key": "POSTGRES_QUERY_PARAMS",
"title": "Query Params",
"description": "(Optional) Connection String Parameters"
}
],
"gemini": {
"contextFileName": "POSTGRESQL.md",
"mcpServerName": "postgresql"
}
}
}
}
Loading